报错
四月 19, 2018 4:32:20 下午 com.alibaba.druid.pool.DruidDataSource error
严重: testOnBorrow is true, validationQuery not set
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
四月 19, 2018 4:32:20 下午 com.alibaba.druid.pool.DruidDataSource warn
警告: Your dbType is mysql, recommend set testWhileIdle is true
四月 19, 2018 4:32:20 下午 com.alibaba.druid.pool.vendor.MySqlValidConnectionChecker warn
警告: Cannot resolve com.mysq.jdbc.Connection.ping method. Will use 'SELECT 1' instead.
java.lang.NullPointerException
at com.alibaba.druid.pool.vendor.MySqlValidConnectionChecker.<init>(MySqlValidConnectionChecker.java:45)
at com.alibaba.druid.pool.DruidDataSource.initValidConnectionChecker(DruidDataSource.java:591)
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:397)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:622)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:618)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:79)
at org.apache.shiro.realm.jdbc.JdbcRealm.doGetAuthenticationInfo(JdbcRealm.java:221)
at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:571)
at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:274)
at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:260)
at ShiroTest.TestShiro(ShiroTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
四月 19, 2018 4:32:20 下午 com.alibaba.druid.pool.DruidDataSource info
信息: {dataSource-1} inited
Thu Apr 19 16:32:21 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
1.解决方式
dataSource.driverClassName=com.mysql.cj.jdbc.Driver
dataSource.validationQuery=select 1
dataSource.testOnBorrow=true
dataSource.testWhileIdle=true
如果继续警告SSH
可以在dataSource.url加上ssh
dataSource.url=jdbc:mysql://localhost:3306/shiro?characterEncoding=utf8&useSSL=true
版权声明:本文为qq_30581017原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。