I can not add hibernate in intellij

Answered

I use IntelliJ to hibernate but it does add error.
I follow video https://www.youtube.com/watch?v=bGl4u44WRiI 

this error:

[2016-05-16 07:44:21] javax.persistence.PersistenceException: [PersistenceUnit: persistenceUnit] class or package not found
[2016-05-16 07:44:21] java.lang.ClassNotFoundException: models.PmaExportTemplates
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:170)
at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1318)
at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1390)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1184)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1048)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:291)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:373)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at com.intellij.jpa.remote.impl.JpaFacadeImpl.createEntityManagerFactory(JpaFacadeImpl.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

 

Please help me?

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

<persistence-unit name="persistenceUnit">
<mapping-file>models/PmaBookmark.xml</mapping-file>
<mapping-file>models/PmaCentralColumns.xml</mapping-file>
<mapping-file>models/PmaColumnInfo.xml</mapping-file>
<mapping-file>models/PmaDesignerSettings.xml</mapping-file>
<mapping-file>models/PmaExportTemplates.xml</mapping-file>
<mapping-file>models/PmaFavorite.xml</mapping-file>
<mapping-file>models/PmaHistory.xml</mapping-file>
<mapping-file>models/PmaNavigationhiding.xml</mapping-file>
<mapping-file>models/PmaPdfPages.xml</mapping-file>
<mapping-file>models/PmaRecent.xml</mapping-file>
<mapping-file>models/PmaRelation.xml</mapping-file>
<mapping-file>models/PmaSavedsearches.xml</mapping-file>
<mapping-file>models/PmaTableCoords.xml</mapping-file>
<mapping-file>models/PmaTableInfo.xml</mapping-file>
<mapping-file>models/PmaTableUiprefs.xml</mapping-file>
<mapping-file>models/PmaTracking.xml</mapping-file>
<mapping-file>models/PmaUserconfig.xml</mapping-file>
<mapping-file>models/PmaUsergroups.xml</mapping-file>
<mapping-file>models/PmaUsers.xml</mapping-file>
<class>models.PmaBookmark</class>
<class>models.PmaCentralColumns</class>
<class>models.PmaColumnInfo</class>
<class>models.PmaDesignerSettings</class>
<class>models.PmaExportTemplates</class>
<class>models.PmaFavorite</class>
<class>models.PmaHistory</class>
<class>models.PmaNavigationhiding</class>
<class>models.PmaPdfPages</class>
<class>models.PmaRecent</class>
<class>models.PmaRelation</class>
<class>models.PmaSavedsearches</class>
<class>models.PmaTableCoords</class>
<class>models.PmaTableInfo</class>
<class>models.PmaTableUiprefs</class>
<class>models.PmaTracking</class>
<class>models.PmaUserconfig</class>
<class>models.PmaUsergroups</class>
<class>models.PmaUsers</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/phpmyadmin"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value=""/>
</properties>
</persistence-unit>
</persistence>
0
Comment actions Permalink

Hi, sorry for delayed reply. Please pay attention to

[2016-05-16 07:44:21] java.lang.ClassNotFoundException: models.PmaExportTemplates

line. Hibernate can not find this class when looking for those configured in the configuration file. See this thread about similar error: http://stackoverflow.com/a/22513606/2000323

Please make sure the class name is specified correctly and that it can be found in the application classpath.

 

 

0

Please sign in to leave a comment.