setProperty must be overridden by all subclasses of SOAPMessage

大憨熊 提交于 2019-12-18 10:12:43

问题


I'm trying to deploy some web services in a WAR application on JBoss 5.1.0.

I have created the source files from an existing wsdl using JAX-WS tool wsgen. This created the Service files and @XmlType annotated clases that would act as request and response wrappers.

This classes worked well on JBoss 4.2.3, but when moving to JBoss 5.1.0, I get this exception.

java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage

My configuration:

  • Windows XP SP3 (but getting the same on Vista, as well as on Linux)
  • Sun JDK 1.6.0_17
  • JBoss 5.1.0 GA for jdk6

Thanks in advance!


回答1:


There are a few thing that might go wrong, so I will tell you what helped in my case (analogous to yours, I was using JDK 1.6.0_13).

The problem lies in JARs mismatch. First of all make sure JBoss is using JDK 1.6 check your JAVA_HOME env. variable. Secondly make sure your classes are compiled using JDK 1.6. If you run your project from Eclipse make sure Eclipse is using right JDK, the same if you run JBoss from Eclipse.

I guess your have it right, so there comes some magic. Running client do not use libraries from $JBOSS_HOME/client, but use only the ones provided in $JBOSS_HOME/lib/endorsed. Obviously if you are using any other JAX-WS-unrelated API like JPA or EJB or Servlets you can add them to the classpath, but use only lib/endorsed JAX-WS JARs.

It helped in my particular situation in case of JBoss 5.1, in earlier versions of JBoss a few other tricks worked, for instance try to add java option -Dsun.lang.ClassLoader.allowArraySyntax=true or/and -Djava.endorsed.dirs=$JBOSS_HOME/lib/endorsed when starting your client and JBoss.




回答2:


I had the same issue with an upgrade from JBoss 4.2.2 and found the answer in the JBoss 5.1.0 Release Notes:

JBossAS 5.0.0.GA can be compiled with both Java5 & Java6. The Java5 compiled binary is our primary/recommended binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/client directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:

  • jbossws-native-saaj.jar
  • jbossws-native-jaxrpc.jar
  • jbossws-native-jaxws.jar
  • jbossws-native-jaxws-ext.jar

I was using the distribution of JBoss 5.1.0 build with Java 5 (running on JDK 1.6.0_20) and sure enough copying these JARs into the endorsed directory fixed the issue. We're not using the version compiled for Java 6 because of the note:

It should be noted however that the Java 6 compiled distribution of JBoss AS 5 is still in experimental stage.




回答3:


It could be due to conflict issue with SAAJ jar. Copy Jboss's Saaj jar from {Jboss_HOME}/LIB to {JBOSS_HOME}/lib/endorsed. I hope this would help in resolving issue,




回答4:


Make sure you launch JBoss with the jvm options pointing to the endorsed libs. This is not configured by default if you launch JBoss from Eclipse, using WTP, though it is if you launch JBoss from the command line.

You can add the following to the VM arguments of the Launch Configuration:

-Djava.endorsed.dirs="${JBOSS_HOME}\jboss-as\lib\endorsed"



回答5:


try following jars to your jboss/lib/endorsed folder

jbossws-native-jaxws.jar
jbossws-native-jaxrpc.jar
jbossws-native-saaj.jar
jbossws-native-saaj.jar



回答6:


My project was simply based on :

  • CXF 2.5.0 (Soap WebService Consumer)
  • WAR assembly (no EAR)
  • no jboss-web
  • no jboss-classloading
  • no changes in jboss/lib/endorsed (only xalan, serializer, xercesImpl)
  • running on jboss-4.2.1.GA + JDK 1.6

What it worked for me was simply to add thoses maven dependencies, next to CXF :

    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-tools</artifactId>
    </dependency>
    <dependency>
        <groupId>org.codehaus.woodstox</groupId>
        <artifactId>woodstox-core-asl</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.messaging.saaj</groupId>
        <artifactId>saaj-impl</artifactId>
    </dependency>

Hope it will help !




回答7:


I copied necessary lib (saaj-impl in my case) to my war from cxf distribution and turned on jboss classloader isolation with the file /WEB-INF/jboss-classloader.xml of the following content:


<classloading xmlns="urn:jboss:classloading:1.0"
    domain="MyDomain"
    export-all="NON_EMPTY"
    import-all="true">
</classloading>

Hope this help to somebody.




回答8:


If you encounter this error in the client while running a client application you need to follow similar steps in addition to those in this answer:

  1. Determine which instance of the JVM is running the application. In my case I had standalone applications using the JDK and applets using the JRE. This will be somewhere like /path/jre/bin/

  2. Add the jars from this answer to path/jre/lib/endorsed. I had to create the endorsed directory.

This tells the VM to load the jboss specific implementations before the java language defaults. This happens in the bootstrap class loader, well before the jars in the classpath are loaded.




回答9:


This is the link to this issue: https://issues.jboss.org/browse/JBWS-2418




回答10:


My server configuration is Jboss AS 4.2.1 GA and like below, it works;

Libraries that I used at lib\endorsed;

  • JAXWS2.1.1_20070501
  • jbossws-native-jaxrpc
  • jbossws-native-jaxws
  • jbossws-native-jaxws-ext
  • jbossws-native-saaj
  • serializer
  • xalan
  • xercesImpl



回答11:


I use Jboss AS 4.3. In my case, i removed from "deploy" folder the "jbossws.sar".

See this issue: https://issues.jboss.org/browse/JBWS-2821




回答12:


Adding saaj-impl to my web app's lib folder fixed this error. I am using JBoss 4.2.3 and CXF 2.4.10.



来源:https://stackoverflow.com/questions/1738542/setproperty-must-be-overridden-by-all-subclasses-of-soapmessage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!