4 Replies Latest reply on Sep 30, 2014 8:08 AM by Los Morales

    Quickstart RESTEasyBindingTest NPE

    Los Morales Newbie

      I'm trying out Switchyard for the first time.  I'm using SY 2.0.0Alpha2 and Wildfly 8.1.0 final and when trying to deploy the rest-binding quickstart I get a NPE (see exception below).  I'm fairly certain I set up SY on Wildfly appropriately and starting Wildfly doesn't give any errors.  I also modified the rest-binding pom to use wildfly-maven-plugin 1.0.2.Final instead of the jboss-as-maven-plugin, ran mvn package successfully but fails on mvn -Pdeploy install:

       

      Any ideas?

       

      -------------------------------------------------------------------------------

      Test set: org.switchyard.quickstarts.rest.binding.RESTEasyBindingTest

      -------------------------------------------------------------------------------

      Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 14.649 sec <<< FAILURE!

      orderServiceRESTEndpoint(org.switchyard.quickstarts.rest.binding.RESTEasyBindingTest)  Time elapsed: 0.023 sec  <<< ERROR!

      java.lang.Exception: org.switchyard.component.resteasy.RESTEasyPublishException: java.lang.NullPointerException

        at org.switchyard.test.SwitchYardRunner.createTest(SwitchYardRunner.java:64)

        at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)

        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

        at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)

        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

        at org.switchyard.test.SwitchYardRunner.run(SwitchYardRunner.java:85)

        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)

        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)

        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)

        at org.apache.maven.surefire.Surefire.run(Surefire.java:169)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:483)

        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)

        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)

      Caused by: org.switchyard.component.resteasy.RESTEasyPublishException: java.lang.NullPointerException

        at org.switchyard.component.resteasy.InboundHandler.doStart(InboundHandler.java:96)

        at org.switchyard.deploy.BaseServiceHandler.start(BaseServiceHandler.java:59)

        at org.switchyard.deploy.internal.Deployment.deployServiceBindings(Deployment.java:623)

        at org.switchyard.deploy.internal.Deployment.start(Deployment.java:145)

        at org.switchyard.test.SwitchYardTestKit.deploy(SwitchYardTestKit.java:757)

        at org.switchyard.test.SwitchYardTestKit.start(SwitchYardTestKit.java:177)

        at org.switchyard.test.SwitchYardRunner.createTest(SwitchYardRunner.java:60)

        ... 22 more

      Caused by: java.lang.NullPointerException

        at org.jboss.resteasy.plugins.server.sun.http.HttpContextBuilder.bind(HttpContextBuilder.java:89)

        at org.switchyard.component.resteasy.resource.StandaloneResourcePublisher.publish(StandaloneResourcePublisher.java:84)

        at org.switchyard.component.resteasy.InboundHandler.doStart(InboundHandler.java:92)

        • 1. Re: Quickstart RESTEasyBindingTest NPE
          Magesh Bojan Master

          That is very interesting. The deploy profile actually runs the test case before deploying. Can you tell us the Java, maven version and your environment? For time being you can skip the test with mvn -Pdeploy install -DskipTests=true

           

          You can then run the standalone client using mvn exec:java... as mentioned in the Readme.

          • 2. Re: Quickstart RESTEasyBindingTest NPE
            Los Morales Newbie

            I'm using Java 1.8.0_20, maven 3.2.3, windows 7, eclipse kepler SR2

             

            I just ran the skipTests=true and it seemed to work-- deployed onto Wildfly.  But when I ran mvn -Pdeploy install again (without skipTests) right after, I still get that RESTEasyBindingTest NPE.

             

             

            BTW, I forgot to mention I did use this:  mvn exec:java -Dexec.args="new"

             

             

            I get this error:

             

             

            2014-09-29 09:21:40,151 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-2) failed to execute: javax.ws.rs.NotFoundException: Unable to extract parameter from http request: javax.ws.rs.PathParam("itemId") value is 'count' for public abstract javax.ws.rs.core.Response org.switchyard.quickstarts.rest.binding.WarehouseResource.getItem(java.lang.Integer)

              at org.jboss.resteasy.core.PathParamInjector$1.throwProcessingException(PathParamInjector.java:54) [resteasy-jaxrs-3.0.8.Final.jar:]

              at org.jboss.resteasy.core.StringParameterInjector.extractValue(StringParameterInjector.java:336) [resteasy-jaxrs-3.0.8.Final.jar:]

              at org.jboss.resteasy.core.PathParamInjector.inject(PathParamInjector.java:131) [resteasy-jaxrs-3.0.8.Final.jar:]

              at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:89) [resteasy-jaxrs-3.0.8.Final.jar:]

            Caused by: java.lang.NumberFormatException: For input string: "count"

              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) [rt.jar:1.8.0_20]

              at java.lang.Integer.parseInt(Integer.java:580) [rt.jar:1.8.0_20]

              ... 35 more

             

             

             

             

            2014-09-29 09:21:40,274 ERROR [org.switchyard.component.resteasy.OutboundHandler] (default task-1) Unexpected exception composing inbound Message from Outbound: org.jboss.resteasy.client.ClientResponseFailure: Error status 404 Not Found returned

              at org.jboss.resteasy.client.core.BaseClientResponse.createResponseFailure(BaseClientResponse.java:559) [resteasy-jaxrs-3.0.8.Final.jar:]

              at org.jboss.resteasy.client.core.BaseClientResponse.createResponseFailure(BaseClientResponse.java:550) [resteasy-jaxrs-3.0.8.Final.jar:]

              at org.jboss.resteasy.client.core.BaseClientResponse.checkFailureStatus(BaseClientResponse.java:544) [resteasy-jaxrs-3.0.8.Final.jar:]

              at org.jboss.resteasy.client.core.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:37) [resteasy-jaxrs-3.0.8.Final.jar:]

             

             

            2014-09-29 09:21:40,361 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-1) failed to execute: javax.ws.rs.WebApplicationException: HTTP 500 Internal Server Error

              at org.switchyard.component.resteasy.composer.RESTEasyMessageComposer.decompose(RESTEasyMessageComposer.java:74) [switchyard-component-resteasy-2.0.0.Alpha2.jar:2.0.0.Alpha2]

              at org.switchyard.component.resteasy.composer.RESTEasyMessageComposer.decompose(RESTEasyMessageComposer.java:31) [switchyard-component-resteasy-2.0.0.Alpha2.jar:2.0.0.Alpha2]

              at org.switchyard.component.resteasy.InboundHandler.invoke(InboundHandler.java:135) [switchyard-component-resteasy-2.0.0.Alpha2.jar:2.0.0.Alpha2]

              at org.switchyard.component.resteasy.util.RESTEasyProxy.invoke(RESTEasyProxy.java:114) [switchyard-component-resteasy-2.0.0.Alpha2.jar:2.0.0.Alpha2]

              at com.sun.proxy.$Proxy71.isInventorySetup(Unknown Source)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_20]

              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_20]

            Caused by: java.lang.reflect.UndeclaredThrowableException

              at com.sun.proxy.$Proxy47.getItemCount(Unknown Source)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_20]

              ... 39 more

            Caused by: org.switchyard.HandlerException: Unexpected exception composing inbound Message from Outbound

              at org.switchyard.component.resteasy.OutboundHandler.handleMessage(OutboundHandler.java:152) [switchyard-component-resteasy-2.0.0.Alpha2.jar:2.0.0.Alpha2]

              at org.switchyard.handlers.ProviderHandler.handleMessage(ProviderHandler.java:77) [switchyard-runtime-2.0.0.Alpha2.jar:2.0.0.Alpha2]

              at org.switchyard.bus.camel.processors.HandlerProcessor.process(HandlerProcessor.java:61) [switchyard-bus-camel-2.0.0.Alpha2.jar:2.0.0.Alpha2]

              at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63) [camel-core-2.12.2.jar:2.12.2]

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) [camel-core-2.12.2.jar:2.12.2]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91) [camel-core-2.12.2.jar:2.12.2]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91) [camel-core-2.12.2.jar:2.12.2]

              ... 93 more

            Caused by: org.jboss.resteasy.client.ClientResponseFailure: Error status 404 Not Found returned

              at org.jboss.resteasy.client.core.BaseClientResponse.createResponseFailure(BaseClientResponse.java:559) [resteasy-jaxrs-3.0.8.Final.jar:]@

            • 3. Re: Quickstart RESTEasyBindingTest NPE
              Magesh Bojan Master

              You mention eclipse kepler, are you running the commands in that IDE? My hunch is that there is a port conflict and the service bindings has not been started, in both your traces. Please use a tool, like TCPView, to find out if that port is being used by some other process already.

              • 4. Re: Quickstart RESTEasyBindingTest NPE
                Los Morales Newbie

                No, I use mvn command line from a prompt.

                 

                Anyway what I found out is that when running Wildfly within Kepler and having Kepler publish the rest binding onto the server, the Rest component doesn't seem to run.  Always get a 404 error.  When I externally run mvn from command line to create the jar and then I manually copy that jar into the \deployment of Wildfly, it works.   I also had to revert back to Java 7 (update 67) to make this work.  Java 8 seems to fail on Wildfly from time to time complaining about not finding JBoss logging or other random issues.