-->
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: Command-line SchemaExport can't find classes
PostPosted: Wed Jul 21, 2004 2:34 pm 
Newbie

Joined: Wed Jul 21, 2004 12:10 pm
Posts: 1
I'm using Hibernate (2.1 with extensions 2.1.2) to try and save time by not having to implement my own persistence layer. That means I'm lazy, which means I'd like to get Hibernate to autogenerate as much as possible.

I got hbm2java working after some classpath issues, but hbm2ddl (SchemaExport) won't work, saying that it can't find my persistent classes.

I'm using the files from this example: http://www.systemmobile.com/articles/In ... rnate.html except that I replaced the posgres stuff in the properties file with mysql settings. I have my .class files and .hbm.xml files all in one directory, and that directory is in my CLASSPATH environment variable.

I'm using MySQL and have the connector installed (it worked with the included auction example, though I haven't been able to figure out how that schema got generated yet).

Anyway, after setting up the classpath I'm using this:

Code:
java net.sf.hibernate.tool.hbm2ddl.SchemaExport *.hbm.xml


And getting this:

Code:
log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
net.sf.hibernate.MappingException: net.sf.hibernate.MappingException: persistent class [example.Player] not found
        at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:176)
        at net.sf.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:289)
Caused by: net.sf.hibernate.MappingException: persistent class [example.Player] not found
        at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:84)
        at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
        at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1243)
        at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
        at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:171)
        ... 1 more
Caused by: java.lang.ClassNotFoundException: example.Player
        at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
        at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:81)
        ... 5 more


I don't see how it could be unable to find the classes, as they're sitting *right there* (I'm executing the command in the same directory AND it's in my classpath).

Can anyone help me fix this? I've been trying to get an Ant build figured out, but that's going even more slowly (I'm coming from a python background and am new to Java) and I'd just like to get the command-line version working.

Thanks,

Jason


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.