5 Replies Latest reply on Dec 5, 2008 11:58 AM by Mike Murray

    EJB 3.0, JBoss 4.2, JPA, JNDI, and Web Services

    Mike Murray Newbie

      I'm having trouble getting a very simple web service to work. My WSDL is generated correctly, but when I try to invoke one of my web methods with a SOAP request, I get this response back:

      <faultcode>env:Server</faultcode>
      <faultstring>Endpoint cannot handle requests in state: UNDEFINED</faultstring>



      I am fairly certain that this code is very closely related to the problem:
      @PersistenceContext(unitName = "bship")
      private EntityManager manager;


      Because when I comment that code out, all of the sudden my service will send back valid responses. So I'm assuming that means my problem has something to do with JNDI or JPA.

      Here is the entity i'm trying to persist in the web method:
      http://devk.it/ec0DhwS7NB

      Here is my persistence.xml:
      http://devk.it/37vCj4EReq

      Here is my ds.xml (which is in my /deploy/ folder):
      http://devk.it/f13G5pC7xq

      Here is the Service Bean:
      http://devk.it/6b0451wccr

      And here is my Remote interface:
      http://devk.it/14etOF2X0O

      When I debug my EJB project, an exception similar to the invalid response comes up:

      ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
      javax.xml.rpc.soap.SOAPFaultException: Endpoint cannot handle requests in state: UNDEFINED
       at org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC.exceptionToFaultMessage(SOAPFaultHelperJAXRPC.java:189)
       at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:170)
       at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
       at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:671)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:488)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
       at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Unknown Source)



      I've been researching away trying to get my EJB setup working, but things are moving very slow because of this problem. All help is very appreciated!

      Thank you,
      Mike Murray

        • 1. Re: EJB 3.0, JBoss 4.2, JPA, JNDI, and Web Services
          jaikiran pai Master

          Mike,

          Can you please post the console logs when your application is being deployed?

          • 2. Re: EJB 3.0, JBoss 4.2, JPA, JNDI, and Web Services
            Mike Murray Newbie

            Hey Jaikiran,
            Thanks for the quick reply. I sifted through my console and grabbed the part that looks like it's effecting my problem. If you need to see the entire log let me know.

            08:31:44,473 INFO [EJB3Deployer] Deployed: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/Battleship.jar
            08:31:44,501 INFO [DefaultEndpointRegistry] register: jboss.ws:context=battleship,endpoint=ServiceBean
            08:31:44,712 INFO [TomcatDeployer] deploy, ctxPath=/battleship, warUrl=.../tmp/deploy/Battleship.jar197.war/
            08:31:46,207 INFO [WSDLFilePublisher] WSDL published to: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/data/wsdl/Battleship.jar/ServiceBeanService198.wsdl
            08:31:46,210 ERROR [MainDeployer] Could not start deployment: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/Battleship.jar
            javax.xml.ws.WebServiceException: Cannot find service endpoint target: jboss.j2ee:name=ServiceBean,service=EJB3,jar=Battleship.jar
             at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.init(InvocationHandlerEJB3.java:83)
             at org.jboss.wsf.framework.deployment.DefaultLifecycleHandler.create(DefaultLifecycleHandler.java:51)
             at org.jboss.wsf.framework.deployment.EndpointLifecycleDeploymentAspect.create(EndpointLifecycleDeploymentAspect.java:42)
             at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:118)
             at org.jboss.wsf.container.jboss42.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:97)
             at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:90)
             at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
             at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy34.start(Unknown Source)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
             at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy9.deploy(Unknown Source)
             at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
             at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
             at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
             at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
             at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
             at $Proxy0.start(Unknown Source)
             at org.jboss.system.ServiceController.start(ServiceController.java:417)
             at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy4.start(Unknown Source)
             at org.jboss.deployment.SARDeployer.start(SARDeployer.java:304)
             at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
             at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
             at java.lang.reflect.Method.invoke(Unknown Source)
             at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
             at $Proxy5.deploy(Unknown Source)
             at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
             at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
             at org.jboss.Main.boot(Main.java:200)
             at org.jboss.Main$1.run(Main.java:508)
             at java.lang.Thread.run(Unknown Source)
            08:31:46,245 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
            08:31:46,245 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=math.jar,name=MathBean,service=EJB3 with dependencies:
            08:31:46,282 INFO [EJBContainer] STARTED EJB: lab9.MathBean ejbName: MathBean
            08:31:46,331 INFO [EJB3Deployer] Deployed: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/math.jar
            08:31:46,334 INFO [DefaultEndpointRegistry] register: jboss.ws:context=lab9,endpoint=MathBean
            08:31:46,390 INFO [TomcatDeployer] deploy, ctxPath=/lab9, warUrl=.../tmp/deploy/math.jar201.war/
            08:31:46,621 INFO [WSDLFilePublisher] WSDL published to: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/data/wsdl/math.jar/MathBeanService202.wsdl
            08:31:46,690 INFO [TomcatDeployer] deploy, ctxPath=/Lab9_MathService, warUrl=.../tmp/deploy/tmp204Lab9_MathService-exp.war/
            08:31:46,900 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
            08:31:47,089 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
            
            --- Packages waiting for a deployer ---
            org.jboss.deployment.DeploymentInfo@b7a24d35 { url=file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/ds.xml }
             deployer: null
             status: null
             state: INIT_WAITING_DEPLOYER
             watch: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/ds.xml
             altDD: null
             lastDeployed: 1228491107088
             lastModified: 1228491107088
             mbeans:
            
            --- Incompletely deployed packages ---
            org.jboss.deployment.DeploymentInfo@25d893e { url=file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/Battleship.jar }
             deployer: MBeanProxyExt[jboss.ejb3:service=EJB3Deployer]
             status: Deployment FAILED reason: Cannot find service endpoint target: jboss.j2ee:name=ServiceBean,service=EJB3,jar=Battleship.jar
             state: FAILED
             watch: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/Battleship.jar
             altDD: null
             lastDeployed: 1228491103920
             lastModified: 1228491103917
             mbeans:
             persistence.units:jar=Battleship.jar,unitName=bship state: Registered
             jboss.j2ee:jar=Battleship.jar,name=ServiceBean,service=EJB3 state: Registered
            
            org.jboss.deployment.DeploymentInfo@b7a24d35 { url=file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/ds.xml }
             deployer: null
             status: null
             state: INIT_WAITING_DEPLOYER
             watch: file:/C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/ds.xml
             altDD: null
             lastDeployed: 1228491107088
             lastModified: 1228491107088
             mbeans:
            
            --- MBeans waiting for other MBeans ---
            ObjectName: persistence.units:jar=Battleship.jar,unitName=bship
             State: NOTYETINSTALLED
             I Depend On:
             jboss.jca:name=bshipDs,service=DataSourceBinding
             Depends On Me:
             jboss.j2ee:jar=Battleship.jar,name=ServiceBean,service=EJB3
            
            ObjectName: jboss.j2ee:jar=Battleship.jar,name=ServiceBean,service=EJB3
             State: NOTYETINSTALLED
             I Depend On:
             persistence.units:jar=Battleship.jar,unitName=bship
            
            --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
            ObjectName: jboss.jca:name=bshipDs,service=DataSourceBinding
             State: NOTYETINSTALLED
             Depends On Me:
             persistence.units:jar=Battleship.jar,unitName=bship
            
            
            08:31:47,246 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
            08:31:47,261 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
            08:31:47,269 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)] Started in 30s:415ms
            



            So it says:
            Cannot find service endpoint target: jboss.j2ee:name=ServiceBean,service=EJB3,jar=Battleship.jar

            Does that mean its not deploying my EJB at all? I was pretty sure that the EJB was being deployed correctly. Like I said before, when I comment out the entity manager the add web method works perfectly.

            I'm pretty confused while it's getting that exception in the first place. As you can see in my Bean (http://devk.it/6b0451wccr), I've annotated endpointInterface="org.battleship.ejb.ServiceRemote", which is the correct class name of my Remote interface.

            • 3. Re: EJB 3.0, JBoss 4.2, JPA, JNDI, and Web Services
              Mike Murray Newbie

              It looks like everything may be because of this guy:

              --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
              ObjectName: jboss.jca:name=bshipDs,service=DataSourceBinding
              State: NOTYETINSTALLED
              Depends On Me:
              persistence.units:jar=Battleship.jar,unitName=bship


              And I noticed that my DS is listed under "packages waiting for a deployer" with a state of INIT_WAITING_DEPLOYER. Did I deploy my DataSource incorrectly?

              All I did was put ds.xml in /deploy/ and add the mysql jdbc drivers to /lib/, are there more steps that I'm missing?

              • 4. Re: EJB 3.0, JBoss 4.2, JPA, JNDI, and Web Services
                jaikiran pai Master

                 

                C:/Users/MMURRAY/Applications/jboss-4.2.3.GA/server/default/deploy/ds.xml


                Rename your ds.xml to *-ds.xml. Example: my-ds.xml.

                The datasource filenames are expected to end with the -ds.xml name.

                • 5. Re: EJB 3.0, JBoss 4.2, JPA, JNDI, and Web Services
                  Mike Murray Newbie

                  Thank you jaikaran! That completely fixed it!

                  I must have mis-read that part of the process.