9 Replies Latest reply on Jan 23, 2017 9:21 AM by mnovak

    SoapOverJMS: ConnectionFactory may not be null

    patst

      Hey there,

       

      I'm not sure if this is the correct space for the question, but anyways:

       

      I'm trying to get SoapOverJMS working on Wildfly 10.1.0 but I'm strugging with the configuration.

      I started with the jboss-helloworld-mdb project and created a 'HelloWorldService.wsdl' (Copied from the docs: SOAP over JMS - WildFly 10 - Project Documentation Editor  ).

      Then I used wsconsume to create the java classes from the wsdl and created a 'HelloWorldImpl' class (copied from the docs) implementing the 'HelloWorld' service interface.

       

      If i deploy the war file I always get an exception:

      08:36:06,399 INFO  [org.jboss.ws.cxf.metadata] (MSC service thread 1-4) JBWS024061: Adding service endpoint metadata: id=org.jboss.ws.impl.HelloWorldImpl
       address=jms:queue:testQueue
       implementor=org.jboss.ws.impl.HelloWorldImpl
       serviceName={http://org.jboss.ws/jaxws/cxf/jms}HelloWorldServiceLocal
       portName={http://org.jboss.ws/jaxws/cxf/jms}HelloWorldImplPort
       annotationWsdlLocation=META-INF/wsdl/HelloWorldService.wsdl
       wsdlLocationOverride=null
       mtomEnabled=false
      08:36:06,415 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-4) Creating Service {http://org.jboss.ws/jaxws/cxf/jms}HelloWorldServiceLocal from WSDL: META-INF/wsdl/HelloWorldService.wsdl
      08:36:06,446 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-4) Setting the server's publish address to be jms:queue:testQueue
      08:36:06,446 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."jboss-helloworld-mdb.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss-helloworld-mdb.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "jboss-helloworld-mdb.war"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
      Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: connectionFactory may not be null
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
        at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:79)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543)
        at org.jboss.wsf.stack.cxf.configuration.BusHolder.configure(BusHolder.java:234)
        at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:97)
        at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:59)
        at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
        ... 5 more
      Caused by: java.lang.IllegalArgumentException: connectionFactory may not be null
        at org.apache.cxf.transport.jms.JMSConfiguration.ensureProperlyConfigured(JMSConfiguration.java:102)
        at org.apache.cxf.transport.jms.JMSDestination.activate(JMSDestination.java:104)
        at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:53)
        at org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:95)
        at org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:896)
        at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:123)
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:366)
        ... 13 more
      
      
      08:36:06,446 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {
          "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"jboss-helloworld-mdb.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jboss-helloworld-mdb.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"jboss-helloworld-mdb.war\"
          Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: connectionFactory may not be null
          Caused by: java.lang.IllegalArgumentException: connectionFactory may not be null"},
          "WFLYCTL0412: Required services that are not installed:" => [
              "jboss.deployment.unit.\"jboss-helloworld-mdb.war\".INSTALL",
              "jboss.deployment.unit.\"jboss-helloworld-mdb.war\".beanmanager"
          ],
          "WFLYCTL0180: Services with missing/unavailable dependencies" => [
              "jboss.deployment.unit.\"jboss-helloworld-mdb.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"jboss-helloworld-mdb.war\".beanmanager]",
              "jboss.deployment.unit.\"jboss-helloworld-mdb.war\".batch.environment is missing [jboss.deployment.unit.\"jboss-helloworld-mdb.war\".beanmanager]"
          ]
      }
      

       

      Which part am I missing here? The docs say I have to add the module 'org.hornetq' to my dependencies, but I'm doubting this is correct. The module does not exist anymore.

      I tried 'org.apache.activemq.artemis', 'org.apache.cxf' and 'org.apache.cxf.impl' but I does not change anything.

       

      What can I do to get SoapOverJms running?

        • 1. Re: SoapOverJMS: ConnectionFactory may not be null
          jbertram

          I'm not familiar with SoapOverJms, but reading through the documentation you cited I see that it states that the minimum configuration implies:

          • providing a JNDI connection factory name to be used for connecting to the queues

           

          Have you done this?

           

          Can you paste or attach your WSDL?

          • 2. Re: SoapOverJMS: ConnectionFactory may not be null
            patst

            Thanks for your reply Justin.

             

            I used the wsdl provided in the example (but tried a lot of differend configurations too):

             

            <?xml version='1.0' encoding='UTF-8'?>
            <wsdl:definitions name="HelloWorldService" targetNamespace="http://org.jboss.ws/jaxws/cxf/jms"
              xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
              xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
              xmlns:tns="http://org.jboss.ws/jaxws/cxf/jms"
              xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
              xmlns:soapjms="http://www.w3.org/2010/soapjms/"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema">
              <wsdl:types>
            <xs:schema elementFormDefault="unqualified" targetNamespace="http://org.jboss.ws/jaxws/cxf/jms" version="1.0" xmlns:tns="http://org.jboss.ws/jaxws/cxf/jms" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:element name="echo" type="tns:echo"/>
            <xs:element name="echoResponse" type="tns:echoResponse"/>
            <xs:complexType name="echo">
                <xs:sequence>
                  <xs:element minOccurs="0" name="arg0" type="xs:string"/>
                </xs:sequence>
              </xs:complexType>
            <xs:complexType name="echoResponse">
                <xs:sequence>
                  <xs:element minOccurs="0" name="return" type="xs:string"/>
                </xs:sequence>
              </xs:complexType>
            </xs:schema>
              </wsdl:types>
              <wsdl:message name="echoResponse">
                <wsdl:part element="tns:echoResponse" name="parameters">
                </wsdl:part>
              </wsdl:message>
              <wsdl:message name="echo">
                <wsdl:part element="tns:echo" name="parameters">
                </wsdl:part>
              </wsdl:message>
              <wsdl:portType name="HelloWorld">
                <wsdl:operation name="echo">
                  <wsdl:input message="tns:echo" name="echo">
                </wsdl:input>
                  <wsdl:output message="tns:echoResponse" name="echoResponse">
                </wsdl:output>
                </wsdl:operation>
              </wsdl:portType>
              <wsdl:binding name="HelloWorldServiceSoapBinding" type="tns:HelloWorld">
                <soap:binding style="document" transport="http://www.w3.org/2010/soapjms/"/>
                <wsdl:operation name="echo">
                  <soap:operation soapAction="" style="document"/>
                  <wsdl:input name="echo">
                    <soap:body use="literal"/>
                  </wsdl:input>
                  <wsdl:output name="echoResponse">
                    <soap:body use="literal"/>
                  </wsdl:output>
                </wsdl:operation>
              </wsdl:binding>
              <wsdl:service name="HelloWorldService">
                <soapjms:jndiConnectionFactoryName>java:jms/RemoteConnectionFactory</soapjms:jndiConnectionFactoryName>
                <soapjms:jndiInitialContextFactory>org.jboss.naming.remote.client.InitialContextFactory</soapjms:jndiInitialContextFactory>
                <soapjms:jndiURL>remote://myhost:4447</soapjms:jndiURL>
                <wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldImplPort">
                  <soap:address location="jms:queue:testQueue"/>
                </wsdl:port>
              </wsdl:service>
              <wsdl:service name="HelloWorldServiceLocal">
                <soapjms:jndiConnectionFactoryName>java:/ConnectionFactory</soapjms:jndiConnectionFactoryName>
                <wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldImplPort">
                  <soap:address location="jms:queue:testQueue"/>
                </wsdl:port>
              </wsdl:service>
            </wsdl:definitions>
            
            • 3. Re: SoapOverJMS: ConnectionFactory may not be null
              jbertram

              Can you paste or attach your server's XML config?

              • 4. Re: SoapOverJMS: ConnectionFactory may not be null
                patst

                Sure. I attached the standalone-full.xml which I am using for server startup.

                 

                Thanks for you help!

                • 5. Re: SoapOverJMS: ConnectionFactory may not be null
                  mnovak

                  Hi Patrick,

                   

                  could you try to change jndi name of connection factory from: java:jms/RemoteConnectionFactory to: jms/RemoteConnectionFactory

                   

                  Thanks,

                  Mirek

                  • 6. Re: SoapOverJMS: ConnectionFactory may not be null
                    patst

                    Hi Mirek,

                     

                    I tried to change the jndi name but it does not change anything.

                    For easier reproduction I attached my example project.

                     

                    Patrick

                    • 7. Re: SoapOverJMS: ConnectionFactory may not be null
                      mnovak

                      Hi Pattrick,

                       

                      I tried your deployment and could reproduce the issue. For sure there is problem with configuration of HelloWorldServiceLocal. I tried to debug and problem seems to be that it requires JNDI properties like:

                      <soapjms:jndiConnectionFactoryName>java:/ConnectionFactory</soapjms:jndiConnectionFactoryName>

                      <soapjms:jndiInitialContextFactory>org.jboss.naming.remote.client.InitialContextFactory</soapjms:jndiInitialContextFactory>

                      <soapjms:jndiURL>http-remoting://127.0.0.1:8080</soapjms:jndiURL>

                       

                      When I tried to redeploy then I got:...Caused by: java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory. Thus I tried to add org.jboss.remote-naming to MANIFEST.MF to dependencies and got that it cannot find ConnectionFactory. At this moment I got angry and just put there the same configuration I had for HelloWorldService and wsdl looks like:

                      <?xml version='1.0' encoding='UTF-8'?>
                      <wsdl:definitions name="HelloWorldService" targetNamespace="http://org.jboss.ws/jaxws/cxf/jms"
                        xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
                        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                        xmlns:tns="http://org.jboss.ws/jaxws/cxf/jms"
                        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                        xmlns:soapjms="http://www.w3.org/2010/soapjms/"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                        <wsdl:types>
                      <xs:schema elementFormDefault="unqualified" targetNamespace="http://org.jboss.ws/jaxws/cxf/jms" version="1.0" xmlns:tns="http://org.jboss.ws/jaxws/cxf/jms" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                      <xs:element name="echo" type="tns:echo"/>
                      <xs:element name="echoResponse" type="tns:echoResponse"/>
                      <xs:complexType name="echo">
                         <xs:sequence>
                         <xs:element minOccurs="0" name="arg0" type="xs:string"/>
                         </xs:sequence>
                        </xs:complexType>
                      <xs:complexType name="echoResponse">
                         <xs:sequence>
                         <xs:element minOccurs="0" name="return" type="xs:string"/>
                         </xs:sequence>
                        </xs:complexType>
                      </xs:schema>
                        </wsdl:types>
                        <wsdl:message name="echoResponse">
                         <wsdl:part element="tns:echoResponse" name="parameters">
                         </wsdl:part>
                        </wsdl:message>
                        <wsdl:message name="echo">
                         <wsdl:part element="tns:echo" name="parameters">
                         </wsdl:part>
                        </wsdl:message>
                        <wsdl:portType name="HelloWorld">
                         <wsdl:operation name="echo">
                         <wsdl:input message="tns:echo" name="echo">
                         </wsdl:input>
                         <wsdl:output message="tns:echoResponse" name="echoResponse">
                         </wsdl:output>
                         </wsdl:operation>
                        </wsdl:portType>
                        <wsdl:binding name="HelloWorldServiceSoapBinding" type="tns:HelloWorld">
                         <soap:binding style="document" transport="http://www.w3.org/2010/soapjms/"/>
                         <wsdl:operation name="echo">
                         <soap:operation soapAction="" style="document"/>
                         <wsdl:input name="echo">
                         <soap:body use="literal"/>
                         </wsdl:input>
                         <wsdl:output name="echoResponse">
                         <soap:body use="literal"/>
                         </wsdl:output>
                         </wsdl:operation>
                        </wsdl:binding>
                        <wsdl:service name="HelloWorldService">
                         <soapjms:jndiConnectionFactoryName>jms/RemoteConnectionFactory</soapjms:jndiConnectionFactoryName>
                         <soapjms:jndiInitialContextFactory>org.jboss.naming.remote.client.InitialContextFactory</soapjms:jndiInitialContextFactory>
                         <soapjms:jndiURL>http-remoting://127.0.0.1:8080</soapjms:jndiURL>
                         <wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldImplPort">
                         <soap:address location="jms:queue:testQueue"/>
                         </wsdl:port>
                        </wsdl:service>
                        <wsdl:service name="HelloWorldServiceLocal">
                         <soapjms:jndiConnectionFactoryName>jms/RemoteConnectionFactory</soapjms:jndiConnectionFactoryName>
                         <soapjms:jndiInitialContextFactory>org.jboss.naming.remote.client.InitialContextFactory</soapjms:jndiInitialContextFactory>
                         <soapjms:jndiURL>http-remoting://127.0.0.1:8080</soapjms:jndiURL>
                         <wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldImplPort">
                         <soap:address location="jms:queue:testQueue"/>
                         </wsdl:port>
                        </wsdl:service>
                      </wsdl:definitions>
                      

                       

                      and it got deployed. It's not cool that it's using remote jndi lookup for local lookup but I don't understand the wsdl in this to change it properly. Probably someone else will know.

                       

                      Thanks,

                      Mirek

                       

                       

                      • 8. Re: SoapOverJMS: ConnectionFactory may not be null
                        patst

                        Hey Mirek,

                         

                        thanks for your reply. I managed to get the application deployed with your hints! Looks a bit strange to use the remote lookup but at least it works.

                         

                        Usually someone else provides the WSDL files I have to use. Do you know a way to set the properties (location, jndiConnectionFactoryName, InitialContextFactory, jndiUrl) in the code. I do not want to modify the wsdl files.

                        In WS consumer scenario it is possibly to override the endpoint address and specify all the properties within the address. (jms:queue:testQueue?jndiConnectionFactoryName=jms/RemoteConnectionFactory&jndiURL=http-remoting=//.....)

                         

                        Thanks for your help, I'm getting a bit more confident to have a satisfying solution soon ;-)

                         

                        Patrick

                        • 9. Re: SoapOverJMS: ConnectionFactory may not be null
                          mnovak

                          Sorry, I don't know how to configure it outside wsdl file. I would guess there might be annotations for this purpose.