Simple property not found? - jsp-tags

What is solution for simple property not found,jodd bean bean exception?
Moreover data doesnt get inserted into Database
at java.lang.Thread.run(Thread.java:745)
11:20:59,247 ERROR [http-bio-28080-exec-11][BeanPropertiesImpl:337] jodd.bean.BeanException: Simple property not found: hId Invalid property: 'heighttableImpl#hId' (actual:'heighttableImpl#hId', forced=false)
jodd.bean.BeanException: Simple property not found: hId Invalid property: 'heighttableImpl#hId' (actual:'heighttableImpl#hId', forced=false)
at jodd.bean.BeanUtilBean.getSimpleProperty(BeanUtilBean.java:158)
at jodd.bean.BeanUtilBean.getIndexProperty(BeanUtilBean.java:250)
at jodd.bean.BeanUtilBean.getProperty(BeanUtilBean.java:482)
at jodd.bean.BeanUtil.getProperty(BeanUtil.java:111)

This means that there is no simple property hId in the class heighttableImpl. Can you show us the source of this class?
Property has to be accessible in that class and optionally to have the getter, in order to be read.

Related

Why can't I access getter in bidirectional value binding's write-back phase?

I'm trying to establish a bidirectional data binding as follows:
<h:outputText value="#{cc.getAspect('meta').metaInfo.previousValue}" />
But I'm getting the following Exception, only when writing back though (the value is initially displayed just fine upon loading the page):
Caused by: javax.el.PropertyNotFoundException: /resources/meta.xhtml #23,124
value="#{cc.getAspect('meta').metaInfo.previousValue}":
The class 'org.foo.client.jsf.UIComponent' does not have the property 'getAspect'.
Now I'm wondering:
1) The getAspect method is definitely there (double checked, also it works upon read after all). By "property" does JSF denote a "field" and is actually implicitly trying to access setgetAspect or somthing? If so, why?
2) Why would it even try to write, that is to access a setter, on the getAspect in the first place?? The only value that is or should be written is previousValue, just located down the object path cc.getAspect('meta').metaInfo.previousValue which only reads the meta aspect via getAspect.
Any ideas greatly appreciated, thanks
EDIT: Environment: JBoss EAP 6.1.0.GA, JSF Implementation: Mojarra 2.1.19

javax.el.ELException: Error reading 'foo' on type com.example.Bean

I am reading the following tutorial:
The expression used in the h:dataTable/#value normally specifies a property
name for which a getter was defined, which means that in the controller
BookController class a property books is defined (optional) as well as a
method named getBooks (this is mandatory). In this particular case it is
just sufficient to define the getBooks method since there is no need of the
books property in the controller class
I have been trying to work such an idea in my eclipse and tomcat 7. but it keeps tilling me:
javax.el.ELException: /views/books/listAll.xhtml #9,60 value="#{bookController.books}": Error reading 'books' on type pl.ctrl.BookController
My question is, is it possible to have:
<h:dataTable value="#{bookController.books}" var="b">
While there is no books property but just getBooks() getter method in #{bookController} managed bean?
Your problem is different than what the book tells. If JSF/EL couldn't find the getter method in its entirety, you would have gotten the below exception:
javax.el.PropertyNotFoundException: Property 'books' not found on type pl.ctrl.BookController
Or if it couldn't find the bean itself in its entirety:
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'bookController' resolved to null
But instead you got:
javax.el.ELException: Error reading 'books' on type pl.ctrl.BookController
This means that the bean and the getter method was found, but invoking the getter method threw an exception. Basically, the following is happening under JSF/EL's covers:
try {
Object result = bookController.getBooks();
} catch (Exception e) {
throw new ELException("Error reading 'books' on type pl.ctrl.BookController", e);
}
Note the e being passed as cause of the ELException. The original exception must thus be visible as "Caused by" further down in the stack trace which you didn't post anywhere in the question. The bottommost one is the root cause of all and is the answer to your concrete problem. In case you're unable to interpret it, simply copypaste the exception type and message into a decent search engine to find answers and clues.
Unrelated to the concrete problem, an exception thrown from a getter method in turn indicates fishy code. A getter method isn't supposed to do any exception sensitive business logic. Namely, it can be invoked multiple times per bean's life and repeating the very same business logic over and over during all bean's life is plain inefficient. Stop doing that and move the business logic to an one time initialization or action/event listener method. The getter method must merely return the already-prepared property. See also Why JSF calls getters multiple times and How and when should I load the model from database for h:dataTable.

