CXF部署到WebLogic的问题

来源:互联网 发布:模具cnc编程 是什么 编辑:程序博客网 时间:2024/05/01 21:02

这几日把webservice部署到WebLogic上,问题重重啊,搞了2日啊,头都大了,各种冲突。

 

第一个问题:org.apache.cxf.binding.soap.SoapFault: Cannot create a secure XMLInputFactory

 

在WEB-INF文件夹下,加上weblogic.xml

<?xml version="1.0" encoding="UTF-8" ?><weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"><container-descriptor><index-directory-enabled>true</index-directory-enabled><prefer-web-inf-classes>true</prefer-web-inf-classes></container-descriptor></weblogic-web-app>


 

第二个问题: java.lang.ClassCastException: weblogic.xml.jaxp.RegistryDocumentBuilderFactory at javax.xml.parsers.DocumentBuilderFactory

 

jar包冲突导致,网上的资料大都说是xml-apis 冲突,从war包里删除掉xml-apis,这个网址上也说的很清楚

http://forum.spring.io/forum/spring-projects/container/13517-java-lang-classcastexception-weblogic-xml-jaxp-registrydocumentbuilderfactory

我用的是maven管理jar包,上网找了下,http://stackoverflow.com/questions/4925901/classcastexception-while-parsing-xml-with-weblogic

 

因为使用的是公司的框架,刚好公司框架中依赖了这个xml-apis

 

<dependency> <groupId>***</groupId><artifactId>***</artifactId><version>1.0.1</version><exclusions>      <exclusion>         <artifactId>xml-apis</artifactId>         <groupId>xml-apis</groupId>         </exclusion>         </exclusions></dependency>


 

第二个问题:

java.lang.LinkageError: loader constraint violation: loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader)
previously initiated loading for a different type with name "javax/xml/namespace/QName"

 

也是jar包与WebLogic冲突,这次冲突的是stax的 stax-api,

<exclusion>                <groupId>stax</groupId>                <artifactId>stax-api</artifactId>            </exclusion>


第三个问题:

   java.lang.LinkageError: loader constraint violation:
   when resolving overridden method &quot;com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal&#40;Ljavax/xml/stream/XMLStreamReader&#59;Ljava/lang/Class&#59;&#41;Ljavax/xml/bind/JAXBElement&#59;&quot; the class loader &#40;
   instance of weblogic/utils/classloaders/ChangeAwareClassLoader&#41; of the current class,
   com/sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl, and its superclass loader &#40;instance of &lt;bootloader&gt;&#41;,
   have different Class objects for the type allerImpl.unmarshal&#40;Ljavax/xml/stream/XMLStreamReader&#59;Ljava/lang/Class&#59;&#41;Ljavax/xml/bind/JAXBElement&#59;
   used in the signature

 

依旧还是jar包冲突,这次是 javax.xml.stream的stax-api

 

<exclusion>                <groupId>javax.xml.stream</groupId>                <artifactId>stax-api</artifactId>            </exclusion>


 

总体上来说,使用mvn查看依赖树,mvn dependency:tree,查看依赖去除冲突jar包。

 

0 0
原创粉丝点击