9 Replies Latest reply on Oct 21, 2015 7:10 AM by delivren

    RESTEasyPublishException

    anikulin

      Hello

       

      In my project I have a switchyard bean with a reference to another bean, and when I'm trying to add RESTEasy binding to this reference at deployment I have such exception:

       

      23:44:52,614 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."metaKonnector.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."metaKonnector.jar".SwitchYardService: org.switchyard.component.resteasy.RESTEasyPublishException: java.lang.NullPointerException
                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:79)
                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]
                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]
      Caused by: org.switchyard.component.resteasy.RESTEasyPublishException: java.lang.NullPointerException
                at org.switchyard.component.resteasy.InboundHandler.start(InboundHandler.java:84)
                at org.switchyard.deploy.internal.Deployment.deployServiceBindings(Deployment.java:513)
                at org.switchyard.deploy.internal.Deployment.start(Deployment.java:141)
                at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:106)
                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:72)
                ... 5 more
      Caused by: java.lang.NullPointerException
                at org.switchyard.as7.extension.resteasy.RESTEasyResourcePublisher.publish(RESTEasyResourcePublisher.java:97)
                at org.switchyard.component.resteasy.InboundHandler.start(InboundHandler.java:80)
                ... 9 more
      
      


      My switchyard.xml is:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:resteasy="urn:switchyard-component-resteasy:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard-component-soap:config:1.0" xmlns:transform="urn:switchyard-config:transform:1.0" name="metaConnector" targetNamespace="urn:com.magick:metaConnector:0.0.1-SNAPSHOT">
        <sca:composite name="metaConnector" targetNamespace="urn:com.magick:metaConnector:0.0.1-SNAPSHOT">
          <sca:service name="StrategyServicePortType" promote="StrategyService/StrategyService">
            <sca:interface.wsdl interface="StrategyService.wsdl#wsdl.porttype(StrategyServicePortType)"/>
            <soap:binding.soap>
              <soap:contextMapper/>
              <soap:wsdl>StrategyService.wsdl</soap:wsdl>
              <soap:socketAddr>:8080</soap:socketAddr>
              <soap:contextPath>metaConnector</soap:contextPath>
            </soap:binding.soap>
          </sca:service>
          <sca:service name="IndicatorServiceREST" promote="IndicatorService/IndicatorService">
            <sca:interface.java interface="com.magick.metaConnector.service.IndicatorService"/>
            <resteasy:binding.rest>
              <resteasy:contextMapper/>
              <resteasy:interfaces>com.magick.metaConnector.service.IndicatorServiceResourse</resteasy:interfaces>
              <resteasy:contextPath>metaConnector</resteasy:contextPath>
            </resteasy:binding.rest>
          </sca:service>
        </sca:composite>
      </switchyard>
      
      

       

      SwitchYard scheme in Eclipse looks like this:

      1.jpg

      And after adding RESTBinding component I also have such error in Eclipse:

       

      cvc-complex-type.2.4.a: Invalid content was found starting with element 'resteasy:binding.rest'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200912":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200912":callback, "http://docs.oasis-open.org/ns/opencsa/sca/200912":requires, "http://docs.oasis-open.org/ns/opencsa/sca/200912":policySetAttachment, "http://docs.oasis-open.org/ns/opencsa/sca/200912":extensions}' is expected.

       

      Can you help me please to solve these issues?

       

      Thanks

        • 1. Re: RESTEasyPublishException
          mageshbk

          Have you enabled RESTEasy component inside the AS7 configuration? If you use standalone.xml then it should have subsystem defined like this

           <subsystem xmlns="urn:jboss:domain:switchyard:1.0">
              <modules>
                  <module identifier="org.switchyard.component.bean" implClass="org.switchyard.component.bean.deploy.BeanComponent"/>
                  <module identifier="org.switchyard.component.soap" implClass="org.switchyard.component.soap.deploy.SOAPComponent"/>
                  <module identifier="org.switchyard.component.camel" implClass="org.switchyard.component.camel.deploy.CamelComponent"/>
                  <module identifier="org.switchyard.component.rules" implClass="org.switchyard.component.rules.deploy.RulesComponent"/>
                  <module identifier="org.switchyard.component.bpm" implClass="org.switchyard.component.bpm.deploy.BPMComponent"/>
                  <module identifier="org.switchyard.component.bpel" implClass="org.switchyard.component.bpel.deploy.BPELComponent"/>
                  <module identifier="org.switchyard.component.hornetq" implClass="org.switchyard.component.hornetq.deploy.HornetQComponent"/>
                  <module identifier="org.switchyard.component.http" implClass="org.switchyard.component.http.deploy.HttpComponent"/>
                  <module identifier="org.switchyard.component.jca" implClass="org.switchyard.component.jca.deploy.JCAComponent"/>
                  <module identifier="org.switchyard.component.remote" implClass="org.switchyard.component.remote.deploy.RemoteComponent">
                      <properties>
                          <cache-name>
                              cluster
                          </cache-name>
                      </properties>
                  </module>
                  <module identifier="org.switchyard.component.resteasy" implClass="org.switchyard.component.resteasy.deploy.RESTEasyComponent"/>
              </modules>
          </subsystem>
          
          
          • 2. Re: RESTEasyPublishException
            mageshbk

            Also ensure that the jaxrs susbsytem is also enabled

             <extension module="org.jboss.as.jaxrs"/>
            
            • 3. Re: RESTEasyPublishException
              anikulin

              Yes, I have such configuration, and on another project RESTBinding works, but here it doesn't.

              • 4. Re: RESTEasyPublishException
                mageshbk

                Could you tell us the version of AS7 in this environment? Is there any upgrade done to the RESTEasy subsystem? Could you attach the logs? When you say another project, is it just another deployment in the same server or a complete server+application combination?

                • 5. Re: RESTEasyPublishException
                  anikulin

                  I use SwitchYard 6.0 Final and  RESTEasy jar in module is also 6.0-Final version.
                  Yes, I mean just another project deployed on the same server with the same configuration.

                  • 6. Re: RESTEasyPublishException
                    mageshbk

                    Looks like you are trying to bind a WebService as well as the RESTEasy service onto the same context path: metaConnector

                    http://localhost:8080/metaConnector/StrategyService
                    

                     

                    I have created a JIRA to fix the NPE and throw an appropriate message. Please use a different context path for the REST endpoints

                     

                    https://issues.jboss.org/browse/SWITCHYARD-1206.

                    • 7. Re: RESTEasyPublishException
                      anikulin

                      Yes, that's working with another context path. Thanks a lot.

                      • 8. Re: RESTEasyPublishException
                        mageshbk

                        Hi Anton,

                         

                        You are welcome! Did your Eclipse (tooling) issue also got re-solved? If it isn't I will ask the tooling specialists to have a look.

                         

                        Magesh

                        • 9. Re: RESTEasyPublishException
                          delivren

                          You should change the class definition of the identifier below, from "atom" to "rss" and then restart the server.

                           

                          Current:

                          <module identifier="org.switchyard.component.camel.rss" implClass="org.switchyard.component.camel.atom.deploy.CamelRSSComponent"/>

                           

                          New:

                          <module identifier="org.switchyard.component.camel.rss" implClass="org.switchyard.component.camel.rss.deploy.CamelRSSComponent"/>