Deploying ojdbc14.jar in a code module for a FileNet code module - oracle

I'm trying to deploy a couple of jar files in a code module for an event action in FileNet P8 4.0 (the FileNet server runs on WebSphere 6.1). One of these jars is my custom code, and the other jar is the thin driver for Oracle called ojdbc14.jar (I also tried with ojdbc15.jar), the custom code uses the oracle jar in order to connect to a data source and get a connection using the JNDI name.
When the event action is executed (after a subscription is invoked) the code in my custom module is called OK, the problem occurs when my code needs to load classes from the Oracle jar, I get this cause:
ERROR - Mon Sep 21 16:42:17 UTC 2009 - com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is java.lang.reflect.InvocationTargetException]
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1000)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:705)
at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:2093)
...
Caused by: java.lang.NoClassDefFoundError: oracle.jdbc.driver.OracleLog
at com.ibm.ws.rsadapter.dbutils.impl.OracleUtilityImpl.setLogVolume(OracleUtilityImpl.java:85)
at com.ibm.ws.rsadapter.spi.InternalOracleDataStoreHelper.setProperties(InternalOracleDataStoreHelper.java:142)
at com.ibm.ws.rsadapter.spi.WSRdbDataSource.(WSRdbDataSource.java:846)
at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.setDataSourceProperties(WSManagedConnectionFactoryImpl.java:1947)
... 43 more
...
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleLog
at java.net.URLClassLoader.findClass(URLClassLoader.java:496)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:132)
at java.lang.ClassLoader.loadClass(ClassLoader.java:631)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
... 48 more
Since I'm deploying the oracle jar with the code module, shouldn't FileNet should be able to find the class? Do you think I need to configure something else?
Thanks in advance.

Is it possible for your application to use WebSphere's own JDBC connection pools? When you set up a pool for a particulr database you get all the vendor-specific drivers installed there.
Generally, all manner of classpath and classloader confisions ensue when you try to place infrastructure code in your own applications. I don't know for certain that this is the case for your situation, but I do find taht staying on the known path in WebSphere tends to give the smoothest results.

I found the problem... somehow the ojdbc14.jar file got corrupted, so even when the classpath was correct and no matter what I tried to fix the problem, the problem was always there.
Thanks for the comments!

Related

WebSphere Liberty and Eclipselink SDO

I am porting an old IBM Process Server application to IBM WebSphere Liberty. It contains a lot of code based on Service Data Objects (SDO). I have some good working code, running as standalone Java, using JDK8. I am using eclipselink 2.7.7, specifically 2 jar files;
eclipselink.jar
commonj.sdo_2.1.1v20111051852.jar
I have built this code into a Servlet to handle SOAP requests, and packaged it, along with other code, into an EAR file, which I deployed under IBM WebSphere Liberty 20. It doesn't work. There seems to be a clash with the Liberty version of EclipseLink.
If I deploy the code as a WAR file, and add a classloader of "PARENT_LAST", the code works fine.
However, if I try to deploy the code in an EAR file, and set a classloader of "PARENT_LAST" for the ear file, I get this error;
[ERROR ] CWWKZ0106E: Could not start web application S21.
[ERROR ] CWWKZ0002E: An exception occurred while starting the application S21. The exception message was: com.ibm.ws.container.service.state.StateChangeException: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.eclipse.persistence.jpa.PersistenceProvider.getProviderUtil()Ljavax/persistence/spi/ProviderUtil;" the class loader (instance of com/ibm/ws/classloading/internal/ParentLastClassLoader) of the current class, org/eclipse/persistence/jpa/PersistenceProvider, and the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) for interface javax/persistence/spi/PersistenceProvider have different Class objects for the type javax/persistence/spi/ProviderUtil used in the signature
Does anyone know whether I can replace the IBM Liberty implementation of EclipseLink with my version 2.7.7 version?
My application also uses JPA, which is working fine under Liberty, so I don't want to break that.
Any help / guidance appreciated... it's been a very long saturday.
PS:
I tried running the java code using only the SDO library (commonj.sdo_2.1.1v20111051852.jar), and relying on the WebSphere Liberty runtime jars to provide Eclipselink functionality, and I got the following errors, which is why I then moved to adding the "matching pair" of Eclipselink / SDO jars mentioned above;
Caught Exception : org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getSystemPropertyBoolean(Ljava/lang/String;Z)Z
java.lang.NoSuchMethodError: org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getSystemPropertyBoolean(Ljava/lang/String;Z)Z
at org.eclipse.persistence.sdo.helper.SDOHelperContext.<init>(SDOHelperContext.java:93)
at org.eclipse.persistence.sdo.helper.SDOHelperContext$DefaultHelperContextResolver.getHelperContext(SDOHelperContext.java:1432)
at org.eclipse.persistence.sdo.helper.SDOHelperContext.getHelperContext(SDOHelperContext.java:492)
at org.eclipse.persistence.sdo.helper.SDOHelperContext.getHelperContext(SDOHelperContext.java:471)
at org.eclipse.persistence.sdo.helper.SDOHelperContext.getHelperContext(SDOHelperContext.java:456)
at org.eclipse.persistence.sdo.helper.delegates.SDOXMLHelperDelegator.getXMLHelperDelegate(SDOXMLHelperDelegator.java:178)
at org.eclipse.persistence.sdo.helper.delegates.SDOXMLHelperDelegator.load(SDOXMLHelperDelegator.java:78)
at com.ebs.solas2021.port.adapter.ui.SOAPRequestHandler.main(SOAPRequestHandler.java:237)
It's amazing what you find whgen you re-read the documentation in the cold light of a new day. It turns out that it's possible to install a JPA 2.2 Container on Liberty, while supplying one's own implementation of EclipseLink. Works like a charm.
Documented here: https://openliberty.io/blog/2018/06/29/full_java_ee_8_liberty_18002.html