Cassandra - User defined data type

I have tried Cassandra user defined data type example given by DataStax and I'm getting the below exception.
They did not specify how Address object should look like for this case. I have defined UDT type but it doesn't help.
Can any one help me how the Address class should look like?
java.lang.IllegalArgumentException: Cannot map unknown class com.att.opus.mytest.Address for field private com.att.opus.mytest.Address com.att.opus.mytest.Account.address
at com.datastax.driver.mapping.ReflectionMapper.getSimpleType(ReflectionMapper.java:321)
at com.datastax.driver.mapping.ReflectionMapper.extractType(ReflectionMapper.java:286)
at com.datastax.driver.mapping.ReflectionMapper$LiteralMapper.<init>(ReflectionMapper.java:65)
at com.datastax.driver.mapping.ReflectionMapper$LiteralMapper.<init>(ReflectionMapper.java:59)
at com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:372)
at com.datastax.driver.mapping.AnnotationParser.convert(AnnotationParser.java:154)
at com.datastax.driver.mapping.AnnotationParser.parseEntity(AnnotationParser.java:103)
at com.datastax.driver.mapping.MappingManager.getMapper(MappingManager.java:119)
at com.datastax.driver.mapping.MappingManager.mapper(MappingManager.java:76)
at com.att.opus.mytest.AccountMapper.test(AccountMapper.java:12)
at com.att.poc.Main.accountTest(Main.java:53)
at com.att.poc.Main.main(Main.java:40)
Not sure it the problem still persists, but it seems that Your Address class should be annotated with #UDT annotation, as described here

Error calling method in java-class 'ClassA' 'org.my.ClassB' is incompatible with 'org.my.ClassB'

I have two classes org.my.ClassA and org.my.ClassB both classes are in the same package org.my in the WEB-INF/src in the same database.
ClassA has the method public add(org.my.ClassB newB){...}.
In SSJS I have a code block in which I call ClassA.add(ClassB) which normally works fine. Until some unknown point where the Server can't see that org.my.ClassB === org.my.ClassB and it returns the error (message translated from German maybe looks different in English version):
error calling method 'add(org.my.ClassB)' in java-class 'ClassA'.
'org.my.ClassB' is incompatible with 'org.my.ClassB'.
and it points to my line in the SSJS: ClassA.add(ClassB);
What I tried so far:
First I added the line importPackage(org.my); to my SSJS Code. No luck.
I tried to add another method add(Object newB) and then cast the object to ClassB but same result. The error does not seem to come from the java class its from the SSJS code because it cant find the method with an argument of the type org.my.ClassB. But if I test the object in the SSJS code it returns org.my.ClassB.
Then I tried to add the classpath to all variables in the SSJS block like: var newB:org.my.ClassB = new org.my.ClassB(). But same result after some time the application breaks with the same error.
From my Point of view it got to do something with the caching of compiled classes, or so because if I clear the database everything works just fine again.
Hope someone has a solution on this.
This is a class loader problem.
You can find more details about the issue in the answer from Frantisek Kossuth:
See here more details: Meaning of java.lang.ClassCastException: someClass incompatible with someClass

Error on SimpleTemplateEngine embedded in Java: Could not instantiate custom Metaclass for class: java.util.ArrayList

I have a app where my users input a HTML template with SimpleTemplateEngine notation, and execute this template with code above, in a Java Class:
new SimpleTemplateEngine().createTemplate(templateStr).make(map).toString()
and I obtain this error:
groovy.lang.GroovyRuntimeException: Could not instantiate custom Metaclass for class: java.util.ArrayList. Reason: java.lang.NoSuchMethodException: groovy.runtime.metaclass.java.util.ArrayListMetaClass.<init>(groovy.lang.MetaClass)
I observe that error occurrs in a loop in a java.util.ArrayLIst in a JPA Entity loaded by Hibernate:
<%for(int k=0; k< Registro[i].listUsers.size();k++){%>
HTML CODE
<%}%>
Anyone can help me? I no have more ideas about this error...
Thanks!
I'm guessing that the part Registro[i] is for getting the value of a static property which name is held under the variable i (or at least that is what will happen) unless the getAt(String) method has been overloaded on Registro.
Either way I also guess that returns an object that has a listUsers property that should be at least a Collection.
Maybe the problem is with the initialization of said listUsers property.
Some Registro code could be used for better understanding.

Resources