persistence@glassfish.java.net

Newbie trouble: java.lang.IllegalArgumentException: NamedQuery of name: findAllQuery not found.

From: Stephan Henningsen <stephan_at_asklandd.dk>
Date: Thu, 20 Mar 2008 11:49:30 +0100

Hello there,

I'm new to JEE and am therefore trying to make a little test application
that does a little of everything, currently a Servlet, a JMS Queue, and
and an Entity bean. Also, I'm trying to structure the few JARs and WARs
I have, like I would with a large application EAR.

But the entity bean is causing me trouble. I can build and deploy, but
when I request my servlet to do its magic I get this:

(Also available here for about a month: http://pastebin.com/m4ff4e3bb)

[#|2008-03-20T11:23:12.477+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=14;_ThreadName=httpWorkerThread-8080-0;LovelyEntityDBAOBean;|EJB5018:
An exception was thrown during an ejb invocation on
[LovelyEntityDBAOBean]|#]

[#|2008-03-20T11:23:12.478+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=14;_ThreadName=httpWorkerThread-8080-0;|
javax.ejb.EJBException
         at
com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3730)
         at
com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3630)
         at
com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
         at
com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
         at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
         at
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:71)
         at $Proxy54.findAll(Unknown Source)
         at jeesandbox.lovely.web.LovelyServlet.doGet(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
         at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
         at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
         at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         at
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         at
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         at
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: java.lang.IllegalArgumentException: NamedQuery of name:
findAllQuery not found.
         at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:392)
         at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.setAsSQLReadQuery(EJBQueryImpl.java:121)
         at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:433)
         at
jeesandbox.lovely.entities.LovelyEntityDBAOBean.findAll(Unknown Source)
         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:585)
         at
com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
         at
com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
         at
com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
         at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
         at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:184)
         ... 29 more
|#]

[#|2008-03-20T11:23:12.484+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=14;_ThreadName=httpWorkerThread-8080-0;_RequestID=53e38904-87e0-4518-b7fa-0c3f994febbb;|StandardWrapperValve[LovelyServlet]:
Servlet.service() for servlet LovelyServlet threw exception
javax.ejb.EJBException
         at
com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3730)
         at
com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3630)
         at
com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
         at
com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
         at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
         at
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:71)
         at $Proxy54.findAll(Unknown Source)
         at jeesandbox.lovely.web.LovelyServlet.doGet(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
         at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
         at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
         at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
         at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         at
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         at
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         at
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         at
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: java.lang.IllegalArgumentException: NamedQuery of name:
findAllQuery not found.
         at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:392)
         at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.setAsSQLReadQuery(EJBQueryImpl.java:121)
         at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:433)
         at
jeesandbox.lovely.entities.LovelyEntityDBAOBean.findAll(Unknown Source)
         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:585)
         at
com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
         at
com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
         at
com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
         at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
         at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:184)
         ... 29 more
|#]



The project is available here in various forms here:
   http://asklandd.dk/tmp/jee/lovely.ear
   http://asklandd.dk/tmp/jee/lovely-sourcecode/
   http://asklandd.dk/tmp/jee/lovely-sourcecode.tar.bz2

It should be enough to just edit the two lines in system.properties and
run: ant create-resource deploy vs. ant undeploy delete-resources

The servlet is accepting requests at: http://localhost:8080/lovely-web/

(Btw, how do I change that to be e.g. "lovely" instead of the name of my
WAR, "lovely-web"?)


-- 
Thanks in advance,
Stephan