oracle jdbc driver into the web-inf/lib instead of the tomcat/lib

First of all, I have to say I am currenty using the connection pool of Apache.
I need to put the oracle jdbc jar into the app folder (WEB-INF/lib) but not into the tomcat lib folder. If I put the jar into the tomcat lib everything works fine, otherwise I get the following error messages:
set 01, 2016 12:23:10 PM org.apache.tomcat.jdbc.pool.ConnectionPool init
GRAVE: Unable to create initial connections of pool.
java.sql.SQLException: oracle.jdbc.driver.OracleDriver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
set 01, 2016 12:23:10 PM org.apache.naming.NamingContext lookup
AVVERTENZA: Unexpected exception resolving reference
java.sql.SQLException: oracle.jdbc.driver.OracleDriver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
I have been looking for a solution for days but still I can't come up with something useful. I checked many forums but they just say that it is not very performing putting the jar into web-inf/lib but they don't say if it is really possibile to do it.
My manger has been pushing me for a week for a solution, she wants the jdbc driver into the web-inf/lib of the web-app.
Any solution? Anyone who can help me?

ClassCastException: org.jboss.jca.adapters.jdbc.jdk6.WrappedPreparedStatementJDK6 cannot be cast to OraclePreparedStatement

I'm working to migrate an application from Oracle Application Server to JBoss EAP 6.1. I have most things working but I am getting one error that I haven't been able to figure out:
13:27:29,743 ERROR [com.myproj.db.dao.myDao] (Thread-164) Get Prepared Statement:
java.lang.ClassCastException:
org.jboss.jca.adapters.jdbc.jdk6.WrappedPreparedStatementJDK6 cannot be cast
to oracle.jdbc.internal.OraclePreparedStatement
I have Oracle set up as a module in JBoss for connection pooling using ojdbc6.jar (and it works for other parts of the application), but for the one part of the application that uses an OraclePreparedStatement, it gets the error.
I did make certain that there is no ojdbc6.jar file in the WAR file. The only one in JBoss seems to be inside of the module.
I did try changing the OraclePreparedStatement class to oracle.jdbc.OraclePreparedStatement, but the results are the same.
I did try running with TRACE on for logging to see where classes were loading from. OraclePreparedStatement was loaded from the module with the exception of this line:
4:31:40,583 TRACE [org.jboss.modules] (Thread-84) Finding class
oracle.jdbc.OraclePreparedStatement from Module "deployment.myProj.war:main" from
Service Module Loader
Here's a link to an excerpt of the log - basically just the lines related to OraclePreparedStatement.
I have confirmed that there is no ojdbc6.jar (or any Oracle related jars) in the WAR file, and there is no OraclePreparedStatement class inside of the WAR file either.
I do have the module listed as a dependency in my JBoss deployment structure xml file.
Anyone have any ideas?
From looking at the javadoc I would guess that org.jboss.jca.adapters.jdbc.jdk6.WrappedPreparedStatementJDK6 is wrapping the underlying Oracle JDBC driver.
org.jboss.jca.adapters.jdbc.jdk6.WrappedPreparedStatementJDK6 has a method to get the underlying statement. Perhaps you should try something like the following:
WrappedPreparedStatementJDK6 statement = ...
OraclePreparedStatement oracleStatement = (OraclePreparedStatement)statement.getUnderlyingStatement();

Configuring WebLogic Logging for Commons Logging

I'm writing a Spring web application deployed to a WebLogic 10.3.3 server. I've tried to enable logging as described by the Oracle documentation here: http://docs.oracle.com/cd/E14571_01/web.1111/e13739/config_logs.htm#WLLOG154
Both commons-logging-1.1.1.jar and com.bea.core.weblogic.commons.logging_1.4.0.0.jar are placed in the lib folder of the WebLogic domain, and I'm attempting to initialize the logger exactly as described in the Oracle example. I see the following exception in the server console:
Caused by: org.apache.commons.logging.LogConfigurationException: The chosen
LogFactory implementation does not extend LogFactory. Please check your
configuration. (Caused by java.lang.ClassCastException:weblogic.logging.commons.LogFactoryImpl)
Does anyone know of any possible solutions?
Works for me. Seems like a classloader issue.
Check whether another commons-logging lib is not loaded before application provided commons-logging.

Problems using db2 type 4 drivers with glassfish

I am trying to create a connection pool for a db2 database in glassfish and I'm somewhat new to the entire process. I created the pool yesterday with no problems, I pinged the server successfully and all was well. The next time I start glassfish, my connection pool is gone! After recreating the connection pool with the same settings, the ping is failing with the following error in the server.log:
RAR5099 : Wrong class name or classpath for Datasource Object java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2ConnectionPoolDataSource
I've tried moving the db2 driver .jar files around to lib/ or lib/ext/ and I've played around with the classpath prefixes and suffixes, but I've had no luck. It seems like glassfish isn't finding the drivers but I can't understand why.
BTW: I'm using OS X 10.6 and I configured the connection pool in a pretty basic way. I also added driverType = 4 to the properties.
Thanks in advance for your help!
You need to have the files db2jcc.jar and db2jcc_license_cu.jar in your classpath. The mentioned lib/ext/ should probably do the trick. The correct classname is probably com.ibm.db2.jcc.DB2SimpleDataSource for use with GlassFish.

Resources