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.  [ 4 posts ] 
Author Message
 Post subject: Running Console on Hibernate Example
PostPosted: Wed Dec 29, 2004 3:09 pm 
Newbie

Joined: Wed Dec 29, 2004 2:37 pm
Posts: 3
Location: San Mateo, CA
I can run the console against the example in the eg/ directory on Windows just fine, but under Gentoo Linux it doesn't work. I installed on Windows by simply unzipping into a directory and editing etc/hibernate.properties. I installed on Gentoo by typing "sudo emerge hibernate", which installed into /usr/share/hibernate. This only installed the jars, so I then copied in the missing directories from the Windows installation and set all the file permissions to 666 and directory permissions to 777.

Here is the script that kicks everything off:
Code:
$ cat hconsole
#!/bin/bash
cd /usr/share/hibernate
export JDBC_DRIVER=lib/mysql-connector-java-3.0.14-production-bin.jar
CP="lib/ant-1.5.3.jar:lib/ant-optional-1.5.3.jar:lib/junit-3.8.1.jar:lib/xerces-2.4.0.jar:$JAVA_HOME/lib/tools.jar"
java -cp "$CP" org.apache.tools.ant.Main -Ddriver.jar="$JDBC_DRIVER" $*

Here are the console properties
Code:
$ cat console/hibernateconsole.properties
#Hibernate Console properties
#Wed Dec 29 10:44:05 PST 2004
console.custom.classpath=/usr/share/hibernate/eg;
console.hbm.xml=/usr/share/hibernate/eg/org/hibernate/auction/AuctionItem.hbm.xml;/usr/share/hibernate/eg/org/hibernate/auction/Bid.hbm.xml;/usr/share/hibernate/eg/org/hibernate/auction/User.hbm.xml;
console.hibernate.cfg.xml=
console.hibernate.properties=/usr/share/hibernate/etc/hibernate.properties


Hibernate version: 2.1.7

Mapping documents: Exactly as supplied in the download (eg/ directory)

Code between sessionFactory.openSession() and session.close(): N/A

Full stack trace of any exception that occurs:
The stack trace appears when I press the Apply button in the console's configuration dialog. Doesn't make any difference if I run as root or not, so I don't think permissions are the issue:
Code:
$ sudo hconsole
Buildfile: console/build.xml

run:
     [java] JGoodies Looks: The ClearLook(tm) mode has been set to 'On'.
     [java] log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).
     [java] log4j:WARN Please initialize the log4j system properly.
     [java] net.sf.hibernate.MappingException: net.sf.hibernate.MappingException: persistent class [org.hibernate.auction.AuctionItem] not found
     [java]     at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:179)
     [java]     at net.sf.hibernate.console.Start.reconfig(Start.java:155)
     [java]     at net.sf.hibernate.console.Start$4.configurationChanged(Start.java:539)
     [java]     at net.sf.hibernate.console.ConfigurationUI$ApplyConfig.actionPerformed(ConfigurationUI.java:321)
     [java]     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
     [java]     at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
     [java]     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
     [java]     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
     [java]     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)

     [java]     at java.awt.Component.processMouseEvent(Component.java:5100)
     [java]     at java.awt.Component.processEvent(Component.java:4897)
     [java]     at java.awt.Container.processEvent(Container.java:1569)
     [java]     at java.awt.Component.dispatchEventImpl(Component.java:3615)
     [java]     at java.awt.Container.dispatchEventImpl(Container.java:1627)
     [java]     at java.awt.Component.dispatchEvent(Component.java:3477)
     [java]     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
     [java]     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
     [java]     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
     [java]     at java.awt.Container.dispatchEventImpl(Container.java:1613)
     [java]     at java.awt.Window.dispatchEventImpl(Window.java:1606)
     [java]     at java.awt.Component.dispatchEvent(Component.java:3477)
     [java]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
     [java]     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
     [java]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
     [java]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
     [java] Caused by: net.sf.hibernate.MappingException: persistent class [org.hibernate.auction.AuctionItem] not found
     [java]     at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:85)
     [java]     at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:222)
     [java]     at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1257)
     [java]     at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
     [java]     at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:174)
     [java]     ... 26 more
     [java] Caused by: java.lang.ClassNotFoundException: org.hibernate.auction.AuctionItem
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
     [java]     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
     [java]     at java.lang.Class.forName0(Native Method)
     [java]     at java.lang.Class.forName(Class.java:141)
     [java]     at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
     [java]     at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:82)
     [java]     ... 30 more


Name and version of the database you are using: N/A

The generated SQL (show_sql=true): N/A

Debug level Hibernate log excerpt: No idea why log4j complains or how to fix it.
Code:
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 29, 2004 5:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you don't seem to include your model classes in a classpath setting

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Must be a classpath problem, but ...
PostPosted: Wed Dec 29, 2004 8:41 pm 
Newbie

Joined: Wed Dec 29, 2004 2:37 pm
Posts: 3
Location: San Mateo, CA
Is the console.custom.classpath property in hibernateconsole.properties not the classpath?
console.custom.classpath=/usr/share/hibernate/eg

I tried adding this to the script, with no effect:
Code:
export CLASSPATH=/usr/share/hibernate/eg

Same lack of success with ant's -lib option:

Code:
#!/bin/bash
cd /usr/share/hibernate/
export CLASSPATH=/usr/share/hibernate/eg
ant -lib /usr/share/hibernate/eg -buildfile console/build.xml -Dhibernate-core.home=.. run


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 30, 2004 6:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sorry - i'm blind ,)

I don't know then - it's an ordinary "cannot find class issue".

It should work.

Maybe we have a path conversion error somewhere - but I don't know of such.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.