Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes finder method of CMP thows NULLPOINTER EXCEPTION Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "finder method of CMP thows NULLPOINTER EXCEPTION" Watch "finder method of CMP thows NULLPOINTER EXCEPTION" New topic
Author

finder method of CMP thows NULLPOINTER EXCEPTION

lalit mohan
Greenhorn

Joined: Apr 08, 2004
Posts: 16
hello,

i have declared a public Collection findByName(String name) throws FinderException, RemoteException method in the cmp.

but it throws the following error on the client side. its create method working properly.

public product1Remote create(String productID, String name,
String description, Double baseValue) throws
CreateException, RemoteException;


i have correctily map the field with table.

javax.ejb.FinderException: Find failed: com.borland.datastore.jdbc.SqlState: Runtime Error: java.lang.NullPointerException

at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:194)

at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:91)

at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntitiesCommand.execute(JDBCFindEntitiesCommand.java:40)

at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntities(JDBCStoreManager.java:599)

at org.jboss.ejb.plugins.CMPPersistenceManager.findEntities(CMPPersistenceManager.java:324)

at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntities(CachedConnectionInterceptor.java:323)

at org.jboss.ejb.EntityContainer.find(EntityContainer.java:660)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:998)

at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)

at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:188)

at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)

at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)

at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:91)

at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)

at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)

at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)

at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)

at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74)

at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)

at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)

at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:477)

at org.jboss.ejb.Container.invoke(Container.java:694)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)

at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)

at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)

at sun.rmi.transport.Transport$1.run(Transport.java:148)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:144)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)

at java.lang.Thread.run(Thread.java:534)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)

at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)

at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)

at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)

at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)

at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:87)

at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)

at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)

at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)

at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)

at $Proxy0.findByName(Unknown Source)

at firstentityproject.ProductTestClient1.main(ProductTestClient1.java:23)


please response.


thanks
Yogananth
Greenhorn

Joined: Jan 11, 2005
Posts: 6
Please verify whether you have configured <query> in ejb-jar.xml
You should be configuring something like the following:
<query>
<query-method>
<method-name>findByName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[select object(a) from BeanName as a where a.field = ?1]]>
</ejb-ql>
</query>


------------------------<br />Regards,<br />Yogananth<br />SCJP 1.4, SCWCD 1.4<br />------------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: finder method of CMP thows NULLPOINTER EXCEPTION
 
Similar Threads
CMP Exception Handling
Accessing EJB-application
Session Beans in Jboss
Entity Beans (CMP) with PostGis
Problems redeploying EAR file with Third Party libs