Java setProperty 必须被 SOAPMessage 的所有子类覆盖
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1738542/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
setProperty must be overridden by all subclasses of SOAPMessage
提问by Pablo Venturino
I'm trying to deploy some web services in a WAR application on JBoss 5.1.0.
我正在尝试在 JBoss 5.1.0 上的 WAR 应用程序中部署一些 Web 服务。
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.
我已经使用 JAX-WS 工具从现有的 wsdl 创建了源文件wsgen
。这创建了 Service 文件和 @XmlType 注释的类,它们将充当请求和响应包装器。
This classes worked well on JBoss 4.2.3, but when moving to JBoss 5.1.0, I get this exception.
这些课程在 JBoss 4.2.3 上运行良好,但在转移到 JBoss 5.1.0 时,我遇到了这个异常。
java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
java.lang.UnsupportedOperationException: setProperty 必须被 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
- Windows XP SP3(但在 Vista 和 Linux 上都一样)
- 太阳 JDK 1.6.0_17
- 用于 jdk6 的 JBoss 5.1.0 GA
Thanks in advance!
提前致谢!
采纳答案by Piotr Kochański
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).
有一些事情可能会出错,所以我会告诉你什么对我的情况有帮助(类似于你的情况,我使用的是 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.
问题在于 JAR 不匹配。首先确保 JBoss 使用的是 JDK 1.6 检查您的 JAVA_HOME 环境。多变的。其次确保您的类是使用 JDK 1.6 编译的。如果您从 Eclipse 运行您的项目,请确保 Eclipse 使用正确的 JDK,如果您从 Eclipse 运行 JBoss,则同样如此。
I guess your have it right, so there comes some magic. Running client do notuse 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 onlylib/endorsed JAX-WS JARs.
我猜你猜对了,所以有一些魔法。运行客户端不使用 $JBOSS_HOME/client 中的库,而仅使用 $JBOSS_HOME/lib/endorsed 中提供的库。显然,如果您使用任何其他与 JAX-WS 无关的 API,例如 JPA 或 EJB 或 Servlet,您可以将它们添加到类路径中,但仅使用lib/endorsed JAX-WS JAR。
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.
在 JBoss 5.1 的情况下,它对我的特殊情况有所帮助,在 JBoss 的早期版本中,还有一些其他技巧有效,例如尝试添加 java 选项 -Dsun.lang.ClassLoader.allowArraySyntax=true 或/和 -Djava.endorsed.dirs= $JBOSS_HOME/lib/endorsed 启动客户端和 JBoss 时。
回答by phatblat
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:
我从 JBoss 4.2.2 升级时遇到了同样的问题,并在JBoss 5.1.0 发行说明中找到了答案 :
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
JBossAS 5.0.0.GA 可以用 Java5 和 Java6 编译。Java5 编译的二进制文件是我们主要/推荐的二进制分发版。它经过了严格的测试,可以在 Java 5 和 Java 6 运行时下运行。在 Java 6 下运行时,您需要手动将以下库从 JBOSS_HOME/client 目录复制到 JBOSS_HOME/lib/endorsed 目录,以便使用 JBossWS 支持的 JAX-WS 2.0 api:
- 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:
我使用的是 JBoss 5.1.0 版本和 Java 5(在 JDK 1.6.0_20 上运行),并且确实将这些 JAR 复制到认可目录中解决了这个问题。我们没有使用为 Java 6 编译的版本,因为注意:
It should be noted however that the Java 6 compiled distribution of JBoss AS 5 is still in experimental stage.
然而,应该注意的是,JBoss AS 5 的 Java 6 编译发行版仍处于试验阶段。
回答by user447390
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,
这可能是由于与SAAJ
jar 的冲突问题。CopyJboss
的Saaj
jar 从{Jboss_HOME}/LIB
到{JBOSS_HOME}/lib/endorsed
。我希望这有助于解决问题,
回答by user538000
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.
确保JBoss
使用jvm
指向认可库的选项启动。如果您JBoss
使用 Eclipse 从 Eclipse启动,则默认情况下不会配置此项WTP
,但如果您JBoss
从命令行启动,则会进行配置。
You can add the following to the VM arguments of the Launch Configuration:
您可以将以下内容添加到 Launch Configuration 的 VM 参数中:
-Djava.endorsed.dirs="${JBOSS_HOME}\jboss-as\lib\endorsed"
回答by jnr
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:
我将必要的库(在我的情况下为 saaj-impl)从 cxf 发行版复制到我的战争中,并使用以下内容的文件 /WEB-INF/jboss-classloader.xml 打开 jboss 类加载器隔离:
<classloading xmlns="urn:jboss:classloading:1.0"
domain="MyDomain"
export-all="NON_EMPTY"
import-all="true">
</classloading>
Hope this help to somebody.
希望这对某人有所帮助。
回答by Steve Hymanson
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:
如果您在运行客户端应用程序时在客户端遇到此错误,除了本答案中的步骤外,您还需要执行类似的步骤:
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/
Add the jars from this answerto
path/jre/lib/endorsed
. I had to create theendorsed
directory.
确定 JVM 的哪个实例正在运行应用程序。就我而言,我有使用 JDK 的独立应用程序和使用 JRE 的小程序。这将是像
/path/jre/bin/
将此答案中的罐子添加到
path/jre/lib/endorsed
. 我必须创建endorsed
目录。
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.
这告诉 VM 在 java 语言默认之前加载 jboss 特定的实现。这发生在引导类加载器中,早在加载类路径中的 jar 之前。
回答by Vadzim
This is the link to this issue: https://issues.jboss.org/browse/JBWS-2418
这是该问题的链接:https: //issues.jboss.org/browse/JBWS-2418
回答by user1397770
try following jars to your jboss/lib/endorsed folder
尝试跟随 jars 到您的 jboss/lib/endorsed 文件夹
jbossws-native-jaxws.jar
jbossws-native-jaxrpc.jar
jbossws-native-saaj.jar
jbossws-native-saaj.jar
回答by Donatello
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
- CXF 2.5.0(Soap WebService 消费者)
- WAR 程序集(无 EAR)
- 没有 jboss-web
- 没有 jboss 类加载
- jboss/lib/endorsed 中没有变化(只有 xalan、serializer、xercesImpl)
- 在 jboss-4.2.1.GA + JDK 1.6 上运行
What it worked for me was simply to add thoses maven dependencies, next to CXF :
它对我有用的只是在 CXF 旁边添加那些 Maven 依赖项:
<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 !
希望它会有所帮助!
回答by volkan
My server configuration is Jboss AS 4.2.1 GA and like below, it works;
我的服务器配置是 Jboss AS 4.2.1 GA,如下所示,它可以工作;
Libraries that I used at lib\endorsed;
我在 lib\endorsed 使用的库;
- JAXWS2.1.1_20070501
- jbossws-native-jaxrpc
- jbossws-native-jaxws
- jbossws-native-jaxws-ext
- jbossws-native-saaj
- serializer
- xalan
- xercesImpl
- JAXWS2.1.1_20070501
- jbossws-native-jaxrpc
- jbossws-native-jaxws
- jbossws-native-jaxws-ext
- jbossws-native-saaj
- 序列化器
- 夏兰
- xercesImpl