Hi
I'm trying to get hibernate + jpa to work with smartfox.
However I'm running into a problem because I allways get the exception pasted below.
I guess the exception gets thrown because hibernate is unable to find the classes.
I have the classes in the javaExtensions folder and also tried to copy them into the Server folder since thats where the persistence.xml needed to be.
But nothing helped so far.
I saw that several people are using smartfox + hibernate so I must be missing something obvious here.
Thx in advance
INFO | jvm 1 | 2010/10/05 14:08:17 | 14:08:17.484 - [ WARNING ] > Unexpected Exception: javax.persistence.PersistenceException: [PersistenceUnit: examplePersistenceUnit] class or package not found
INFO | jvm 1 | 2010/10/05 14:08:17 | 05.10.2010 14:08:17 it.gotoandplay.smartfoxserver.controllers.SystemHandler processEvent
INFO | jvm 1 | 2010/10/05 14:08:17 | WARNUNG: Unexpected Exception: javax.persistence.PersistenceException: [PersistenceUnit: examplePersistenceUnit] class or package not found
INFO | jvm 1 | 2010/10/05 14:08:17 | javax.persistence.PersistenceException: [PersistenceUnit: examplePersistenceUnit] class or package not found
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1093)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:871)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:758)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
INFO | jvm 1 | 2010/10/05 14:08:17 | at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
INFO | jvm 1 | 2010/10/05 14:08:17 | at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
INFO | jvm 1 | 2010/10/05 14:08:17 | at globals.Database.getEntityManager(Database.java:15)
INFO | jvm 1 | 2010/10/05 14:08:17 | at secureLogin.SecureLogin.handleInternalEvent(SecureLogin.java:144)
INFO | jvm 1 | 2010/10/05 14:08:17 | at it.gotoandplay.smartfoxserver.controllers.MessageHandler.dispatchEvent(MessageHandler.java:147)
INFO | jvm 1 | 2010/10/05 14:08:17 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.handleLoginRequest(SystemHandler.java:482)
INFO | jvm 1 | 2010/10/05 14:08:17 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.processEvent(SystemHandler.java:221)
INFO | jvm 1 | 2010/10/05 14:08:17 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.run(SystemHandler.java:146)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.lang.Thread.run(Thread.java:619)
INFO | jvm 1 | 2010/10/05 14:08:17 | Caused by: java.lang.ClassNotFoundException: javaExtensions.Persistance.AvatarData
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.security.AccessController.doPrivileged(Native Method)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
INFO | jvm 1 | 2010/10/05 14:08:17 | at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.lang.Class.forName0(Native Method)
INFO | jvm 1 | 2010/10/05 14:08:17 | at java.lang.Class.forName(Class.java:247)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:135)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1009)
INFO | jvm 1 | 2010/10/05 14:08:17 | at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1081)
INFO | jvm 1 | 2010/10/05 14:08:17 | ... 14 more
Hibernate where to put classfiles?
Sorry, I'm not really sure what you want to know.BigFIsh wrote:What are the full name of the files being stored in your javaExtension folder and the settings used to call the classes?
But the AvatarData.class file is located under .../javaExtensions/Persistance/
And the package name is also Persistance.
And what do you mean by settings?
My persistence.cfg for hibernate looks like this
<persistence>
<persistence-unit name="examplePersistenceUnit"
transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost:3306/test" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="xxx" />
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="create" />
</properties>
</persistence-unit>
</persistence>
I tried to run the exact same code in a standalone java application and everything worked fine, so I dont really know why the files can't be found when running things as a smartfox extension.