1 2 3 Previous Next 30 Replies Latest reply on Jul 14, 2017 7:38 AM by sganeshraj

    Problem packaging wsimport generated classes as AS 7 module

    sunfire

      I would like to package webservice implementation classes generated by wsimport into a AS 7 module. But it seems as soon as I break the files out of the application WAR file it failes at the first WebService invocation like thi

       

      09:08:51,411 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (http--208.75.8.98-8080-2) Creating Service {http://cadebill.com/CadebillWebServices/}CadebillWebService from WSDL: jar:file:/srv/jboss/jboss-as-7/modules/com/cadebill/schema-ws/4.9.5/cadebill-schema-ws-4.9.5.0.b01.jar!/CadebillWebService-PROD.wsdl
      

       

      After that it tells me that not peration can be found:

       

      Could not find a matching method for operation {http://cadebill.com/CadebillWebServices/}CheckStatusType. Operation will be unavailable.
      

       

      This error is repeated for all operations defined in the WSDL. Now the moment I move the jar file from the module back into the lib dir of the war file the invocation works as expected.

       

      09:10:55,227 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (http--208.75.8.98-8080-1) Creating Service {http://cadebill.com/CadebillWebServices/}CadebillWebService from WSDL: vfs:/content/gateway-ws.war/WEB-INF/lib/cadebill-schema-ws-4.9.5.0.b01.jar/CadebillWebService-PROD.wsdl
      

       

      Here is what I use in the jboss-deployment-structure.xml to load the module:

       

      <jboss-deployment-structure>
          <deployment>
              <dependencies>
                 <module name="com.cadebill.schema-ws" slot="4.9.5"/>        </dependencies>
          </deployment>
      </jboss-deployment-structure>
      

       

      And here is the module.xml for it:

       

      <module xmlns="urn:jboss:module:1.1" name="com.cadebill.schema-ws" slot="4.9.5">
      
          <resources>
              <resource-root path="cadebill-schema-ws-4.9.5.0.b01.jar"/>
          </resources>
      
          <dependencies>
              <module name="javax.api"/>
              <module name="javax.xml.ws.api" />
              <module name="javax.xml.bind.api" />
          </dependencies>
      
      </module>
      

       

      Any ideas why this is working as a lib/jar and not as a module?

       

      Thanks

        • 1. Re: Problem packaging wsimport generated classes as AS 7 module
          iphands

          I am having the exact same issue. Works when included in my war, does not work when I load it via a module. I bet it has something to do with the impl to ReflectionServiceFactoryBean bean being different due to the included modules or something.

           

          Bump :-D

          • 2. Re: Problem packaging wsimport generated classes as AS 7 module
            sfcoy

            jax-ws artifacts are required to be packaged in a Java EE module such as a WAR file or EJB JAR file.

             

            As a practical aside, the deployer needs to be able to scan your classes for the various jax-ws annotations. How much of the server classpath do you think it should scan? With the above constraints the deployer knows exactly where to look.

            • 3. Re: Problem packaging wsimport generated classes as AS 7 module
              cbredesen

              This makes sense for deployed service endpoints but is inconvenient for simple clients which may be invoked from non-EE type deployables (think Connectors, Authenticators, etc). Thanks for the explanation, Stephen.

              • 4. Re: Problem packaging wsimport generated classes as AS 7 module
                cbredesen

                Any suggestions on a WS client that would "just work" without contianer dependencies or a need to be deployed/recognized by the server?

                • 5. Re: Problem packaging wsimport generated classes as AS 7 module
                  sfcoy

                  You get it for free in Java 6.

                  • 6. Re: Problem packaging wsimport generated classes as AS 7 module
                    cbredesen

                    That's all we're doing here - hence why I'm trying to work out why the AS is buggnig out. Maybe Ian's/my problem differs from OP's?

                    • 7. Re: Problem packaging wsimport generated classes as AS 7 module
                      sfcoy

                      The OPs are talking about server implementations.

                       

                      If you're having a problem with a WS client then it's worth starting a new discussion.

                      • 8. Re: Problem packaging wsimport generated classes as AS 7 module
                        sunfire

                        I don't get why I just can package the JAX-WS client artifacts as a module. What do they have to do with the deployer? After all I don't want to deploy an endpoint but just consume a service sitting on a different server using standard JDK functionality.

                        And since I am declaring the module as a dependency shouldn't all classes from the module be available on the classpath anyways?

                         

                        Sorry to bother you guys with it but its just not clear to me yet.

                         

                        Since there seems to be a little bit of confision here is a little example of what I am trying to do:

                         

                        - run something like this with every regular JDK: wsimport http://www.webservicex.com/globalweather.asmx?WSDL

                        - put the resulting classes into a JBAS 7 module

                        - now call "new GlobalWeather().getGlobalWeatherSoap()" from a WAR application that declared the former module as dependency

                        • 9. Re: Problem packaging wsimport generated classes as AS 7 module
                          ctomc

                          Hi,

                           

                          it is possible for annotated classes to be packed inside module, but the task to do that is not trivial.

                           

                          Process goes something like this:

                          1. get your jar
                          2. create janex index for it (there is also anttask for it)
                          3. if you created jandex index as separate jar include it into module.xml as another resource
                          4. when importing dependancy to this module in your application, you must specify you also want annotations

                           

                          for MANIFEST.MF syntax for importing is somehing like this Dependancies: org.project.myModule annotations, my.other.module...

                          or if you use jboss-deployment-descriptor.xml you must add attribute annotations="true" when adding dependancies.

                           

                          --

                          tomaz

                          • 10. Re: Problem packaging wsimport generated classes as AS 7 module
                            iphands

                            Trying the jandex stuff now... thanks for the heads up.

                            • 11. Re: Problem packaging wsimport generated classes as AS 7 module
                              iphands

                              So wait. I have a login module jar, lets say com.example.lm

                              And a genereated sources jar, lets say com.example.gen (generated wsdl client)

                               

                              com.example.lm's module.xml is:

                              <?xml version="1.0" encoding="UTF-8"?>
                              <module xmlns="urn:jboss:module:1.1" name="com.example.lm">
                                <resources>
                                  <resource-root path="login-module-eap6.jar"/>
                                </resources>
                                <dependencies>
                                  <module name="org.picketbox"/>
                                  <module name="javax.api"/>
                                  <module name="javax.xml.ws.api"/>
                                  <module name="org.jboss.logging"/>
                                  <module name="com.example.gen"/>
                                </dependencies>
                              </module>
                              

                               

                              com.example.gen's module.xml is:

                              <?xml version="1.0" encoding="UTF-8"?>
                              <module xmlns="urn:jboss:module:1.1" name="com.example.gen">
                                <resources>
                                  <resource-root path="generated-wsdls.jar"/>
                                </resources>
                                <dependencies>
                                  <module name="javax.xml.ws.api"/>
                                  <module name="javax.api"/>
                                </dependencies>
                              </module>
                              

                               

                              generated-wsdls.jar is the jar that has a META-INF/jandex.idx

                               

                               

                              Now in my war's jboss-deployment-structure.xml I have:

                               

                              <?xml version="1.0" encoding="UTF-8"?>
                              <jboss-deployment-structure>
                                        <deployment>
                                                  <exclusions>
                                                  </exclusions>
                                                  <dependencies>
                                                            <module name="org.picketlink" />
                                                            <module name="com.example.sso.catalina" />
                                                            <module name="com.example.lm" annotations="true" />
                                                  </dependencies>
                                        </deployment>
                              </jboss-deployment-structure>
                              

                               

                              But I see:

                               

                              11:39:09,805 ERROR [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015894: Module com.example.lm:main will not have it's annotations processed as no META-INF/jandex.idx file was found in the deployment. Please generate this file using the Jandex ant task.
                              

                               

                              Which makes sense because the META-INF/jandex.idx file is in the depenency of com.example.lm and not in com.example.lm it self.

                              What steps do I take here?

                              • 12. Re: Problem packaging wsimport generated classes as AS 7 module
                                ctomc

                                Hi,

                                 

                                never tried it like this i had app dependancy directly to module that has annotations.

                                try if adding

                                 

                                <module name="com.example.gen" >
                                <imports>
                                            <include path="META-INF/"/>
                                     </imports>
                                </module>
                                

                                in com.example.lm module

                                 

                                it might/should work, but didn't tested...

                                 

                                 

                                --

                                tomaz

                                • 13. Re: Problem packaging wsimport generated classes as AS 7 module
                                  iphands

                                  Tomaz Cerar wrote:

                                   

                                  in com.example.lm module

                                   

                                  it might/should work, but didn't tested...

                                   

                                  /me crosses fingers

                                  • 14. Re: Problem packaging wsimport generated classes as AS 7 module
                                    iphands

                                    No good. Well, it did not change.

                                    <?xml version="1.0" encoding="UTF-8"?>
                                    <module xmlns="urn:jboss:module:1.1" name="com.example.lm">
                                      <resources>
                                        <resource-root path="login-module-eap6.jar"/>
                                      </resources>
                                      <dependencies>
                                        <module name="org.picketbox"/>
                                        <module name="javax.api"/>
                                        <module name="javax.xml.ws.api"/>
                                        <module name="org.jboss.logging"/>
                                        <module name="com.example.gen">
                                            <imports>
                                                  <include path="META-INF/"/>
                                          </imports>
                                        </module>  
                                      </dependencies>
                                    </module>
                                    

                                     

                                    And

                                    <include path="META-INF/**"/>
                                    

                                     

                                    And

                                    <include path="META-INF/*"/> 
                                    

                                     

                                    No dice.

                                     

                                     

                                    I still get:

                                     

                                    17:21:11,557 WARNING [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (http-localhost/127.0.0.1:8180-1) Could not find a matching method for operation {http://services.example.com/}validateUser. Operation will be unavailable.
                                    17:21:11,557 WARNING [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (http-localhost/127.0.0.1:8180-1) Could not find a matching method for operation {http://services.example.com/}login. Operation will be unavailable.
                                    
                                    1 2 3 Previous Next