-->
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.  [ 13 posts ] 
Author Message
 Post subject: Question regarding Hibernate Tools 3.1 beta 1
PostPosted: Thu Oct 20, 2005 1:03 am 
Newbie

Joined: Thu Oct 06, 2005 8:08 pm
Posts: 19
First question: The Hibernate Tools 3.1 beta 1 download includes the older version of several components that are required by WTP 0.7.1. Is there any problem with the newer components?

WTP 0.7.1 requires:
    org.eclipse.jem.util_1.1.0.1
    org.eclipse.draw2d_3.1.1.jar
    org.eclipse.gef_3.1.1.jar
Hibernate 3.1 beta 1 includes:
    org.eclipse.jem.util_1.1.0
    org.eclipse.draw2d_3.1.0.jar
    org.eclipse.gef_3.1.0.jar


Main question: I get the following error. My mapping file is very simple and seems fine. The message doesn't really give me any places to start investigate. The error is: "org.hibernate.MappingException: Could not read mappings from resource: com/auenrec/data/GenericUser.hbm.xml"

Start of stack trace:
Code:
org.hibernate.MappingException: Could not read mappings from resource: com/auenrec/data/GenericUser.hbm.xml
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:476)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1414)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1382)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1363)


The contents of that file are really simple:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="com.auenrec.data.GenericUser" table="GenericUsers">
        <id name="id" column="ID">
            <generator class="native"/>
        </id>
    </class>
</hibernate-mapping>


Any ideas? Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 1:19 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
take a look at your class path and make sure the com/auenrec/data/GenericUser.hbm.xml resource is in it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 1:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
wtp 0.7.1 came out just before we start packaging the release and there were some minor issues found with it which we could not solve without further delaying the release. Thus we relased it with wtp 0.7 - you are more than welcome to update to wtp 0.7.1 and report if you find anything ununsual.


and yes, you need to setup the classpath of the console configuration.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 10:35 am 
Newbie

Joined: Thu Oct 06, 2005 8:08 pm
Posts: 19
dennisbyrne wrote:
take a look at your class path and make sure the com/auenrec/data/GenericUser.hbm.xml resource is in it.


That's not the problem. Actually, at first I didn't setup the classpath and I got a different error:

"org.hibernate.MappingException: Resource: com/auenrec/data/GenericUser.hbm.xml not found"

But I quickly fixed that and the error changed from "resource not found" to the "could not read mappings" error that I quoted at the start of this thread.

Any ideas? Anything places to start investigating?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 11:04 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Is that the FULL stacktrace ? This error will be thrown if the XML is not well formed.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 11:19 am 
Newbie

Joined: Thu Oct 06, 2005 8:08 pm
Posts: 19
pksiv wrote:
Is that the FULL stacktrace ? This error will be thrown if the XML is not well formed.


It's only a partial stack trace. I clipped it as I thought including a huge complete stack trace would dissuade readers. I will post the full stack trace when I get a chance to stop by my home (I'm at work at the moment).

The XML is well formed. I just ran it through an online validation service. Hibernate itself corectly uses that mapping file when running my application.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 11:25 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
gamigin wrote:
pksiv wrote:
Is that the FULL stacktrace ? This error will be thrown if the XML is not well formed.


It's only a partial stack trace. I clipped it as I thought including a huge complete stack trace would dissuade readers. I will post the full stack trace when I get a chance to stop by my home (I'm at work at the moment).

The XML is well formed. I just ran it through an online validation service. Hibernate itself corectly uses that mapping file when running my application.


If you can put a breakpoint in the Hibernate code, you'll see that in the addResource() method, Hibernate eats more meaningful MappingException messages thrown from the addInputStream() method and throws the generic one that you are receiving.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 12:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
where do we eat an exception/error message ? AFAIK we either rethrow or wrap the original exception so it is possible for you to see the cause chain.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 12:59 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Of course your right Max. I was looking at this quickly and missed that the original exception was being passed to the newly created one.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject: Re: Question regarding Hibernate Tools 3.1 beta 1
PostPosted: Sat Oct 22, 2005 6:51 pm 
Newbie

Joined: Thu Oct 06, 2005 8:08 pm
Posts: 19
gamigin wrote:
Main question: I get the following error. My mapping file is very simple and seems fine. The message doesn't really give me any places to start investigate. The error is: "org.hibernate.MappingException: Could not read mappings from resource: com/auenrec/data/GenericUser.hbm.xml"


OK, it was a basic onfiguration error on my part: the classpath was properly set to the mapping XML files and the .java files but not to the compiled .class files.

Once I fixed that, I made it farther. I fixed another problem where I had to make a special version of hibernate.cfg.xml that refers to the database directly rather than via JNDI. That worked.

Then I get another configuration error:

"Problems while creating sessionfactory" with complete stack trace:
Quote:
org.hibernate.PropertyNotFoundException: Could not find a getter for enabled in class com.auenrec.data.ForeignSiteUser
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.mapping.Property.getGetter(Property.java:250)
at org.hibernate.tuple.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:255)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:121)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:249)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:411)
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:90)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:217)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1145)
at org.hibernate.console.ConsoleConfiguration$2.execute(Unknown Source)
at org.hibernate.console.execution.DefaultExecutionContext.execute(Unknown Source)
at org.hibernate.console.ConsoleConfiguration.execute(Unknown Source)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(Unknown Source)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(Unknown Source)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(Unknown Source)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)


I triple checked my classpath, I rebuilt my class files and guaranteed that the getter function is there (it runs fine within my actual Hibernate application). What is odd, is that when I delete the .class file, I get the exact same error. I would expect the error would change to a class not found error or something similar.

Any help is greatly appreciated.

BTW, I love the work that you guys do, and I am especially thankful that the developers are reading the forums to answer questions: But this software is really difficult to configure and non-developer friendly.

I'm no dummy; I have quite a bit of development experience (although I'm sure the impression I give off from these forum posts isn't great). I'm certainly not trying to brag, but I'm pretty sure that if I have this many problems a lot of others are as well. It would you be great if you focused on better error messages to help developers root these kind of issues out. Just a request...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 22, 2005 6:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
im sorry, but its hard to give a better error message since the issue *is* no getter found for enable in the class.

show me how you run this ? build.xml etc.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 22, 2005 6:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
oh sorry this is in eclipse!

Did you setup the classpath in the console configuration ?

Is the classes built so the .class files are there ? No compile errors etc.?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Question regarding Hibernate Tools 3.1 beta 1
PostPosted: Sat Oct 22, 2005 7:48 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
gamigin wrote:
I triple checked my classpath, I rebuilt my class files and guaranteed that the getter function is there (it runs fine within my actual Hibernate application). What is odd, is that when I delete the .class file, I get the exact same error. I would expect the error would change to a class not found error or something similar.


somewhere, there is a second .class file .


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