Axis2
  1. Axis2
  2. AXIS2-4927

Can't use @WebFault and @RequestWrapper annotations in JAX-WS services on Java 1.6

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0, 1.6.1, 1.6.2
    • Fix Version/s: 1.7.0, 1.6.3
    • Component/s: jaxws
    • Labels:
      None

      Description

      When @WebFault and @RequestWrapper annotations are used, JAX-WS service doesn't get deployed properly. Following is the stack trace on the console.

      java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName()Ljava/lang/String;
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.attachWebFaultAnnotation(JavaClassToDBCConverter.java:384)
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.setTypeTargettedAnnotations(JavaClassToDBCConverter.java:247)
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.introspectClass(JavaClassToDBCConverter.java:159)
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.buildDBC(JavaClassToDBCConverter.java:141)
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.produceDBC(JavaClassToDBCConverter.java:97)
      at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:215)
      at org.apache.axis2.jaxws.description.DescriptionFactory.createAxisService(DescriptionFactory.java:564)
      at org.apache.axis2.jaxws.framework.JAXWSDeployer.createAxisService(JAXWSDeployer.java:253)
      at org.apache.axis2.jaxws.framework.JAXWSDeployer.deployClasses(JAXWSDeployer.java:208)
      at org.apache.axis2.jaxws.framework.JAXWSDeployer.deploy(JAXWSDeployer.java:162)
      at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
      at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
      at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
      at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:370)
      at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
      at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:142)
      at org.apache.axis2.deployment.FileSystemConfigurator.loadServices(FileSystemConfigurator.java:147)
      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
      at org.apache.axis2.transport.SimpleAxis2Server.<init>(SimpleAxis2Server.java:47)
      at org.apache.axis2.transport.SimpleAxis2Server.main(SimpleAxis2Server.java:98)
      [INFO] Exception creating Axis Service : null
      java.lang.NoSuchMethodError: javax.xml.ws.RequestWrapper.partName()Ljava/lang/String;
      at org.apache.axis2.jaxws.description.builder.converter.JavaMethodsToMDCConverter.attachRequestWrapperAnnotation(JavaMethodsToMDCConverter.java:202)
      at org.apache.axis2.jaxws.description.builder.converter.JavaMethodsToMDCConverter.convertMethods(JavaMethodsToMDCConverter.java:84)
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.introspectClass(JavaClassToDBCConverter.java:193)
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.buildDBC(JavaClassToDBCConverter.java:141)
      at org.apache.axis2.jaxws.description.builder.converter.JavaClassToDBCConverter.produceDBC(JavaClassToDBCConverter.java:120)
      at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:215)
      at org.apache.axis2.jaxws.description.DescriptionFactory.createAxisService(DescriptionFactory.java:564)
      at org.apache.axis2.jaxws.framework.JAXWSDeployer.createAxisService(JAXWSDeployer.java:253)
      at org.apache.axis2.jaxws.framework.JAXWSDeployer.deployClasses(JAXWSDeployer.java:208)
      at org.apache.axis2.jaxws.framework.JAXWSDeployer.deploy(JAXWSDeployer.java:162)
      at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
      at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
      at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
      at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:370)
      at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
      at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:142)
      at org.apache.axis2.deployment.FileSystemConfigurator.loadServices(FileSystemConfigurator.java:147)
      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210)
      at org.apache.axis2.transport.SimpleAxis2Server.<init>(SimpleAxis2Server.java:47)
      at org.apache.axis2.transport.SimpleAxis2Server.main(SimpleAxis2Server.java:98)

      Thanks,
      ~Isuru

        Activity

        Andreas Veithen made changes -
        Fix Version/s 1.6.3 [ 12320771 ]
        Hide
        Hudson added a comment -

        Integrated in axis2-1.6 #335 (See https://builds.apache.org/job/axis2-1.6/335/)
        AXIS2-4927: Merged r1382245 to the 1.6 branch. (Revision 1470128)

        Result = UNSTABLE
        veithen :
        Files :

        • /axis/axis2/java/core/branches/1_6
        • /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
        • /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
        • /axis/axis2/java/core/branches/1_6/modules/saaj
        Show
        Hudson added a comment - Integrated in axis2-1.6 #335 (See https://builds.apache.org/job/axis2-1.6/335/ ) AXIS2-4927 : Merged r1382245 to the 1.6 branch. (Revision 1470128) Result = UNSTABLE veithen : Files : /axis/axis2/java/core/branches/1_6 /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java /axis/axis2/java/core/branches/1_6/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java /axis/axis2/java/core/branches/1_6/modules/saaj
        Hide
        Stephane Gallès added a comment - - edited

        Hi,

        As I can not use workaround [1], I've tried workaround [2] (using child first classloading) and it has triggered a very subtle but blocking problem

        Indeed, workaround [2] solved the "RequestWrapper" problem, but in the same time something weird happened : all my MTOM annotated services have started to behave as 'non-MTOM' services (I've found by chance that all the 'xop:include' had disappeared in the response from the server, the attachment were inlined instead of being attached via XOP, even though the type of the request was still 'xop+xml')

        After a debugging session, I've localized the problem in method EndpointDescriptionImpl#isMTOMEnabled : this method is looking for the @BindingType or @MTOM annotation and when the workaround [2] is used, it simply does not see them anymore ! (even though the WSDL automatic generation is correct).

        So, everything seems to work, the WSDL seems OK, but MTOM is deactivated on the annotated services during runtime.

        (My environment JBOSS 4.2 GA + JDK 1.6 + Axis 1.6.2 libs embedded in a War (the War is in an Ear).

        Show
        Stephane Gallès added a comment - - edited Hi, As I can not use workaround [1] , I've tried workaround [2] (using child first classloading) and it has triggered a very subtle but blocking problem Indeed, workaround [2] solved the "RequestWrapper" problem, but in the same time something weird happened : all my MTOM annotated services have started to behave as 'non-MTOM' services (I've found by chance that all the 'xop:include' had disappeared in the response from the server, the attachment were inlined instead of being attached via XOP, even though the type of the request was still 'xop+xml') After a debugging session, I've localized the problem in method EndpointDescriptionImpl#isMTOMEnabled : this method is looking for the @BindingType or @MTOM annotation and when the workaround [2] is used, it simply does not see them anymore ! (even though the WSDL automatic generation is correct). So, everything seems to work, the WSDL seems OK, but MTOM is deactivated on the annotated services during runtime. (My environment JBOSS 4.2 GA + JDK 1.6 + Axis 1.6.2 libs embedded in a War (the War is in an Ear).
        Andreas Veithen made changes -
        Summary Can't use @WebFault and @RequestWrapper annotations in JAX-WS services Can't use @WebFault and @RequestWrapper annotations in JAX-WS services on Java 1.6
        Assignee Isuru Eranga Suriarachchi [ isurues ] Andreas Veithen [ veithen ]
        Fix Version/s 1.7.0 [ 12316136 ]
        Fix Version/s 1.6.0 [ 12313622 ]
        Affects Version/s 1.6.2 [ 12317875 ]
        Affects Version/s 1.6.1 [ 12316466 ]
        Affects Version/s 1.6.0 [ 12313622 ]
        Priority Critical [ 2 ] Major [ 3 ]
        Hide
        Hudson added a comment -

        Integrated in Axis2 #1766 (See https://builds.apache.org/job/Axis2/1766/)
        AXIS2-4927: Allow the JAX-WS runtime to run properly on Java 1.6 without endorsing the JAX-WS 2.2 libs. (Revision 1382245)

        Result = SUCCESS
        veithen :
        Files :

        • /axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java
        • /axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
        Show
        Hudson added a comment - Integrated in Axis2 #1766 (See https://builds.apache.org/job/Axis2/1766/ ) AXIS2-4927 : Allow the JAX-WS runtime to run properly on Java 1.6 without endorsing the JAX-WS 2.2 libs. (Revision 1382245) Result = SUCCESS veithen : Files : /axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaClassToDBCConverter.java /axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
        Isuru Eranga Suriarachchi made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 1.6 [ 12313622 ]
        Resolution Fixed [ 1 ]
        Hide
        Isuru Eranga Suriarachchi added a comment -

        Implemented the support for a Axis2 specific endorsed directory. Resolving this issue as we have a workaround.

        Thanks,
        ~Isuru

        Show
        Isuru Eranga Suriarachchi added a comment - Implemented the support for a Axis2 specific endorsed directory. Resolving this issue as we have a workaround. Thanks, ~Isuru
        Hide
        Afkham Azeez added a comment -

        I think it is best to include the JAR into the endorsed directory. Duplicating the JARs in all JAXWS services is not a viable option. You can modify the standalone Axis2 server scripts to include an Axis2 specific endorsed dir. In the case of Axis2 WAR deployment, the user will have to put that JAR into the Appserver specific endorsed directory.

        Show
        Afkham Azeez added a comment - I think it is best to include the JAR into the endorsed directory. Duplicating the JARs in all JAXWS services is not a viable option. You can modify the standalone Axis2 server scripts to include an Axis2 specific endorsed dir. In the case of Axis2 WAR deployment, the user will have to put that JAR into the Appserver specific endorsed directory.
        Hide
        Isuru Eranga Suriarachchi added a comment -

        Hi Azeez,

        Yes. There are two workarounds for this issue.

        [1] Copying geronimo-jaxws_2.2_spec-1.0.jar into JAVA_HOME/jre/lib/endorsed directory.
        [2] Embedding geronimo-jaxws_2.2_spec-1.0.jar in the "lib" folder of the jaxws service jar file and enabling child first class loading in the axis.xml.

        Thanks,
        ~Isuru

        Show
        Isuru Eranga Suriarachchi added a comment - Hi Azeez, Yes. There are two workarounds for this issue. [1] Copying geronimo-jaxws_2.2_spec-1.0.jar into JAVA_HOME/jre/lib/endorsed directory. [2] Embedding geronimo-jaxws_2.2_spec-1.0.jar in the "lib" folder of the jaxws service jar file and enabling child first class loading in the axis.xml. Thanks, ~Isuru
        Hide
        Afkham Azeez added a comment -

        Isuru, What if you place geronimo-jaxws_2.2_spec-1.0.jar in an endorsed directory?

        Show
        Afkham Azeez added a comment - Isuru, What if you place geronimo-jaxws_2.2_spec-1.0.jar in an endorsed directory?
        Hide
        Isuru Eranga Suriarachchi added a comment -

        This issue only exists in JDK 1.6. It works fine in JDK 1.5. Here is the reason for this..

        Axis2 JAX-WS implementation depends on geronimo-jaxws_2.2_spec-1.0.jar for javax.xml.ws packages. JDK 1.6 also provides the same package. geronimo-jaxws supports JAX-WS 2.2 specification. But JDK 1.6 only supports JAX-WS 2.0. In @RequestWrapper, @ResponseWrapper & @WebFault annotations, there are new properties which are introduced in JAX-WS 2.2. So those annotations only work properly with the geronimo-jaxws dependency. However when I run the simple Axis2 server on JDK 1.6, it gets javax.xml.ws package from JDK. That's why the above issue occurs. Therefore we have to make sure that it always binds to geronimo-jaxws dependency.

        This issue has occured after the fix done on https://issues.apache.org/jira/browse/AXIS2-4783 which is correct according to JAX-WS 2.2 spec.

        Thanks,
        ~Isuru

        Show
        Isuru Eranga Suriarachchi added a comment - This issue only exists in JDK 1.6. It works fine in JDK 1.5. Here is the reason for this.. Axis2 JAX-WS implementation depends on geronimo-jaxws_2.2_spec-1.0.jar for javax.xml.ws packages. JDK 1.6 also provides the same package. geronimo-jaxws supports JAX-WS 2.2 specification. But JDK 1.6 only supports JAX-WS 2.0. In @RequestWrapper, @ResponseWrapper & @WebFault annotations, there are new properties which are introduced in JAX-WS 2.2. So those annotations only work properly with the geronimo-jaxws dependency. However when I run the simple Axis2 server on JDK 1.6, it gets javax.xml.ws package from JDK. That's why the above issue occurs. Therefore we have to make sure that it always binds to geronimo-jaxws dependency. This issue has occured after the fix done on https://issues.apache.org/jira/browse/AXIS2-4783 which is correct according to JAX-WS 2.2 spec. Thanks, ~Isuru
        Isuru Eranga Suriarachchi made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Isuru Eranga Suriarachchi created issue -

          People

          • Assignee:
            Andreas Veithen
            Reporter:
            Isuru Eranga Suriarachchi
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development