-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem in Using Hibernate EntityManager
PostPosted: Sun Jun 05, 2011 2:21 pm 
Newbie

Joined: Sun Jun 05, 2011 1:56 pm
Posts: 2
I created 2 classes one Message.java with all annotation and it will be persisted.Other class HelloWorld.java which has main method and makes Use of Hibernate EntityManager.

As told in gavin king's book i didnt created a hibernate.cfg.xml for this, instead i created this file structure in classpath

META-INF/persistence.xml

but as expected code didn't run and showed these exceptions::
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/spi/ProviderUtil
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
   at java.lang.Class.getConstructor0(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at javax.persistence.Persistence.findAllProviders(Persistence.java:79)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
   at hello.HelloWorld.main(HelloWorld.java:10)
Caused by: java.lang.ClassNotFoundException: javax.persistence.spi.ProviderUtil
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 9 more



Please tell me what to do in order to make it work.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.