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

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?

Related

Weblogic 12.2.1.3.0 Developer - Unable to create data source using admin console

I have been trying to create a DataSource on my development machine using Weblogic 12.2.1.3.0 developer install using the admin console and I am getting an exception that I have not encountered before. I have verified that all of the connection information is correct and I can connect to the Oracle Database (v12.1.2) using SQL Developer and an IDE connection but the Weblogic server is not cooperating.
This is the exception that I am getting:
I have also tried creating a DataSource when the EAR file is deployed using descriptors and the DS is created and deployed but the connection pool for the DS cannot be created and the only exception that I am seeing is this:
Connection test failed with the following exception: weblogic.common.resourcepool.ResourceDeadException: 0:weblogic.common.ResourceException: Could not create pool connection for datasource 'StipDS'. The DBMS driver exception was: null
Anyone have any ideas?
Oracle has not been much help at all so far.
check your jdbc connection url, i guess something is missing there. make sure the jdbc driver is present inside lib folder.
I was facing the same issue and able to resolve by replacing the ojdbc6.jar with ojdbc6-2.0.jar from "C:\Oracle\Middleware\wlserver_10.3\server\lib"
Downloaded the jar file from https://jar-download.com/?search_box=ojdbc6++jar
Error log:
Caused By: weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: null
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:283)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1310)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1227)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:250)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1329)
i suggest reverting any network changes that might have taken place.
example DNS change in the resolve.conf file

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.

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

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!

Resources