7 Replies Latest reply on Jan 21, 2012 7:55 PM by Michael McGovern

    Using Stateless beans with JAX-RS in AS7

    Michael McGovern Newbie

      Hi,

       

      Porting an app from AS6 that includes a war containing rest services as stateless bean (rest.war) inside an ear (Capital.ear).

       

      Worked under AS6 but AS7 complains with the following when the service receives a request:

       

      22:28:00,299 WARN  [org.jboss.resteasy.core.SynchronousDispatcher] (http--127.0.0.1-80-2) Unknown exception while executing POST user/logon: java.lang.RuntimeException: javax.naming.NameNotFoundException: Name 'UserLogonRestBean!com.vantage.capital.service.rest.user.UserLogonRestBean' not found in context 'rest'

      at org.jboss.resteasy.plugins.server.resourcefactory.JndiComponentResourceFactory.createResource(JndiComponentResourceFactory.java:57) [resteasy-jaxrs-2.2.1.GA.jar:]

      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:208) [resteasy-jaxrs-2.2.1.GA.jar:]

      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519) [resteasy-jaxrs-2.2.1.GA.jar:]

      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) [resteasy-jaxrs-2.2.1.GA.jar:]

      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.2.1.GA.jar:]

      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.2.1.GA.jar:]

      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.2.1.GA.jar:]

      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.2.1.GA.jar:]

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final]

      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.0.Final.jar:7.0.0.Final]

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]

      at java.lang.Thread.run(Thread.java:619) [:1.6.0_21]

      Caused by: javax.naming.NameNotFoundException: Name 'UserLogonRestBean!com.vantage.capital.service.rest.user.UserLogonRestBean' not found in context 'rest'

      at org.jboss.as.naming.util.NamingUtils.nameNotFoundException(NamingUtils.java:109)

      at org.jboss.as.naming.InMemoryNamingStore$NodeTraversingVisitor.visit(InMemoryNamingStore.java:368)

      at org.jboss.as.naming.InMemoryNamingStore$ContextNode.accept(InMemoryNamingStore.java:307)

      at org.jboss.as.naming.InMemoryNamingStore$NodeTraversingVisitor.visit(InMemoryNamingStore.java:371)

      at org.jboss.as.naming.InMemoryNamingStore$ContextNode.accept(InMemoryNamingStore.java:307)

      at org.jboss.as.naming.InMemoryNamingStore.lookup(InMemoryNamingStore.java:162)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:176)

      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)

      at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_21]

      at org.jboss.resteasy.plugins.server.resourcefactory.JndiComponentResourceFactory.createResource(JndiComponentResourceFactory.java:53) [resteasy-jaxrs-2.2.1.GA.jar:]

      ... 22 more

       

       

      The only change I have made so far for the port for JAX-RS is the addition of a servlet mapping in web.xml.

       

      Is there something else I need to do to make SLSB available in the rest WAR? The bean it can't find is the right one for the request coming in so it seems strange.

       

       

       

      Thanks

       

      Michael