簡體   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