使用proxool连接sql server 2012的时候一直有下面的错误,原来以为是proxool的配置文件问题。仔细看看了异常,原来是sqljdbc4.jar在作怪
解决办法是:
打开sqljdbc4.jar 删除META-INFO目录下的检验文件MANIFEST.MF MSFTSIGN.RSA,MSFTSIG.SF即可
异常信息如下:
java.lang.ExceptionInInitializerError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.logicalcobwebs.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:616)
at org.logicalcobwebs.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:609)
at org.logicalcobwebs.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:631)
at org.logicalcobwebs.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
at org.logicalcobwebs.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
at org.logicalcobwebs.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at org.logicalcobwebs.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.logicalcobwebs.proxool.ProxyFactory.getProxy(ProxyFactory.java:116)
at org.logicalcobwebs.proxool.ProxyFactory.getWrappedConnection(ProxyFactory.java:85)
at org.logicalcobwebs.proxool.ConnectionPool.getConnection(ConnectionPool.java:261)
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:89)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at portal.petrochina.eas.dbconnection.SQLServerAccountConnectionPool.getInstance(SQLServerAccountConnectionPool.java:60)
at portal.petrochina.eas.service.UserInfoService.authenticateInfo(UserInfoService.java:42)
at test.AccountUserAuthenticate.test(AccountUserAuthenticate.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.logicalcobwebs.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.logicalcobwebs.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
at org.logicalcobwebs.cglib.reflect.FastClass$Generator.create(FastClass.java:64)
at org.logicalcobwebs.cglib.proxy.MethodProxy.helper(MethodProxy.java:81)
at org.logicalcobwebs.cglib.proxy.MethodProxy.create(MethodProxy.java:46)
at $java.sql.Wrapper$$EnhancerByProxool$$c3684300.CGLIB$STATICHOOK1(
)
at $java.sql.Wrapper$$EnhancerByProxool$$c3684300.()
... 43 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.logicalcobwebs.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
at org.logicalcobwebs.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
... 48 more
Caused by: java.lang.SecurityException: class "com.microsoft.sqlserver.jdbc.ISQLServerConnection$$FastClassByProxool$$2b8cf6af"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 54 more