在jboss中部署应用程序时出现Xmlparserv2错误,在JBoss for Java Web应用程序中安装Oracle ojdbc模块 [英] Xmlparserv2 error while application deployed in jboss, Installing Oracle ojdbc module in JBoss for Java web application

查看:172
本文介绍了在jboss中部署应用程序时出现Xmlparserv2错误,在JBoss for Java Web应用程序中安装Oracle ojdbc模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参照该SO线程 - 爪哇:返回从StoredProcedure的XMLType数据,ojdbc6的用法.jar xdb6.jar xmlparserv2.jar for Java to PLSQL interaction
[ojdbc6.jar,xdb6.jar,xmlparserv2-11.1.1.jar]

Referring to this SO thread - Java: Returning XMLType Data from StoredProcedure, Usage of ojdbc6.jar xdb6.jar xmlparserv2.jar for Java to PLSQL interaction [ojdbc6.jar, xdb6.jar, xmlparserv2-11.1.1.jar]

当我的PC上安装了JDK1.6的本地tomcat服务器中部署应用程序时,该应用程序可以完美地工作[能够无异常地检索数据],但是当部署在运行JDK 1.7的JBOSS EAP 6.2服务器中时,它会抛出尝试通过OJDBC桥检索XML时出现异常。

The application works perfectly[able to retrieve the data without any exceptions] when it is deployed in my local tomcat server on my PC with JDK1.6 installed, but when deployed in JBOSS EAP 6.2 server running with JDK 1.7, it throws exception when trying to retrieve the XML through the OJDBC bridge.

java.lang.NullPointerException
13:53:51,265 ERROR [stderr] (http-/0.0.0.0:8080-1)  at oracle.jdbc.driver.NamedTypeAccessor.getOracleObject(NamedTypeAccessor.java:320)
13:53:51,268 ERROR [stderr] (http-/0.0.0.0:8080-1)  at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:217)
13:53:51,270 ERROR [stderr] (http-/0.0.0.0:8080-1)  at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:123)
13:53:51,273 ERROR [stderr] (http-/0.0.0.0:8080-1)  at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:2049)
13:53:51,275 ERROR [stderr] (http-/0.0.0.0:8080-1)  at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:818)

我试图改变我的本地编译程序设置并安装了从1.6到1.7的JRE,本地运行良好。

I tried changing my local compiler settings and installed JRE from 1.6 to 1.7, still the local runs good.

请在远程PC上的JBOSS服务器上输入此错误。 JBOSS是否试图覆盖我已经放入应用程序war文件的ojdbc jar?

Please throw your inputs on this error I am getting on the JBOSS server in remote PC. Is JBOSS trying to override the ojdbc jar that I already put in the application war file?

更新:将JDK版本从1.7降级到1.6在安装JBoss的远程服务器中。在JBoss服务器上运行时仍然出现此错误。寻找可能遇到此问题或知道此问题的原因的人。请分享您的输入

updates: Downgraded the JDK version from 1.7 to 1.6 in the remote server where JBoss is installed. Still getting this error while running in JBoss server. Looking for someone who might have came across this problem or knows what is the reason for this issue. Please share your inputs

推荐答案

我没有编辑问题,而是在我的案例中添加了答案。感谢@mendieta

Instead of editing the question, I am adding as answer as to what worked in my case; Kudos to @mendieta

(1)
我尝试将驱动程序标记为 MANIFEST.MF中的依赖项 [依赖关系:com.oracle ];
并在 /jboss/jboss-eap-6.2/modules/system/layers/base/com/oracle/main 中创建 module.xml
并将 module.xml ojdbc6.jar 放在目录中。

(1) I tried marking driver as a dependency in MANIFEST.MF [Dependencies: com.oracle] ; and creating the module.xml inside /jboss/jboss-eap-6.2/modules/system/layers/base/com/oracle/main and placing both module.xml and the ojdbc6.jar inside the main directory.

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle">
    <resources>
        <resource-root path="ojdbc6-11.2.0.4.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
    </dependencies>
</module>

这有效:)

因此问题是在引用正确的jdbc驱动程序。 Tomcat可能[可能tomcat有jdbc(?)的版本,jetty可以,但是jboss需要这种方式来安装jdbc驱动程序。

hence issue was with referring the correct jdbc driver. Tomcat could[probably tomcat has its version of jdbc(?)], jetty could, but jboss need this way of installing the jdbc driver.

(2)

pom.xml 中添加以下条目,以便在创建 war 时添加清单条目文件,还要从清单类路径中排除 ojdbc.jar (如果你设置了classpath为true,我没有)
并从 WEB-INF / lib中排除

Added the following entries in pom.xml to add the manifest entry while creating the war file, and also to exclude the ojdbc.jar from the manifest classpath(if you set classpath true, I did not) and to exclude from WEB-INF/lib

 <build>
       <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Dependencies>com.oracle</Dependencies>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>

       </plugins>

    </build>



<dependency>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc6</artifactId>
                <version>11.2.0.4</version>
                <!-- excluded from manifest classpath, and excluded from WEB-INF/lib -->
                <scope>provided</scope>
            </dependency>

maven pom.xml的引用: http://maven.apache.org/guides/mini/guide-archive-configuration.html

References for maven pom.xml : http://maven.apache.org/guides/mini/guide-archive-configuration.html

注意:从war文件中删除ojdbc.jar可能会阻止应用程序在tomcat服务器中运行。它已从战争中删除,假设它将在jboss服务器中运行,我们已经将驱动程序安装为jboss模块。

note: Removing the ojdbc.jar from war file might prevent the application from running in tomcat server. It's removed from the war assuming its gonna run in jboss server, where we already installed the driver as a jboss module.

这篇关于在jboss中部署应用程序时出现Xmlparserv2错误,在JBoss for Java Web应用程序中安装Oracle ojdbc模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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