- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试连接到 derby 数据库时,出现以下错误:
Jan 17, 2014 2:05:36 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 5.0.0.Final
[EL Info]: 2014-01-17 14:05:36.35--ServerSession(989603483)--EclipseLink, version: Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5
[EL Severe]: ejb: 2014-01-17 14:05:36.36--ServerSession(989603483)--Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class [org.apache.derby.jdbc.ClientDriver] not found.
Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class [org.apache.derby.jdbc.ClientDriver] not found.
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:766)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:182)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:527)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:140)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at com.mycompany.managingpersistanceobjects.App.main(App.java:20)
Caused by: Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class [org.apache.derby.jdbc.ClientDriver] not found.
at org.eclipse.persistence.exceptions.DatabaseException.configurationErrorClassNotFound(DatabaseException.java:89)
at org.eclipse.persistence.sessions.DefaultConnector.loadDriverClass(DefaultConnector.java:267)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:85)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:204)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:741)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:239)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:685)
... 8 more
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.590s
Finished at: Fri Jan 17 14:05:36 CET 2014
Final Memory: 5M/121M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project ManagingPersistanceObjects: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
这是一个主类:
public class App {
public static void main(String[] args) {
Customer customer = new Customer("Anthony", "Balla", "tballa@mail.com");
Address address = new Address("Rirherdon RD", "London", "8QE", "UK");
customer.setAddress(address);
EntityManagerFactory emf = Persistence.createEntityManagerFactory("chapter06PU");
EntityManager em = emf.createEntityManager();
EntityTransaction et = em.getTransaction();
et.begin();
em.persist(customer);
et.commit();
em.close();
emf.close();
}
}
这是持久化单元:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="chapter06PU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/chapter06PU;create=true"/>
<property name="javax.persistence.jdbc.password" value="app"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.user" value="app"/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
</persistence-unit>
</persistence>
正在运行的数据库:
Fri Jan 17 10:37:31 CET 2014 : Security manager installed using the Basic server
security policy.
Fri Jan 17 10:37:31 CET 2014 : Apache Derby Network Server - 10.10.1.1 - (145826
8) started and ready to accept connections on port 1527
我相信我对 POM 中的客户端有依赖性:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.10.1.1</version>
<type>jar</type>
</dependency>
你能给点建议吗?
最佳答案
您只需要使用 derbyclient 而不是 derby 作为 artifactId:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.10.1.1</version>
<type>jar</type>
</dependency>
……
关于java - 找不到类 [org.apache.derby.jdbc.ClientDriver],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21186997/
我下载了Core Apache Derby database engine, which also includes the embedded JDBC driver (10.9.1.0)的jar 。
这个问题已经有答案了: What is the purpose of 'Class.forName("MY_JDBC_DRIVER")'? (4 个回答) 已关闭 7 年前。 有人可以向我解释一下这个
尝试连接到 derby 数据库时,出现以下错误: Jan 17, 2014 2:05:36 PM org.hibernate.validator.internal.util.Version INFO
我下载了Core Apache Derby database engine, which also includes the embedded JDBC driver (10.9.1.0)的jar .
我正在学习 Spring MVC,并尝试使用 hibernate 连接到数据库。MVC 部分有效,在一个单独的项目中,我还可以连接并使用 Derby 数据库。但是当我试图将两者放在一起时,我失败了。
这个问题在这里已经有了答案: Class [org.apache.derby.jdbc.ClientDriver] not found. When trying to connect to db (
我已经在 Netbeans 中建立了一个项目,创建了一个脚本,并使用 javadb 创建了一个新数据库。我可以通过 gui 连接到它 - 显示表格内容等,但是当我运行一个应用程序时: EntityM
我想使用 derby 在 netbeans 中操作我的数据库,但我收到此错误: java.lang.ClassNotFoundException: org.apach.derby.jdbc.Clien
我将 Kubuntu 13.10 与 Java 8 和 Netbeans 8.2.0 以及 MariaDB (MySQL) 一起用作我的数据库。我想学习 hibernate 。我创建了空的 Java
我已经通过 Maven Central (org.apache.derby) 下载了驱动程序。 Derby -10.15.1.3.jar derbyclient-10.15.1.3.jar derby
我已经通过 Maven Central (org.apache.derby) 下载了驱动程序。 derby-10.15.1.3.jar derbyclient-10.15.1.3.jar derbyn
我多次尝试在我的 Web 应用程序和 Derby 之间建立连接,但我在 eclipse 控制台中收到了这些错误消息: INFO: Server startup in 3772 ms ERROR: Ca
我是一名优秀的程序员,十分优秀!