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]
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)
I tried changing my local compiler settings and installed JRE from 1.6 to 1.7, still the local runs good.
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?
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
Instead of editing the question, I am adding as answer as to what worked in my case; Kudos to @mendieta
(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.This worked :)
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)
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
References for maven pom.xml : http://maven.apache.org/guides/mini/guide-archive-configuration.html
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.
Here's how I declare an Oracle datasource (for calling pl or executing xqueries)
Injecting the Datasource (in a stateless ejb)
Declaring the datasource in standalone.xml
Module definition
Add the module dependency to my ear application (which has the stateless ejb inside..) using maven (or edit your manifest.mf and add the module name)