0

My project was using ojdbc6 with c3p0 connection pooling . This i moved to ojdbc8 and UCP(Oracle's universal connection pooling). But i am getting below error:

UCP Config used:

try
                {
                    //Creating a pool-enabled data source
                    pds= PoolDataSourceFactory.getPoolDataSource();

                    String dbURL="jdbc:oracle:thin:@(DESCRIPTION = (CONNECT_TIMEOUT= 15)(RETRY_COUNT=20)(RETRY_DELAY=3) (ADDRESS_LIST =(LOAD_BALANCE=on)(ADDRESS = (PROTOCOL = TCP) (HOST = vm-host-101) (PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = S1NAME)))";

          //this is where am using that package 
                    pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
                    pds.setURL(dbURL);
                    pds.setUser("username");
                    pds.setPassword("password");
                    pds.setInitialPoolSize(5);
                    pds.setMinPoolSize(5);
                    pds.setMaxPoolSize(10);
                    pds.setFastConnectionFailoverEnabled(false);
                    return pds;
                }
                catch(SQLException e)
                {
                    e.printStackTrace();
                }
                return pds;

            }

Error:

Caused by: java.sql.SQLException: Unable to create factory class instance with provided factory class name: java.lang.SecurityException: sealing violation: package oracle.jdbc.pool is sealed
    at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:456) ~[ucp-12.2.0.1.jar:12.2.0.1.0]
    at oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.java:133) ~[ucp-12.2.0.1.jar:12.2.0.1.0]
    at oracle.ucp.jdbc.PoolDataSourceImpl.initConnectionFactory(PoolDataSourceImpl.java:3243) ~[ucp-12.2.0.1.jar:12.2.0.1.0]
    at oracle.ucp.jdbc.PoolDataSourceImpl.createUniversalConnectionPool(PoolDataSourceImpl.java:1105) ~[ucp-12.2.0.1.jar:12.2.0.1.0]
    ... 61 common frames omitted
Caused by: java.lang.SecurityException: sealing violation: package oracle.jdbc.pool is sealed

I understand the error will come when we have 2 class loaded from same package. But i checked in external dependencies in intellij and also tried mvn dependency:tree command of maven. I couldn't find duplicate OJDBC jars in classpath.

Is there any other reason for this?

Vipin CP
  • 3,642
  • 3
  • 33
  • 55

1 Answers1

0

This typically happens when you have more than one ojdbc*.jar in your classpath.

In your question you clearly state you have verified that there was no duplicate but there must be one. If you load ojdbc8 from Maven then you need to make sure that it's not manually added from the local filesystem.

Same thing for ucp.jar. You may want to scan your filesystem for ojdbc6.jar or ojdbc6dms.jar (or ojdbc8.jar and ojdbc8dms.jar or ojdbc10 - just scan for ojdbc*) and rename the jars to something else (or remove them).

It's sometimes cryptic - depending on your framework - to see your full classpath. On linux a "ps -af" command will display the full command line that was used to launch java and these sometimes provides useful information about the classpath.

Vipin CP
  • 3,642
  • 3
  • 33
  • 55
Jean de Lavarene
  • 3,461
  • 1
  • 20
  • 28
  • 1
    yeah this is the reason. generally its hard to find out the duplicate `JAR` when we check in IDE. The trick is, take the out put `JAR` from target folder. unzip it. you can use this command `jar -xvf project.jar` . The same way unzip all the internal jars as well. We can find out the duplicate one. :) – Vipin CP Jan 24 '20 at 09:23