Problem description:
Here is my problem with total confusion, I can set properties on subclass( pk class for ClassB) of ClassB but why I can't set properties on ClassB itself, and the same issue for ClassC. I have working search page where I used to set properties of ClassA and it's primary key class ClassAPk. This issue popped up only after business wanted to add more search parameters from ClassB and ClassC. At this point, I am not sure if this hibernate or xwork issue but it says nested exception is net.sf.hibernate.QueryException: could not resolve property: classC.prop1 of: ClassA in my exception catch blok but NPE on xwork. Any suggestions/feedback would be greatly appreciated. I am posting this issue to both opensymphony and hibernate forums.
Welogic log(for complete log files scroll down): [2005-04-29 09:32:31,123] [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] ERROR
com.opensymphony.xwork.util.InstantiatingNullHandler - Could not create and/or set value
back on to object
java.lang.NullPointerException
at com.opensymphony.xwork.util.InstantiatingNullHandler.nullPropertyValue(Instanti
atingNullHandler.java:72)
at ognl.ASTProperty.getValueBody(ASTProperty.java:98)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171)
at ognl.SimpleNode.getValue(SimpleNode.java:193)
at ognl.ASTChain.setValueBody(ASTChain.java:168)
ClassA --> ClassAPk, ClassB, ClassC (ClassA holds references to ClassB, ClassC and its pk class ClassAPk
)
ClassB --> ClassBPk, ClassA(ClassB holds references to ClassA and set of ClassA)
ClassC --> ClassCPk, ClassA(ClassC holds references to ClassA and set of ClassA)
ClassA mapping:
<hibernate-mapping>
<class name="ClassA" table="TABLE_CLASSA" >
<composite-id name="comp_id" class="ClassAPk">
<key-property
name="prop1"
column="CLASSA_ID"
type="java.lang.String"
length="30"
/>
</composite-id>
<property
name="prop1"
type="java.lang.String"
column="CLASSA_PROP1"
length="1"
/>
<many-to-one
name="ClassB"
class="ClassB"
not-null="true"
>
<column name="CLASSB_ID" />
</many-to-one>
<!-- bi-directional many-to-one association to ServingRateCenter -->
<many-to-one
name="ClassC"
class="ClassC"
update="false"
insert="false"
>
<column name="CLASSC_ID1" />
<column name="CLASSC_ID2" />
</many-to-one>
</class>
</hibernate-mapping>
ClassB mapping(ClassC is similar to ClassB mapping):
<hibernate-mapping>
<class name="ClassB" table="TABLE_CLASSB" >
<composite-id name="comp_id" class="ClassBPk">
<key-property
name="prop1"
column="CLASSB_ID1"
type="java.lang.String"
length="30"
/>
</composite-id>
<property
name="prop1"
type="java.lang.String"
column="CLASSB_PROP1"
length="1"
/>
<!-- bi-directional one-to-many association to RateCenter -->
<set name="classAs" lazy="true" inverse="true" cascade="none" >
<key>
<column name="CLASSA_ID" />
</key>
<one-to-many class="ClassA" />
</set>
</class>
</hibernate-mapping>
I am using velocity template to build search functionality so I need to set properties to create search parameters, here is how I do in the velocity page:
ClassA Search value:
<input type="text" name="classA.comp_id.prop1" value="">
<input type="text" name="classA.comp_id.prop2" value="">
<input type="text" name="classA.prop1" value="">
ClassB Search value:
<input type="text" name="classB.comp_id.prop1" value="">
<input type="text" name="classB.prop1" value="">
ClassC Search value:
<input type="text" name="classC.comp_id.prop1" value="">
<input type="text" name="classC.prop1" value="">
nested exception is net.sf.hibernate.QueryException: could not resolve property: classB.prop1 of: ClassA
nested exception is net.sf.hibernate.QueryException: could not resolve property: classC.prop1 of: ClassA
Full stack trace of any exception that occurs:[2005-04-29 09:32:30,889] [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] INFO
org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator - Checking for custo
m TargetSource for bean with beanName 'searchRateCenterAction'
[2005-04-29 09:32:30,889] [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] INFO
org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator - Checking for custo
m TargetSource for bean with beanName 'searchRateCenterAction'
[2005-04-29 09:32:31,123] [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] INFO
org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator - Checking for custo
m TargetSource for bean with beanName 'findProductAction'
[2005-04-29 09:32:31,123] [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] INFO
org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator - Checking for custo
m TargetSource for bean with beanName 'findProductAction'
[2005-04-29 09:32:31,123] [ExecuteThread: '12' for queue: 'weblogic.kernel.Default'] ERROR
com.opensymphony.xwork.util.InstantiatingNullHandler - Could not create and/or set value
back on to object
java.lang.NullPointerException
at com.opensymphony.xwork.util.InstantiatingNullHandler.nullPropertyValue(Instanti
atingNullHandler.java:72)
at ognl.ASTProperty.getValueBody(ASTProperty.java:98)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:171)
at ognl.SimpleNode.getValue(SimpleNode.java:193)
at ognl.ASTChain.setValueBody(ASTChain.java:168)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:180)
at ognl.SimpleNode.setValue(SimpleNode.java:230)
at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork.util.OgnlUtil.setValue(OgnlUtil.java:189)
at com.opensymphony.xwork.util.OgnlValueStack.setValue(OgnlValueStack.java:115)
at com.opensymphony.xwork.util.OgnlValueStack.setValue(OgnlValueStack.java:99)
at com.opensymphony.xwork.interceptor.ParametersInterceptor.before(ParametersInter
ceptor.java:71)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:34)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
at com.opensymphony.webwork.views.jsp.ActionTag.executeAction(ActionTag.java:164)
at com.opensymphony.webwork.views.jsp.ActionTag.doEndTag(ActionTag.java:85)
at com.opensymphony.webwork.views.velocity.AbstractTagDirective.processTag(Abstrac
tTagDirective.java:338)
at com.opensymphony.webwork.views.velocity.AbstractTagDirective.render(AbstractTag
Directive.java:122)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:1
53)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.ja
va:128)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:271)
at org.apache.velocity.Template.merge(Template.java:296)
at com.opensymphony.webwork.views.velocity.WebWorkVelocityServlet.mergeTemplate(We
bWorkVelocityServlet.java:107)
at org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:387)
at org.apache.velocity.servlet.VelocityServlet.doPost(VelocityServlet.java:342)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletSt
ubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:38
7)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.RequestDispatcherImpl$ForwardAction.run(RequestDispat
cherImpl.java:385)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.j
ava:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
ava:286)
at com.opensymphony.webwork.dispatcher.ServletDispatcherResult.doExecute(ServletDi
spatcherResult.java:81)
at com.opensymphony.webwork.dispatcher.WebWorkResultSupport.execute(WebWorkResultS
upport.java:116)
at com.opensymphony.xwork.DefaultActionInvocation.executeResult(DefaultActionInvoc
ation.java:258)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:182)
at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(Default
WorkflowInterceptor.java:55)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIntercepto
r.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.j
ava:164)
at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDisp
atcher.java:229)
at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher
.java:199)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletSt
ubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:38
7)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:11
8)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebA
ppServletContext.java:6316)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.j
ava:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletConte
xt.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:25
69)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Name and version of the database you are using: Oracle 9.2.0.4
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|