GVKun编程网logo

java.Sql.SQLException,无法加载类 net.ucanaccess.jdbc.UcanaccessDriver(java程序中无法加载主类)

11

对于java.Sql.SQLException,无法加载类net.ucanaccess.jdbc.UcanaccessDriver感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍java程序中无

对于java.Sql.SQLException,无法加载类 net.ucanaccess.jdbc.UcanaccessDriver感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍java程序中无法加载主类,并为您提供关于Android报java.lang.IllegalAccessException: access to class n、Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully rece...、Cause: java.sql.SQLException: Access denied for user ''root''@''localhost'' (using pa...、Caused by: java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept jdbcUrl, jd的有用信息。

本文目录一览:

java.Sql.SQLException,无法加载类 net.ucanaccess.jdbc.UcanaccessDriver(java程序中无法加载主类)

java.Sql.SQLException,无法加载类 net.ucanaccess.jdbc.UcanaccessDriver(java程序中无法加载主类)

看来您需要在 pom.xml 中添加 JDBC 驱动程序库作为共享库。

有关如何配置的信息,请参阅 https://docs.mulesoft.com/mule-runtime/4.3/mmp-concept#configure-shared-libraries 处的文档。

示例(您可能需要添加其他库):

<sharedLibraries>
    <sharedLibrary>
      <groupId>net.sf.ucanaccess</groupId>
      <artifactId>ucanaccess</artifactId>
    </sharedLibrary>
</sharedLibraries>

Android报java.lang.IllegalAccessException: access to class n

Android报java.lang.IllegalAccessException: access to class n

06-27 04:48:02.123: ERROR/AndroidRuntime(787): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{net.android.surfacetest/net.android.surfacetest.MainActivity}: java.lang.IllegalAccessException: access to class not al

06-27 04:48:02.123: ERROR/AndroidRuntime(787): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{net.android.surfacetest/net.android.surfacetest.MainActivity}: java.lang.IllegalAccessException: access to class not allowed
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.os.Looper.loop(Looper.java:123)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.app.ActivityThread.main(ActivityThread.java:3683)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at java.lang.reflect.Method.invokeNative(Native Method)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at java.lang.reflect.Method.invoke(Method.java:507)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at dalvik.system.NativeStart.main(Native Method)
06-27 04:48:02.123: ERROR/AndroidRuntime(787): Caused by: java.lang.IllegalAccessException: access to class not allowed
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at java.lang.Class.newInstanceImpl(Native Method)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at java.lang.Class.newInstance(Class.java:1409)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-27 04:48:02.123: ERROR/AndroidRuntime(787):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)

Android出现以上是错误日志信息

原因1:Activity没有注册

原因2:包名不匹配

原因3:类不是public的,在报错类的定义前加public即可。

其中原因1和3是最常见的

Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully rece...

Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully rece...

今天访问已经架上服务器的网站,报错:

Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 
The last packet successfully received from the server was 78,050,512 milliseconds ago.
The last packet sent successfully to the server was 78,050,512 milliseconds ago.
is longer than the server configured value of ''wait_timeout''.
You should consider either expiring and/or testing connection validity before use in your application,
increasing the server configured values for client timeouts,
or using the Connector/J connection property ''autoReconnect=true'' to avoid this problem.
翻译过来:上次访问时,发送的包已经多少多少秒了,比设置的‘wait_timeout’要长,建议修改 autoReconnect=true。

解决方案:
修改或添加三个参数:
将testConnectionOnCheckout 设为 false
将testConnectionOnCheckin 设为 true
将idleConnectionTestPeriod 设为 30,这个数字要根据项目情况设定,比8小时小就好

具体原理参考:https://blog.csdn.net/frankcheng5143/article/details/50589264

Cause: java.sql.SQLException: Access denied for user ''root''@''localhost'' (using pa...

Cause: java.sql.SQLException: Access denied for user ''root''@''localhost'' (using pa...

再一次进行 jdbc 连接的过程中出现了以下错误:

Cause: java.sql.SQLException: Access denied for user ''root''@''localhost'' (using password: YES)

 

 

我的 properties 文件信息如下

 

 

很显然 jdbc,password=123456 这里的符号打错了,这才是导致这次问题的原因。

粗心大意,找了半天!!

还有一种的错误,那就是再 root 或 password 后面添加空格

 

 这样也会导致无法连接成功,但是报错信息会明显

 Cause: java.sql.SQLException: Access denied for user ''root   ''@''localhost'' (using password: YES)

 

Caused by: java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept jdbcUrl, jd

Caused by: java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept jdbcUrl, jd

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept jdbcUrl, jdbc:mysql//localhost:3306/cache
### The error may exist in com/pshdhx/cache/mapper/Employeemapper.java (best guess)
### The error may involve com.pshdhx.cache.mapper.Employeemapper.getEmployee
### The error occurred while executing a query
### Cause: java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept jdbcUrl, jdbc:mysql//localhost:3306/cache




    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
    at com.sun.proxy.$Proxy73.selectOne(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87)
    at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
    at com.sun.proxy.$Proxy79.getEmployee(Unknown Source)






springboot连接mysql查询,是字段没有对应上出的错,一开始我是以为连接mysql出了问题;

关于java.Sql.SQLException,无法加载类 net.ucanaccess.jdbc.UcanaccessDriverjava程序中无法加载主类的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Android报java.lang.IllegalAccessException: access to class n、Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully rece...、Cause: java.sql.SQLException: Access denied for user ''root''@''localhost'' (using pa...、Caused by: java.lang.RuntimeException: Driver com.mysql.jdbc.Driver claims to not accept jdbcUrl, jd的相关信息,请在本站寻找。

本文标签: