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.
... 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.
at com.ai.appframe2.complex.datasource.impl.LocalMutilDataSourceImpl.
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.
... 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驱动