有关CMP的问题, 若返回的是Collection 应如何处理!!!

03-12-17 bluedolphine

我用CMP做了一个有关数据查询的程序,在FinderAll的方法里设定返回的值是Collection类型,在weblogic上部署后,在client程序里调用是,报如下的错:

java.rmi.RemoteException: SOAP Fault:javax.xml.rpc.soap.SOAPFaultException: Exception during processing: javax.ejb.EJBException: nested exception is: javax.naming.NameNotFoundException: While trying to look up comp/env/Students in /app/ejb/j2ee.jar#StudentSession.; remaining name 'comp/env/Students' (see Fault Detail for stacktrace)

Detail:

<detail>

<bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">

</bea_fault:stacktrace>javax.ejb.EJBException: nested exception is: javax.naming.NameNotFoundException: While trying to look up comp/env/Students in /app/ejb/j2ee.jar#StudentSession.; remaining name 'comp/env/Students'

javax.naming.NameNotFoundException: While trying to look up comp/env/Students in /app/ejb/j2ee.jar#StudentSession.; remaining name 'comp/env/Students'

at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)

at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)

at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)

at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)

at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)

at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:124)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at cquerytest.session.StudentSessionBean.setSessionContext(StudentSessionBean.java:28)

at cquerytest.session.StudentSession_z115dm_Impl.setSessionContext(StudentSession_z115dm_Impl.java:111)

at weblogic.ejb20.manager.StatelessManager.createBean(StatelessManager.java:268)

at weblogic.ejb20.pool.StatelessSessionPool.createBean(StatelessSessionPool.java:168)

at weblogic.ejb20.pool.StatelessSessionPool.getBean(StatelessSessionPool.java:110)

at weblogic.ejb20.manager.StatelessManager.preInvoke(StatelessManager.java:140)

at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:130)

at weblogic.ejb20.internal.StatelessEJBObject.preInvoke(StatelessEJBObject.java:70)

at cquerytest.session.StudentSession_z115dm_EOImpl.getByStuid(StudentSession_z115dm_EOImpl.java:29)

at cquerytest.session.StudentSession_z115dm_EOImpl_CBV.getByStuid(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:324)

at weblogic.webservice.component.slsb.SLSBInvocationHandler.invoke(SLSBInvocationHandler.java:88)

at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:85)

at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)

at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)

at weblogic.webservice.server.Dispatcher.process(Dispatcher.java:192)

at weblogic.webservice.server.Dispatcher.doDispatch(Dispatcher.java:164)

at weblogic.webservice.server.Dispatcher.dispatch(Dispatcher.java:94)

at weblogic.webservice.server.WebServiceManager.dispatch(WebServiceManager.java:98)

at weblogic.webservice.server.servlet.WebServiceServlet.serverSideInvoke(WebServiceServlet.java:274)

at weblogic.webservice.server.servlet.ServletBase.doPost(ServletBase.java:425)

at weblogic.webservice.server.servlet.WebServiceServlet.doPost(WebServiceServlet.java:244)

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(ServletStubImpl.java:1053)

at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)

at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)

at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)

at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)

at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)

at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)

at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)

at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)

at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

javax.ejb.EJBException: nested exception is: javax.naming.NameNotFoundException: While trying to look up comp/env/Students in /app/ejb/j2ee.jar#StudentSession.; remaining name 'comp/env/Students'

at cquerytest.session.StudentSessionBean.setSessionContext(StudentSessionBean.java:32)

at cquerytest.session.StudentSession_z115dm_Impl.setSessionContext(StudentSession_z115dm_Impl.java:111)

at weblogic.ejb20.manager.StatelessManager.createBean(StatelessManager.java:268)

at weblogic.ejb20.pool.StatelessSessionPool.createBean(StatelessSessionPool.java:168)

at weblogic.ejb20.pool.StatelessSessionPool.getBean(StatelessSessionPool.java:110)

at weblogic.ejb20.manager.StatelessManager.preInvoke(StatelessManager.java:140)

at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:130)

at weblogic.ejb20.internal.StatelessEJBObject.preInvoke(StatelessEJBObject.java:70)

at cquerytest.session.StudentSession_z115dm_EOImpl.getByStuid(StudentSession_z115dm_EOImpl.java:29)

at cquerytest.session.StudentSession_z115dm_EOImpl_CBV.getByStuid(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:324)

at weblogic.webservice.component.slsb.SLSBInvocationHandler.invoke(SLSBInvocationHandler.java:88)

at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:85)

at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:143)

at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:518)

at weblogic.webservice.server.Dispatcher.process(Dispatcher.java:192)

at weblogic.webservice.server.Dispatcher.doDispatch(Dispatcher.java:164)

at weblogic.webservice.server.Dispatcher.dispatch(Dispatcher.java:94)

at weblogic.webservice.server.WebServiceManager.dispatch(WebServiceManager.java:98)

at weblogic.webservice.server.servlet.WebServiceServlet.serverSideInvoke(WebServiceServlet.java:274)

at weblogic.webservice.server.servlet.ServletBase.doPost(ServletBase.java:425)

at weblogic.webservice.server.servlet.WebServiceServlet.doPost(WebServiceServlet.java:244)

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(ServletStubImpl.java:1053)

at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)

at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)

at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)

at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)

at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)

at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)

at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)

at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)

at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

</detail>; nested exception is:

javax.xml.rpc.soap.SOAPFaultException: Exception during processing: javax.ejb.EJBException: nested exception is: javax.naming.NameNotFoundException: While trying to look up comp/env/Students in /app/ejb/j2ee.jar#StudentSession.; remaining name 'comp/env/Students' (see Fault Detail for stacktrace)

at cquerytest.generated.StudentSessionPort_Stub.getByStuid(StudentSessionPort_Stub.java:49)

at cquerytest.client.test.main(test.java:13)

Caused by: javax.xml.rpc.soap.SOAPFaultException: Exception during processing: javax.ejb.EJBException: nested exception is: javax.naming.NameNotFoundException: While trying to look up comp/env/Students in /app/ejb/j2ee.jar#StudentSession.; remaining name 'comp/env/Students' (see Fault Detail for stacktrace)

at weblogic.webservice.core.ClientDispatcher.receive(ClientDispatcher.java:285)

at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:144)

at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:444)

at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:430)

at weblogic.webservice.core.rpc.StubImpl._invoke(StubImpl.java:270)

at cquerytest.generated.StudentSessionPort_Stub.getByStuid(StudentSessionPort_Stub.java:44)

... 1 more

但是用FindByprimarykey,又可以调出数据。

WHY???

banq
2003-12-18 15:56

是JNDI问题:

javax.naming.NameNotFoundException