jdk1.7使用JVM的UseSplitVerifier参数导致报NoClassDefFoundError: oracle/security/pki/OraclePKIProvider

 

 

场景

1、应用使用1.7的jdk

2、使用字节码工具修改字节码

 

问题

使用字节码工具修改字节码的时候,为了禁用字节码验证,使用-XX:-UseSplitVerifier的JVM参数禁用字节码验证,出现如下报错:

java.lang.ExceptionInInitializerError

        at com.ai.common.Startup.contextInitialized(Startup.java:25)

        at com.ai.common.Startup.main(Startup.java:67)

Caused by: java.lang.RuntimeException: 初始化失败

        at com.ai.appframe2.complex.datasource.DataSourceFactory.(DataSourceFactory.java:29)

        ... 2 more

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'

        at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)

        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)

        at org.apache.commons.dbcp.BasicDataSource.getLogWriter(BasicDataSource.java:1098)

        at org.apache.commons.dbcp.BasicDataSourceFactory.createDataSource(BasicDataSourceFactory.java:350)

        at com.ai.appframe2.complex.datasource.impl.AbstractLocalDataSourceImpl.initDataSourceMap(AbstractLocalDataSourceImpl.java:124)

        at com.ai.appframe2.complex.datasource.impl.AbstractLocalDataSourceImpl.(AbstractLocalDataSourceImpl.java:58)

        at com.ai.appframe2.complex.datasource.impl.LocalMutilDataSourceImpl.(LocalMutilDataSourceImpl.java:70)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

        at java.lang.Class.newInstance(Class.java:379)

        at com.ai.appframe2.complex.datasource.DataSourceFactory.(DataSourceFactory.java:24)

        ... 2 more

Caused by: java.lang.NoClassDefFoundError: oracle/security/pki/OraclePKIProvider

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forName(Class.java:191)

        at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1415)

        ... 14 more

Caused by: java.lang.ClassNotFoundException: oracle.security.pki.OraclePKIProvider

        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

        ... 17 more

 

原因

使用jdk1.7的-XX:-UseSplitVerifier参数禁用字节码验证,

且从oracle驱动JDBC版本1.1.0.2.0及更高版本 ,应用程序启动的是会报NoClassDefFoundError:oracle/security/pki/OraclePKIProvider异常。

 

临时解决

1、更换JDK,避免使用-XX:-UseSplitVerifier的JVM参数禁用字节码验证

2、更换oracle驱动

 

 

你可能感兴趣的:(应用运维)