我正在尝试使用Eclipselink教程中描述的MongoDb和Eclipselink。
我已经为Netbeans安装了MongoDb插件。 事实上,使用标准连接,一切都很完美
第一个问题出在jdbc驱动程序创建中。
我从MongoDb官方网站下载了驱动程序
mongodb-driver-3.2.1 mongodb-driver-core-3.2.1 mongo-java-driver-3.2.1
当我尝试使用该驱动程序在Netbeans选项中创建新的JDBC驱动程序时,我发现错误“Driver Class is Missing”。
选项是使用专有驱动程序UnityJDBC,但我不能,因为我的项目必须只使用开源。
我在this link找到了另一个jdbc驱动程序。 Netbeans似乎接受这个作为jdbc驱动程序,但它说“无法建立连接使用com.nosql.NoSqlDriver(无法找到合适的驱动程序)”
所以第一个问题是如何使用jdbc进行连接。
第二个问题与pom依赖关系有关。
<dependency>
<groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.nosql</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
org.eclipse.persistence org.eclipse.persistence.jpa.modelgen.processor 2.6.2 提供
我需要更多吗? 因为我不确定我是否需要同时使用org.eclipse.persistence.nosql和org.eclipse.persistence.jpa.modelgen.processor。
答案 0 :(得分:0)
我已经解决了。
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.14.1</version>
</dependency>
您不能使用3.x版本的驱动程序来保持与eclipselink的兼容性。
Secondo问题
<artifactId>org.eclipse.persistence.nosql</artifactId>
只有这是必要的