繁体   English   中英

找不到Intellij 13 EclipseLink类[]错误

[英]Intellij 13 EclipseLink Class [] not found Error

我有一个Intellij 13.0.1的巨大问题。 我在intellij 13中首次建立了一个JPA项目,需要一些帮助来摆脱一些奇怪的错误。

Caused by: Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error.  Class [] not found.

如果测试连接成功,则添加了一个持久性单元并添加了数据源。 我还在2.5.1版中添加了eclipselink,并在9.3-1100版中添加了postgres.jdbc.driver。 我还安装了Postgres @最新版本。 如果要创建Entitymanager,则会收到错误消息。 任何想法我可以做些什么来摆脱这个错误?

src:

   EntityManagerFactory emf = Persistence.createEntityManagerFactory("RoomDB");
        EntityManager em = emf.createEntityManager(); //<- Configuration Error
        em.getTransaction().begin();

        User user1 = new User();
        user1.setUsername("testuser");
        user1.setPassword("testuser");
        em.persist(user1);

        Room room1 = new Room();
        room1.setRoom_nr(12);
        em.persist(room1);


        em.getTransaction().commit();
        em.close();

堆栈跟踪:

[EL Info]: transaction: 2013-12-30 23:16:13.05--ServerSession(20030435)--property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: 2013-12-30 23:16:13.062--ServerSession(20030435)--property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: 2013-12-30 23:16:13.062--ServerSession(20030435)--property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: 2013-12-30 23:16:13.062--ServerSession(20030435)--property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Info]: transaction: 2013-12-30 23:16:13.949--ServerSession(20030435)--property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: 2013-12-30 23:16:13.949--ServerSession(20030435)--property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: 2013-12-30 23:16:13.95--ServerSession(20030435)--property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: 2013-12-30 23:16:13.95--ServerSession(20030435)--property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Info]: 2013-12-30 23:16:15.632--ServerSession(20030435)--EclipseLink, version: Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5
[EL Severe]: ejb: 2013-12-30 23:16:15.639--ServerSession(20030435)--Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error.  Class [] 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 [] 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:79)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
    at de.Enviroment.main(Enviroment.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error.  Class [] 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)
    ... 13 more

persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

    <persistence-unit name="RoomDB">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <class>de.Entity.Room</class>
        <class>de.Entity.User</class>
        <properties>
            <property name="eclipselink.jdbc.url" value=""/>
            <property name="eclipselink.jdbc.driver" value=""/>
            <property name="eclipselink.jdbc.user" value=""/>
            <property name="eclipselink.jdbc.password" value=""/>
        </properties>
    </persistence-unit>
</persistence>
  <property name="eclipselink.jdbc.driver" value=""/> 

我说那是你的问题。 您明确没有指定驱动程序。 忽略它或使用org.postgresql.Driver

暂无
暂无

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

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