4 Replies Latest reply on Jan 28, 2014 6:10 PM by Roger Lee

    Web Service in WildFly

    Roger Lee Apprentice

      I trying to move an application from JBoss AS 7.1 which had a test WebService which ran fine.

       

      I have SLSB annotated:-

       

      @Stateless

      @Path("/viViFYdService")

       

      @GET

          @Produces("text/html")

          public String getXml() throws UnknownHostException {

              return "<html><body><h2>" + playListBean.getViVIFYdPlayList() + "!</h2></body></html>";

          }

       

      When I run it in the browser with  JBoss AS 7.1:-

       

      http://localhost:8080/ViViFYd/resources/viViFYdService

       

      I can get:-

      ViViFYdResource getViViFYdPlayList @ NOTiFY-PC/123.123.1.12: 2014/01/28 20:48:39!

       

      When I deploy it on WildFly 8.0.0.CR1 I get:-

       

      20:52:57,833 WARN  [org.jboss.seam.util.Resources] (default task-1) Unable to determine real path from servlet context for "/WEB-INF/dev" pa

      th does not exist.

      20:52:58,040 ERROR [org.jboss.as.ejb3.invocation] (default task-1) JBAS014134: EJB Invocation failed on component ViViFYdResource for method

      public java.lang.String com.vivifyd.ejb.ViViFYdResource.getXml() throws java.net.UnknownHostException: javax.ejb.EJBException: java.lang.Nu

      llPointerException

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:190) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:340) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextIntercepto

      r.java:41) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.

      0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.0.0.C

      R1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wild

      fly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.0.0.CR1

      .jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfl

      y-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:325)

              at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:437)

              at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:325)

              at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)

              at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)

              at com.vivifyd.ejb.ViViFYdResource$$$view8.getXml(Unknown Source) [ViViFYdJAR.jar:]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_40]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_40]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_40]

              at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_40]

              at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137) [resteasy-jaxrs-3.0.6.Final.jar:]

              at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:280) [resteasy-jaxrs-3.0.6.Final.jar:]

              at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:234) [resteasy-jaxrs-3.0.6.Final.jar:]

              at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:221) [resteasy-jaxrs-3.0.6.Final.jar:]

              at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [resteasy-jaxrs-3.0.6.Final.jar:]

              at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.6.Final.jar:]

              at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs

      -3.0.6.Final.jar:]

              at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.6.Fina

      l.jar:]

              at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.6.Fina

      l.jar:]

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

              at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:87)

              at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:2.3.1.Final]

              at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)

              at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)

              at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)

              at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)

              at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

              at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70

      )

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

              at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)

              at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)

              at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)

              at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)

              at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandl

      er.java:61)

              at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)

              at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67)

              at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70)

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

              at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)

              at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)

              at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)

              at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)

              at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)

              at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164)

              at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]

              at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]

      Caused by: java.lang.NullPointerException

              at com.vivifyd.ejb.ViViFYdResource.getXml(ViViFYdResource.java:35) [ViViFYdJAR.jar:]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_40]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_40]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_40]

              at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_40]

              at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

              at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)

              at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82) [wildfly-weld-8.0.0.CR1.j

      ar:8.0.0.CR1]

              at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93) [wildfly-weld-8.0.0.CR1.jar:

      8.0.0.CR1]

              at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)

              at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:101) [jboss-seam.jar:2.3.1.Final]

              at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:51) [jboss-seam.jar:2.3.1.Final]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_40]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_40]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_40]

              at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_40]

              at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor

      .java:89)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

              at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [wildf

      ly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) [wildfly-jpa-8.0.0.CR1.ja

      r:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)

              at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46

      ) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]

              at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84) [wildf

      ly-weld-8.0.0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.0.0

      .CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [wildfly-ejb3-8.0

      .0.CR1.jar:8.0.0.CR1]

              at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

              at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273) [wildfly-ejb3-8.0.0.CR1.jar:8.0.0.CR1]

              ... 91 more

        • 1. Re: Web Service in WildFly
          Frank Langelage Master

          Caused by: java.lang.NullPointerException

                  at com.vivifyd.ejb.ViViFYdResource.getXml(ViViFYdResource.java:35) [ViViFYdJAR.jar:]

          So the cause of the NPE is in your source.

          Which line is line 35? The return shown above?

          If yes, what's "playListBean", is it instantiated / injected?

          The complete class or at least something to reproduce the problem would be very helpful.

          • 2. Re: Web Service in WildFly
            Roger Lee Apprentice

            Frank,

             

            Thanks for your reply. Yes you're right. When I took out the call to the playListBean and just returned static text  it works.

             

            However it was injected in fine in JBoss AS 7.1 what's changed in WildFly?

             

            To inject I used:-

             

            @EJB

            private static PlayListBean playListBean;

             

            PlayList:-

             

            @Singleton

            public class PlayListBean {

             

                private String playList = "ViViFYdResource getViViFYdPlayList @ ";

                private InetAddress inetAddress;

               

                DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");

               

                public String getViVIFYdPlayList() throws UnknownHostException {

                Calendar calendar = Calendar.getInstance();

              

                System.out.println(dateFormat.format(calendar.getTime()));

                inetAddress = InetAddress.getLocalHost();

              

                    return playList + inetAddress + ": " + dateFormat.format(calendar.getTime());

                }

             

             

                public void setViViFYdPlayList(String playList) {

                    this.playList = playList;

                }

            }

            • 3. Re: Web Service in WildFly
              Frank Langelage Master

              I'm not aware of an change that could cause this problem.

              What looks ab bit strange to me is the "static" keyword of the injected PlayListBean. Don't know if this is legal.

              As PlayListBean is a Singleton you anyways always get the same instance injected.

              Try without static. Should work with 7.1 and 8.0.

              • 4. Re: Web Service in WildFly
                Roger Lee Apprentice

                Frank,

                It was the static on the injected EJB, removed it and it works fine.

                 

                Many thanks.