Problem Description:
Tomcat 5.5.17 is used as the web service host and weblogic 9.2.0 is used as the web service client.
If the return value of ws methods is a complex object, an exception will be thrown:
- Caused by: java.lang.UnsupportedOperationException
- at weblogic.xml.stax.XMLStreamReaderBase.getTextCharacters(XMLStreamReaderBase.java:487)
- at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:180)
- at org.codehaus.xfire.util.stax.DepthXMLStreamReader.getTextCharacters(DepthXMLStreamReader.java:180)
- at org.codehaus.xfire.aegis.type.basic.Base64Type.readObject(Base64Type.java:71)
- at org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:159)
- at org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:162)
- at org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206)
- at org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50)
- at org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
- at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
- at org.codehaus.xfire.client.Client.onReceive(Client.java:382)
Thoughts:
According to the stacktrace, it seems weblogic's default xml stax parser doesn't work with xfire 1.2.4 if the method's return value is complex objects. Am thinking to replace the default parser with the one from xfire's library. But how?
Solution:
Set "prefer-web-inf-classes" to true.
- <container-descriptor>
- <prefer-web-inf-classes>trueprefer-web-inf-classes>
- container-descriptor>
Based on the document:
If true, classes located in the WEB-INF directory of a web-app will be loaded in preference to classes loaded in the application or system classloader. Defaults to false. Value specified via console will be given precedence over this setting.
Problem solved!
本文解决了使用Tomcat作为WebService主机和WebLogic作为客户端时,返回复杂对象导致的UnsupportedOperationException异常。通过设置prefer-web-inf-classes为true,优先加载WEB-INF目录下的类,成功解决了问题。
1076

被折叠的 条评论
为什么被折叠?



