-->
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.  [ 5 posts ] 
Author Message
 Post subject: Newbie - tutorial problem.
PostPosted: Wed Nov 02, 2005 9:36 pm 
Newbie

Joined: Wed Nov 02, 2005 9:25 pm
Posts: 2
Hi all,

I'm new to hibernate and have been working through the tutorial and have encountered a problem which i fear is something really basic.

I am currently at the loading & storing objects section. When i use ant (ant run -Daction=store) on my app it seems to build ok but there are warnings. Also i do not get any indication that the Event was INSERTed t(i.e. no.... [java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (?, ?, ?))


The output from the run is.....


Buildfile: build.xml

clean:
[delete] Deleting directory /opt/hibernate-3.0/bin
[mkdir] Created dir: /opt/hibernate-3.0/bin

copy-resources:
[copy] Copying 5 files to /opt/hibernate-3.0/bin

compile:
[javac] Compiling 3 source files to /opt/hibernate-3.0/bin

run:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: EventManager
[java] at java.lang.VMClassLoader.transformException(java.lang.Class, java.lang.Throwable) (/usr/lib/libgcj.so.6.0.0)
[java] at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.6.0.0)
[java] at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
[java] at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
[java] at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
[java] Caused by: java.lang.ClassNotFoundException: org.hibernate.SessionFactory not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/opt/hibernate-3.0/bin/,file:./,file:/opt/hibernate-3.0/lib/ant-1.6.3.jar,file:/opt/hibernate-3.0/lib/ant-antlr-1.6.3.jar,file:./,file:/opt/hibernate-3.0/lib/ant-junit-1.6.3.jar,file:/opt/hibernate-3.0/lib/ant-launcher-1.6.3.jar,file:./,file:/opt/hibernate-3.0/lib/ant-swing-1.6.3.jar,file:/opt/hibernate-3.0/lib/antlr-2.7.5H3.jar,file:./,file:/opt/hibernate-3.0/lib/asm-attrs.jar,file:/opt/hibernate-3.0/lib/asm.jar,file:./,file:/opt/hibernate-3.0/lib/c3p0-0.8.5.2.jar,file:/opt/hibernate-3.0/lib/cglib-2.1.jar,file:./,file:/opt/hibernate-3.0/lib/cleanimports.jar,file:/opt/hibernate-3.0/lib/commons-collections-2.1.1.jar,file:./,file:/opt/hibernate-3.0/lib/commons-logging-1.0.4.jar,file:/opt/hibernate-3.0/lib/concurrent-1.3.2.jar,file:./,file:/opt/hibernate-3.0/lib/connector.jar,file:/opt/hibernate-3.0/lib/dom4j-1.6.jar,file:./,file:/opt/hibernate-3.0/lib/ehcache-1.1.jar,file:/opt/hibernate-3.0/lib/hsqldb.jar,file:./,file:/opt/hibernate-3.0/lib/jaas.jar,file:/opt/hibernate-3.0/lib/jacc-1_0-fr.jar,file:./,file:/opt/hibernate-3.0/lib/jaxen-1.1-beta-4.jar,file:/opt/hibernate-3.0/lib/jboss-cache.jar,file:./,file:/opt/hibernate-3.0/lib/jboss-common.jar,file:/opt/hibernate-3.0/lib/jboss-jmx.jar,file:./,file:/opt/hibernate-3.0/lib/jboss-system.jar,file:/opt/hibernate-3.0/lib/jdbc2_0-stdext.jar,file:./,file:/opt/hibernate-3.0/lib/jgroups-2.2.7.jar,file:/opt/hibernate-3.0/lib/jta.jar,file:./,file:/opt/hibernate-3.0/lib/junit-3.8.1.jar,file:/opt/hibernate-3.0/lib/log4j-1.2.9.jar,file:./,file:/opt/hibernate-3.0/lib/oscache-2.1.jar,file:/opt/hibernate-3.0/lib/proxool-0.8.3.jar,file:./,file:/opt/hibernate-3.0/lib/swarmcache-1.0rc2.jar,file:/opt/hibernate-3.0/lib/versioncheck.jar,file:./,file:/opt/hibernate-3.0/lib/xerces-2.6.2.jar,file:/opt/hibernate-3.0/lib/xml-apis.jar,file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
[java] at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
[java] at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.6.0.0)
[java] at java.lang.ClassLoader.loadClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
[java] at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
[java] ...4 more

BUILD SUCCESSFUL
Total time: 11 seconds



Any help would be appreciated.
Thank you.


Top
 Profile  
 
 Post subject: Bad classpath
PostPosted: Wed Nov 02, 2005 11:41 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
That's not a warning, that's a fatal error. There's no hibernate jar (hibernate2.jar or hibernate3.jar, as appropriate) on your classpath. Odd, because almost every other jar every written is there :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 5:53 am 
Newbie

Joined: Wed Nov 02, 2005 9:25 pm
Posts: 2
Hi tenwit, thank you for your help.

I have now added hibernate3.jar to the CLASSPATH....

CLASSPATH
/root/hibernate-3.0/hibernate3.jar:/opt/ant/lib/ant-antlr.jar:/root/JUnit/junit3.8.1/junit.jar

Unfortunately i am still getting an error as follows...
Any Ideas?
Thanks again.


Buildfile: build.xml

clean:
[delete] Deleting directory /root/hibernate-3.0/bin
[mkdir] Created dir: /root/hibernate-3.0/bin

copy-resources:
[copy] Copying 3 files to /root/hibernate-3.0/bin

compile:
[javac] Compiling 3 source files to /root/hibernate-3.0/bin
[javac] Note: /root/hibernate-3.0/src/HibernateUtil.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.

run:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/Session
[java] at EventManager.createAndStoreEvent(Unknown Source)
[java] at EventManager.main(Unknown Source)

BUILD SUCCESSFUL
Total time: 5 seconds


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 6:21 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
org.hibernate.Session is in hibernate3.jar too.
There still seems to be a problem with your classpath.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 6:39 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
"gnu.gcj.runtime"

Use a real Java.


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

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.