-->
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.  [ 9 posts ] 
Author Message
 Post subject: Problem in config.xml file
PostPosted: Tue Sep 22, 2009 8:42 am 
Newbie

Joined: Tue Sep 22, 2009 8:26 am
Posts: 4
hello everyone,

I am learning hibernate 3 and I am stuck up with very first "hello world" program. I read many tutorials and I am building one sime application (hello world) but whenever I create hibernate mapping xml file (xxx.hbm.xml) or config file (hibernate.cfg.xml) I get error as "hibernate.sourceforge.net" at <class> tag.

I am using eclipse galliloe, Mysql 5.0 and hibernate 3.3.0 for building this application.

I think there is some problem in DTD of xml files.

Here is my mapping file :

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

<hibernate-mapping>
    <class name="hibernate.tutorial.Student" table="students">
        <id name="studentId" column="student_id">
            <generator class="increment"/>
</id>


Code:
  <property name="firstName" column="first_name"/>
        <property name="lastName" column="last_name"/>
        <property name="address"/>
        <set name="courses" table="student_courses">
            <key column="student_id"/>
            <many-to-many column="course_id"
class="hibernate.tutorial.Course"/>
        </set>
    </class>
</hibernate-mapping>


I have a student.java file in hibernate.tutorial package and in same package I have kept this student.hbm.xml file.

Eclipse shows that there is error in file near <class> tag. When I hover mouse over error icon, I see error message as "hibernate.sourceforge.net".


Does anyone knows what exactly is happening? Where Am I going wrong?
If you need any further details about my program, please tell me. I will tell you more details.


Regards,


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Tue Sep 22, 2009 11:07 am 
Newbie

Joined: Thu Sep 17, 2009 9:31 am
Posts: 10
It looks like there is a problem with accessing http://hibernate.sourceforge.net/hibern ... ng-3.3.dtd. When you try to hit it with a web browser, there's a 404 error.

Try getting the mapping dtd file somewhere else (i.e. maybe with the hibernate distribution?) and referencing the local file.


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Wed Sep 23, 2009 2:28 am 
Newbie

Joined: Tue Sep 22, 2009 8:26 am
Posts: 4
Thanks for reply.

I am behind my company's proxy server. So it is possible that there is problem regarding accessing the dtd file.
As I am new to hibernate, I dont know how to map this file to something else.
Can you please tell me how to do this?


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Wed Sep 23, 2009 1:48 pm 
Newbie

Joined: Thu Sep 17, 2009 9:31 am
Posts: 10
Replace the http://hibernate.sourceforge.net/hibern ... ng-3.3.dtd with the path of the file locally. You don't have to have an absolute pathname (i.e. C:\directory\....) or something, rather you can just make the path relative to the file you're calling it from.

Making the path absolute is bad practice if there is more than one person working on the project.

See the following link (http://my.safaribooksonline.com/0321268199/ch05)

Copy the mapping file to your project somewhere. Then put the relative path to the file in there.

Hope it's clear.


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Wed Sep 23, 2009 1:50 pm 
Newbie

Joined: Thu Sep 17, 2009 9:31 am
Posts: 10
Actually, do you need to use the DVD version 3.3? Why not use 3.0?

http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd.

Try to put the link above in place of your current link, or download the file and reference the local file in your project.


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Thu Sep 24, 2009 12:09 am 
Newbie

Joined: Tue Sep 22, 2009 8:26 am
Posts: 4
Thanks for help.

I found out strange behaviour. Even though eclipse was showing the error I mentioned, I continued working on same project and finished tutorial. My application is working fine even though eclipse shows me the error.

So, I think now I can learn next part of hibernate.



Thanks a million !!!


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Thu Sep 24, 2009 7:34 am 
Regular
Regular

Joined: Fri May 22, 2009 4:50 am
Posts: 59
try clearing your project by using clean option in the project menu..

also try rewriting the class in xml file. it happens sometimes if you comment/uncomment tags in xml files.


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Thu Sep 24, 2009 8:02 am 
Newbie

Joined: Thu Sep 17, 2009 9:31 am
Posts: 10
Also, sometimes it may not be validating. Try validating the XML file if the problem occurs again.

Glad to hear it's resolved.


Top
 Profile  
 
 Post subject: Re: Problem in config.xml file
PostPosted: Thu Sep 24, 2009 8:19 am 
Newbie

Joined: Tue Sep 22, 2009 8:26 am
Posts: 4
Thank you all for helping me.


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