Compatibility of jPOS and Weblogic

2019-08-31 16:29发布

问题:

Hello I'm having hard time trying to configure jPOS to run in weblogic.

jPOS version 1.9.8

weblogic 10.3.6.0

I got this error:

14:01:12 [[ACTIVE] ExecuteThread: '19' for queue: 'weblogic.kernel.Default (self-tuning)'] (T0100.java:31)
     org.jpos.iso.ISOException: java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory (java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory)
            at org.jpos.iso.packager.GenericPackager.readFile(GenericPackager.java:223)
            at org.jpos.iso.packager.GenericPackager.<init>(GenericPackager.java:130)
            at ums.expy.ulink.T0100.<clinit>(T0100.java:28)
            at ums.expy.ws.service.T0100Service.doJob(T0100Service.java:75)

Code:

private static ISOPackager T0100Packager;
static {
    try {
        T0100Packager = new GenericPackager(
                T0100.class.getResourceAsStream("/ulink0100.xml"));
    } catch (ISOException e) {
        logger.error("", e);
    }
}

Somebody says it will be OK when remove xml-apis.jar, but jPOS needs xml-apis.jar.

I have configed 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>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
</weblogic-web-app>

My maven pom.xml

    <dependency>
        <groupId>org.jpos</groupId>
        <artifactId>jpos</artifactId>
        <version>1.9.8</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.7</version>
    </dependency>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis-spring</artifactId>
        <version>1.2.2</version>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.5.0</version>
    </dependency>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>3.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>3.2.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.2.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.1</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.1</version>
    </dependency>

Why it's not workig?

回答1:

Looks like a conflict in your Xerces versions, perhaps WebLogic's taking precedence over jPOS' xercesImpl-2.10.0.jar



回答2:

In your weblogic.xml add the following

    <prefer-application-packages>
        <package-name>org.apache.xerces.*</package-name>
    </prefer-application-packages>

If you have prefer-web-inf-classes in it, remove or comment it out.