It's finding hbm.xml files from a build directory that I have in my project directory (my Ant script uses this directory). Is it possible for Hibernator to only load hibernator mapping descriptors from the defined source directories only? Or perhaps explicitly tell it to ignore certain files?
thanks,
Darcy.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I actually thought I had fixed that. I've got some code in there that gets the output location for each selected project and ignores any mappings underneath that. I did test it and you should see some output like "Ignoring resources in Project output: /Test/classes"
I'm really interested in anymore details you can give me so I can track this problem down.
Thanks
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes I do see the message saying "Ignoring resources..." so it's not including the xml files in my output directory, but it's finding other files that are a result of my project's ant script for building the application war file.
Modifying my Ant script to remove these files after the war is created is another option and gets around the problem, but I'm thinking that hibernator shouldn't have been doing it in the first place. What do you think?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Perhaps it should be configurable if you want to only include source dirs and in you want to ignore output dirs.
I'll have a go at making that work today. Shouldn't be too hard. Thanks for the feedback!
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-05-08
Hi,
I get an error when trying to connect:
java.lang.NoClassDefFoundError
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:152)
at net.sf.hibernator.HibernateConnection.createConnection(HibernateConnection.java:155)
at net.sf.hibernator.views.ConnectionView.connect(ConnectionView.java:185)
at net.sf.hibernator.views.ConnectionView.access$4(ConnectionView.java:180)
at net.sf.hibernator.views.ConnectionView$6.run(ConnectionView.java:164)
So I think it is failing on the first configuration file (by the way, I generate my hbm.xml files using xdoclet directly into the build directory, so it would be nice if you could configure whether hibernator should ignore the Project output folder or not).
I am not sure how to get it to show more detailed log messages. If someone could let me know how to do that maybe I will be able to track down the problem.
thanks
Steve
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Are you using Eclipse to compile the classes as well?
Make sure that any classes mentioned in Status.hbm.xml are located in C:/project_register/build/ under the correct package/directory structure.
Do you have any dependent projects that the mapping classes rely on that anre't on the Eclipse classpath?
Is that stack trace coming out of the .log file? Because you should at least see which class isn't defined (ie not on the classpath) like java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableException
One last thing to check if you downloaded the nolibs version of Hibernator to make sure you have ALL the right .jars in the plugin directory.
Thanks for the feedback and keep me posted about how it goes
Daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-05-08
Hi Daniel,
Thanks for the quick reply.
I am using Eclipse to compile all the classes. My project doesn't have any projects it depends on.
The only thing out of the ordinary for my project is that it doesn't sit under the eclipse workspace directory.
The stack trace is coming from the .log file, but it doesn't mention what class it can't find (unless it is looking for "" I guess).
I downloaded the full dist so it shouldn't be missing any files.
I have included the mapping for Status - as you can see it is as basic as they get.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-05-15
Hi,
I found the error. The class it was looking for was org.apache.log4j.Layout. I don't know what was causing it to think I was using log4j - I couldn't see any obvious log4j.properties files hanging around. Anyway I ended up adding the log4j jar to the Hibernator plugin and now it works.
On another note - to use the MS SQL Server driver I had to unjar the three required jars and then rejar them as one so Hibernator would find them properly. ie. the connection setup screen didn't seem to allow me to use three jars in the Driver filename - it just used the first. Is that correct?
thanks
Steve
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ahhh. I'll drivers that require more than one file ... I'll all that to the TODO list. Thanks
As for that Log4J thing, Hibernate uses Commons logging and that will only use Log4J if it's on the classpath otherwise just put it out to the console so I really don't know what is going on there.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using Hibernator 0.9.5. In the Hibernator Log view I see the message:
Adding Mapping - c:/java/projects/edd/build/common/classes/...
It's finding hbm.xml files from a build directory that I have in my project directory (my Ant script uses this directory). Is it possible for Hibernator to only load hibernator mapping descriptors from the defined source directories only? Or perhaps explicitly tell it to ignore certain files?
thanks,
Darcy.
Darcy,
I actually thought I had fixed that. I've got some code in there that gets the output location for each selected project and ignores any mappings underneath that. I did test it and you should see some output like "Ignoring resources in Project output: /Test/classes"
I'm really interested in anymore details you can give me so I can track this problem down.
Thanks
Daniel
Yes I do see the message saying "Ignoring resources..." so it's not including the xml files in my output directory, but it's finding other files that are a result of my project's ant script for building the application war file.
Modifying my Ant script to remove these files after the war is created is another option and gets around the problem, but I'm thinking that hibernator shouldn't have been doing it in the first place. What do you think?
Perhaps it should be configurable if you want to only include source dirs and in you want to ignore output dirs.
I'll have a go at making that work today. Shouldn't be too hard. Thanks for the feedback!
Daniel
Hi,
I get an error when trying to connect:
java.lang.NoClassDefFoundError
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:152)
at net.sf.hibernator.HibernateConnection.createConnection(HibernateConnection.java:155)
at net.sf.hibernator.views.ConnectionView.connect(ConnectionView.java:185)
at net.sf.hibernator.views.ConnectionView.access$4(ConnectionView.java:180)
at net.sf.hibernator.views.ConnectionView$6.run(ConnectionView.java:164)
The Hibernator log has:
Ignoring resources in Project output: /project_register/build
Adding Project Depedents C:/project_register/lib/c3p0.jar
Adding Project Depedents C:/project_register/lib/cglib.jar
Adding Project Depedents C:/project_register/lib/commons-beanutils.jar
Adding Project Depedents C:/project_register/lib/commons-collections.jar
Adding Project Depedents C:/project_register/lib/commons-dbcp.jar
Adding Project Depedents C:/project_register/lib/commons-digester.jar
Adding Project Depedents C:/project_register/lib/commons-fileupload.jar
Adding Project Depedents C:/project_register/lib/commons-lang.jar
Adding Project Depedents C:/project_register/lib/commons-logging.jar
Adding Project Depedents C:/project_register/lib/commons-pool.jar
Adding Project Depedents C:/project_register/lib/commons-resources.jar
Adding Project Depedents C:/project_register/lib/commons-validator.jar
Adding Project Depedents C:/project_register/lib/jakarta-oro.jar
Adding Project Depedents C:/project_register/lib/jcs.jar
Adding Project Depedents C:/project_register/lib/jdom.jar
Adding Project Depedents C:/project_register/lib/struts.jar
Adding Project Depedents C:/project_register/lib/xercesImpl.jar
Adding Project Depedents C:/project_register/lib/xml-apis.jar
Adding Project Depedents C:/project_register/lib/xmlParserAPIs.jar
Adding Project Depedents C:/project_register/lib/log4j-1.2.8.jar
Adding Project Depedents C:/project_register/lib/hibernate2.jar
Adding Project Depedents C:/project_register/lib/jfreereport-0.8.1_02.jar
Adding Project Depedents C:/project_register/lib/iText-0.96.jar
Adding Project Depedents C:/project_register/lib/jcommon-0.7.2.jar
Adding Project Depedents C:/project_register/lib/connector.jar
Adding Project Depedents C:/project_register/lib/dom4j.jar
Adding Project Depedents C:/project_register/lib/jaas.jar
Adding Project Depedents C:/project_register/lib/jakarta-poi-1.5.1-final-20020615.jar
Adding Project Depedents C:/project_register/lib/jdbc2_0-stdext.jar
Adding Project Depedents C:/project_register/lib/jta.jar
Adding Project Depedents C:/project_register/lib/junit.jar
Adding Project Depedents C:/project_register/lib/odmg.jar
Adding Project Depedents C:/project_register/lib/xalan.jar
Adding Project Depedents C:/project_register/lib/xerces.jar
Adding Project Classpath file:/C:/project_register/build/
Adding Mapping - C:/project_register/conf/Status.hbm.xml
So I think it is failing on the first configuration file (by the way, I generate my hbm.xml files using xdoclet directly into the build directory, so it would be nice if you could configure whether hibernator should ignore the Project output folder or not).
I am not sure how to get it to show more detailed log messages. If someone could let me know how to do that maybe I will be able to track down the problem.
thanks
Steve
Steve,
Are you using Eclipse to compile the classes as well?
Make sure that any classes mentioned in Status.hbm.xml are located in C:/project_register/build/ under the correct package/directory structure.
Do you have any dependent projects that the mapping classes rely on that anre't on the Eclipse classpath?
Is that stack trace coming out of the .log file? Because you should at least see which class isn't defined (ie not on the classpath) like java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableException
One last thing to check if you downloaded the nolibs version of Hibernator to make sure you have ALL the right .jars in the plugin directory.
Thanks for the feedback and keep me posted about how it goes
Daniel
Hi Daniel,
Thanks for the quick reply.
I am using Eclipse to compile all the classes. My project doesn't have any projects it depends on.
The only thing out of the ordinary for my project is that it doesn't sit under the eclipse workspace directory.
The stack trace is coming from the .log file, but it doesn't mention what class it can't find (unless it is looking for "" I guess).
I downloaded the full dist so it shouldn't be missing any files.
I have included the mapping for Status - as you can see it is as basic as they get.
<hibernate-mapping default-cascade="none" auto-import="true">
<class name="com.gui.dhs.prs.client.Status" table="status" mutable="true" polymorphism="implicit" dynamic-update="false">
<id name="id" column="status_id" unsaved-value="0">
<generator class="native" />
</id>
<version name="version" column="version" type="integer" />
<property name="code" type="java.lang.String" column="status_cd" length="1" not-null="true" unique="true" update="true" insert="true" />
<property name="name" type="java.lang.String" column="status_nm" length="100" not-null="true" unique="false" update="true" insert="true" />
</class>
</hibernate-mapping>
Steve
Hi,
I found the error. The class it was looking for was org.apache.log4j.Layout. I don't know what was causing it to think I was using log4j - I couldn't see any obvious log4j.properties files hanging around. Anyway I ended up adding the log4j jar to the Hibernator plugin and now it works.
On another note - to use the MS SQL Server driver I had to unjar the three required jars and then rejar them as one so Hibernator would find them properly. ie. the connection setup screen didn't seem to allow me to use three jars in the Driver filename - it just used the first. Is that correct?
thanks
Steve
Ahhh. I'll drivers that require more than one file ... I'll all that to the TODO list. Thanks
As for that Log4J thing, Hibernate uses Commons logging and that will only use Log4J if it's on the classpath otherwise just put it out to the console so I really don't know what is going on there.