-->
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.  [ 8 posts ] 
Author Message
 Post subject: Error reading resource
PostPosted: Mon Jul 19, 2004 10:50 am 
Beginner
Beginner

Joined: Mon Jul 19, 2004 4:55 am
Posts: 34
I tested hibernate with a simple example and it's run. now I try to run a web application which used hibernate with a servlet.
In Init() method, I add classes but on the fisrt adding, I have the following Exception :
Code:
javax.servlet.ServletException: Error reading resource: bll/Date_Pro_Int.hbm.xml
   servlet.Controleur.init(Controleur.java:118)
   javax.servlet.GenericServlet.init(GenericServlet.java:256)
   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
   org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
   org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
   org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
   org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
   java.lang.Thread.run(Thread.java:534)



net.sf.hibernate.MappingException: Error reading resource: bll/Date_Pro_Int.hbm.xml
   net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:354)
   servlet.Controleur.init(Controleur.java:100)
   javax.servlet.GenericServlet.init(GenericServlet.java:256)
   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
   org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
   org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
   org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
   org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
   java.lang.Thread.run(Thread.java:534)



I don't know what I have to do ..?
thanx for help me...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 3:38 pm 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
You should put the Date_Pro_Int.hbm.xml mapping file in the same place as your Date_Pro_Int.class file.

either in the same JAR file (if you put your classes in a JAR under WEB-INF/lib) or under the WEB-INF/classes path.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 3:34 am 
Beginner
Beginner

Joined: Mon Jul 19, 2004 4:55 am
Posts: 34
I did it.... I use Eclipse as IDE and hbm.xml files are put in web-inf/classes folder.
I also use Tomcat 5. Have I something special to do in tomcat to run my hibernate application?
thanx


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 3:49 am 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
Did you put hibernate jars in the WEB-INF/lib directory ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 3:53 am 
Beginner
Beginner

Joined: Mon Jul 19, 2004 4:55 am
Posts: 34
yes, all jar files are in web-inf/lib directory...
another idea?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 4:03 am 
Beginner
Beginner

Joined: Mon Jul 19, 2004 4:55 am
Posts: 34
it is my servlet code (init method) :
Code:
SessionFactory sf;
try{
Configuration cfg =new Configuration()
   .addClass(bll.Date_Pro_Int.class)
                .setProperty(Environment.HBM2DDL_AUTO, "create");

cfg.setProperty("hibernate.show_sql", "true");
sf=cfg.buildSessionFactory();
}
catch(Exception e)
{
    throw new ServletException(e);
}


is it right?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 4:05 am 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
That looks tricky.

Could also be that the file does not contain valid xml. Try to check the syntax.

If that does not help, you'll probably have to try to debug through the hibernate code. That generally provides an answer to the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 4:27 am 
Beginner
Beginner

Joined: Mon Jul 19, 2004 4:55 am
Posts: 34
thanx for your help. my xml is valid.
I try to run a very simple code umbeded in a servlet and I'll see if it run....


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