简体   繁体   English

SQLite JDBC类路径

[英]SQLite JDBC Classpath

I'm migrating an Eclipse project from Windows to Mac . 我正在将Eclipse项目从Windows迁移到Mac For some reason, I'm getting a classpath problem specifically on loading the SQLite JDBC driver in MAC. 出于某种原因,我遇到了有关在MAC中加载SQLite JDBC驱动程序的类路径问题。 Windows copy is OK. Windows复制正常。

    Exception in thread "main" org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver org.sqlite.JDBC class not found  at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:107)

Here's what I did: 这是我所做的:

  1. Displayed System.getProperty("java.class.path") - the result is exactly the same between the PC and MAC. 显示System.getProperty(“ java.class.path”)-结果在PC和MAC之间完全相同。 Same JARs and versions being imported, nothing extra nor missing. 导入相同的JAR和版本,没有多余也没有丢失。

  2. Initially I was referencing sqlite from the Maven local repository. 最初,我是从Maven本地存储库引用sqlite的。 I took out the actual sqlite-jdbc-3.7.2.jar, moved it into some place and did a direct reference to it in the build path. 我取出了实际的sqlite-jdbc-3.7.2.jar,将其移到某个位置并在构建路径中直接引用了它。 But the problem remains. 但是问题仍然存在。

A few observations: 一些观察:

In Windows, typing "org.sqlite." 在Windows中,键入“ org.sqlite”。 in the code gives me a bunch of auto-complete options, while in Mac, it does not give anything. 在代码中给了我很多自动完成选项,而在Mac中,它什么也没有提供。

Other JARs seem to be imported just fine (ex. I have a JodaTime jar and it's working just fine) 其他JAR文件似乎也可以导入(例如,我有一个JodaTime jar,并且可以正常运行)

Is this a classpath problem, or do I need a Mac distribution of SQLite-JDBC? 这是类路径问题,还是我需要Mac发行版的SQLite-JDBC? I don't see any specific jar on on their site. 我在他们的网站上看不到任何特定的jar。 My current copy was downloaded through Maven dependencies. 我当前的副本是通过Maven依赖项下载的。

Thanks in advance. 提前致谢。

The problem is fixed. 该问题已解决。

I simply replaced my current JAR with a fresh copy from xerial.org, and it worked. 我只是用xerial.org的新副本替换了我当前的JAR,它起作用了。

Either the initial JAR I got from the Maven dependency download was corrupted, or some file permissions were preventing the JVM from accessing the JAR's contents. 我从Maven依赖项下载获得的初始JAR已损坏,或者某些文件许可权阻止JVM访问JAR的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM