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: Error reading resource: and entity class not found:
PostPosted: Mon Aug 24, 2009 11:14 am 
Newbie

Joined: Mon Aug 24, 2009 10:45 am
Posts: 2
Hi friends,

I have a Example1.hbm.xml which is working fine.
Example1.hbm.xml

<?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 package="examples.domain">
<class name="ExamplesListDomain" table="Examples" >
<id name="exampleId" column="EXAMPLE_ID" />
<property name="exampleName" column="EXAMPLE_NAME" />
</class>
</hibernate-mapping>

I have the following entry in hibernate.cfg.xml

<mapping resource="../orm/Example1.hbm.xml"/>

Now I added newly the following
<mapping resource="../orm/Example2.hbm.xml"/>

and copied the above Example1.hbm.xml as Example2.hbm.xml
<?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 package="examples.domain">
<class name="ExamplesListDomain" table="Examples" >
<id name="exampleId" column="EXAMPLE_ID" />
<property name="exampleName" column="EXAMPLE_NAME" />
</class>
</hibernate-mapping>


I am getting the following error :
Initial SessionFactory creation failed.org.hibernate.MappingException: Error reading resource: ../orm/Example2.hbm.xml

So I removed the class tag from the following Example2.hbm.xml as
<?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 package="examples.domain">

</hibernate-mapping>

I got the below error while trying to save :
org.hibernate.MappingException: entity class not found:

Please advice.
If there is some classpath error, then why am I not getting the initial error now (after removing the class tag)

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Error reading resource: and entity class not found:
PostPosted: Mon Aug 24, 2009 11:43 am 
Beginner
Beginner

Joined: Fri Jun 26, 2009 6:59 am
Posts: 23
it doesn't seem to be classpath errors, rather that it simply cannot access the new file you created, but the probable reason why you're no longer getting the first error is because it checks for an Entity class first, errors and exits, so doesn't get around to checking if your specified resource exists.


Top
 Profile  
 
 Post subject: Re: Error reading resource: and entity class not found:
PostPosted: Mon Aug 24, 2009 11:49 am 
Newbie

Joined: Mon Aug 24, 2009 10:45 am
Posts: 2
Thanks for you reply.

If it is not classpath error, why cannot it access my new file. (It is exactly similar to my old file which is working perfectly fine). I am using Eclipse for my application.

Actually I need to work on a new DB table with new .hbm file where I was getting this kind of error.
So I copied the existing .hbm with an existing DB table to check whether I am getting the same error or not.
If I resolve this issue, I can start with my new DBtable.

Any ideas to resolve this issue...


Top
 Profile  
 
 Post subject: Re: Error reading resource: and entity class not found:
PostPosted: Wed Sep 09, 2009 2:24 pm 
Newbie

Joined: Fri May 08, 2009 10:03 am
Posts: 2
Hi there,

Have you found out anything more about this? I am having same problem where a session cannot be created because class cannot be found. I've checked and re-checked and everything looks OK. I've read numerous related posts and have not found any ideas on how to solve this or if this is a bug somewhere.

Any info either way would be great. Thanks!


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.