Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HibernateException

 
Yudi Ono
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i'am new to hibernate
when i compile the program the result is this :

[root@server-area2 Software]# java -jar replikasi.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at org.replikasi.tebarpesona.MainAction.main(MainAction.java:21)
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
... 1 more

what could be wrong?

thanks

regards
 
Greg Charles
Sheriff
Posts: 2989
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It probably means you are missing jars from the classpath. I ran into this problem recently, and it didn't seem to me that the Hibernate docs addressed it very well. I got sample programs from the Manning Hibernate book running with the following jars:

antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
hibernate-cglib-repack-2.1_3.jar
hibernate3.jar
javassist-3.4.GA.jar
jta-1.1.jar
slf4j-api-1.5.2.jar
hsqldb.jar
log4j-1.2.15.jar
slf4j-log4j12-1.5.2.jar

I believe you can swap log4j with commons-logging if you prefer.
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Charles wrote: I ran into this problem recently, and it didn't seem to me that the Hibernate docs addressed it very well.


When you extract hibernate distro (2.x) you'll have README inside lib directory which lists all the required,optional etc.. And in 3.x they have separated them in to required,optional etc.. inside lib directory.
 
Greg Charles
Sheriff
Posts: 2989
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:
Greg Charles wrote: I ran into this problem recently, and it didn't seem to me that the Hibernate docs addressed it very well.


When you extract hibernate distro (2.x) you'll have README inside lib directory which lists all the required,optional etc.. And in 3.x they have separated them in to required,optional etc.. inside lib directory.


Ah, but the problem is they aren't right. There are several jars that are required, but not mentioned in the required list. If I remember right, there are two or three required jars not mentioned in any of the lists. I found that a bit frustrating.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic