• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class not found when trying to create tables from entities.  RSS feed

 
Cedric Bosch
Ranch Hand
Posts: 99
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having some troubles creating tables from entities in eclipse.
So I had this project on eclipse where I created entities from mysql tables and everything was working great. Yesterday I decided to switch from windows to ubuntu and thus I just made a back up of the eclipse project thinking I could create tables from the entities anyway.

So when I right click on the project -> JPA tools -> create tables from entities, I get the following error :

Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.6.0.v20140809-296a69f): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: org.eclipse.persistence.dynamic.DynamicClassLoader@6eceb130
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.0.v20140809-296a69f): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [my-pu] failed.
Internal Exception: java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/jpql/parser/ExpressionVisitor
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:107)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:179)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.0.v20140809-296a69f): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [my-pu] failed.
Internal Exception: java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/jpql/parser/ExpressionVisitor
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1973)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1964)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:96)
... 5 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.6.0.v20140809-296a69f): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [my-pu] failed.
Internal Exception: java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/jpql/parser/ExpressionVisitor
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:231)
... 9 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/persistence/jpa/jpql/parser/ExpressionVisitor
at org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata.addJPAQuery(NamedQueryMetadata.java:105)
at org.eclipse.persistence.internal.jpa.metadata.queries.NamedQueryMetadata.process(NamedQueryMetadata.java:192)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processQueries(MetadataProject.java:1630)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.addNamedQueries(MetadataProcessor.java:148)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1915)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor
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)
... 12 more


Could someone explain me what that means ? Thanks in advance.

By the way, this might be relevant, Wildfly by default uses hibernate as JPA provider, I did switch it to EclipseLink.
 
Roel De Nijs
Sheriff
Posts: 11096
173
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cedric Bosch wrote:Could someone explain me what that means ?

That's easy: you are missing the ExpressionVisitor interface

How to fix it? No idea. But maybe the EclipseLink section of the WildFly Reference Guide might help.
 
Cedric Bosch
Ranch Hand
Posts: 99
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I don't know how to resolve this.
 
Roel De Nijs
Sheriff
Posts: 11096
173
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First (and most obvious) question: are all necessary JARs on the classpath?
 
Cedric Bosch
Ranch Hand
Posts: 99
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:First (and most obvious) question: are all necessary JARs on the classpath?


When you say classpath, you meant the wildfly folder ?
Because if I right click on the project, properties, jpa, EclipseLink 2.5.x is selected (I'm using 2.6 but that wasn't in the list) then it's not "user library" but "target runtime". So I'm assuming you meant in the wildfly folder.

In the wildfly folder (/home/cedric/Applications/wildfly-9.0.2.Final/modules/system/layers/base/org/eclipse/persistence/main) I have:

- eclipselink.jar
- jipijapa-eclipselink-1.0.1.Final.jar
- module.xml

module.xml is :



The weird thing however is that if I add eclipselink dependency to pom.xml I've another error ( javax.naming.NoInitialContextException ) - but I shouldn't have to add it I think - ..
 
Cedric Bosch
Ranch Hand
Posts: 99
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the target library to be the user defined library in properties-> jpa.

Then I followed this tut : https://www.youtube.com/watch?v=wjCCQSJVtVQ

basically :



and it works!


 
Roel De Nijs
Sheriff
Posts: 11096
173
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So did you add a persistence.xml or did you already have such a file but where some properties missing?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!