ClassNotFound:在Wildfly 8.2中运行时,Xerces SAXParserFactoryImpl [英] ClassNotFound: Xerces SAXParserFactoryImpl when running in Wildfly 8.2

查看:281
本文介绍了ClassNotFound:在Wildfly 8.2中运行时,Xerces SAXParserFactoryImpl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Wildfly 8.2.0并进行一些XML Config文件解析.这个想法是,我将能够使用捆绑的xercesImpl.jar提供JAXP SAXParserFactoryImpl.

I am running Wildfly 8.2.0 and doing some XML Config file parsing. The idea is that I'll be able to use my bundled xercesImpl.jar to provide the JAXP SAXParserFactoryImpl.

在Wildfly之外运行逻辑时,我能够成功地使用SAXParserFactoryImpl进行解析.通过设置系统属性可以找到该工厂:

When running the logic outside of Wildfly, I am successfully able to parse with the SAXParserFactoryImpl. This factory is found by setting the system property:

System.setProperty("javax.xml.parsers.SAXParserFactory",
                   "org.apache.xerces.jaxp.SAXParserFactoryImpl");
SAXParserFactory factory = javax.xml.parsers.SAXParserFactory.newInstance();

部署EAR后,出现以下错误:

After deploying my EAR, I receive the following error:

...: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found.
..
..
...: Caused by: java.lang.ClassNotFoundException: org/apache/xerces/jaxp/SAXParserFactoryImpl
..
..

知道Wildfly从wildfly/modules/system/layers/base/org/apache/xerces/main/xercesImpl-2.9.1-jbossas2.jar运行自己的Xerces时,我尝试了以下操作:

Knowing that Wildfly runs its own Xerces from wildfly/modules/system/layers/base/org/apache/xerces/main/xercesImpl-2.9.1-jbossas2.jar, I have tried the following:




[1]使用Wildfly的xercesImpl-2.9.1-jbossas2.jar ...不变




[1] Use Wildfly's xercesImpl-2.9.1-jbossas2.jar ... no change

(来源:jboss-deployment-structure.xml的Wildfly文档)

在jboss-deployment-structure.xml中:

In jboss-deployment-structure.xml:

<jboss-deployment-structure>
    <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
    <deployment>
        ...
    </deployment>
</jboss-deployment-structure>

EARContent:

EARContent:

lib/
    ...(removed xercesImpl.jar)...
META-INF/
    application.xml // Information about EJB that uses xercesImpl.jar
    jboss-deployment-structure.xml




[2]忽略Wildfly的xercesImpl-2.9.1-jbossas2.jar ...没有变化




[2] Ignore Wildfly's xercesImpl-2.9.1-jbossas2.jar ... no change

(来源: https://developer.jboss .org/thread/259010?start = 0& tstart = 0 )

在jboss-deployment-structure.xml中:

In jboss-deployment-structure.xml:

<jboss-deployment-structure>
    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
    <deployment>
        <exclusions>
            <module name="org.apache.xerces" />
        </exclusions>
        ...
    </deployment>
</jboss-deployment-structure>

EARContent:

EARContent:

lib/
    xercesImpl.jar
    ...(many more jars)...
META-INF/
    application.xml // Information about EJB that uses xercesImpl.jar
    jboss-deployment-structure.xml




[3]明确将Wildfly的xerces包含在模块中……没有变化




[3] Explicitly include Wildfly's xerces as a module ... no change

(来源: https://developer.jboss.org/thread/239969)

在jboss-deployment-structure.xml中:

In jboss-deployment-structure.xml:

<jboss-deployment-structure>
    <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
    <deployment>
        <dependencies>  
              <module name="org.apache.xerces" /> 
              ...
        </dependencies>  
    </deployment>
</jboss-deployment-structure>

EARContent:

EARContent:

lib/
    ...(removed xercesImpl.jar)...
META-INF/
    application.xml // Information about EJB that uses xercesImpl.jar
    jboss-deployment-structure.xml  




[4]为JAXP Parser声明Java属性...不变




[4] Declare Java property for JAXP Parser ... no change

启动Wildfly时:

when launching Wildfly:

./standalone.sh -c standalone-full.xml -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl

在standalone-full.xml中

in standalone-full.xml

<system-properties>
    <property name="javax.xml.parsers.SAXParserFactory" value="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
</system-properties>

(注意:尝试[1],[2],[3]尝试过此属性)

(Note: Tried this property with attempts [1], [2], [3])




[5]将Xerces路径添加到jboss-deployment-structure ...不变




[5] Adding Xerces Path to jboss-deployment-structure ... no change

(来源:developer.jboss.org/message/717927#717927)

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
    <deployment>
        <dependencies>
            <system>
                <paths>
                    <path name="org/apache/xerces/jaxp"/>
                </paths>
            </system>
            ...
        </dependencies>
    </deployment>
</jboss-deployment-structure>

推荐答案

经过很多RND终于找到了解决方案. 走了:

After a lot of RND finally found the solution. Here is goes :

1)复制您的XercesImpl-X.x.x.jar并将其粘贴到/jre/lib/ 例如:-对我来说-> C:\ Program Files \ Java \ jdk1.8.0_131 \ jre \ lib 2)在lib内创建一个新文件夹认可". 3)将jar文件粘贴到"已认可"文件夹中 4)重新启动服务器,xerces的地狱消退了.

1) Copy your XercesImpl-X.x.x.jar and paste it in the /jre/lib/ eg:- for me --> C:\Program Files\Java\jdk1.8.0_131\jre\lib 2) Inside the lib create a new folder "endorsed". 3) Paste the jar file inside the "endorsed" folder 4) Restart the server and the xerces hell is subsides.

让我知道该解决方案是否对您有用.

Let me know if the solution worked for you.

这篇关于ClassNotFound:在Wildfly 8.2中运行时,Xerces SAXParserFactoryImpl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