Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate w/Tomcat error reading resource

 
Levent Aksu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I am not new to Hibernate. I developed a full fat client/server application with it and Swing. Now I need to present some of the database with Tomcat.
I use the same mapping file, same classes etc.

Here is my hibernate.cfg.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:comp/env/jdbc/tima</property>
<property name="hibernate.show_sql">true</property>
<property name="dialect"> net.sf.hibernate.dialect.SybaseAnywhereDialect</property>
<mapping resource="tima.hbm.xml" />
</session-factory>
</hibernate-configuration>

net.sf.hibernate.MappingException: Error reading resource: tima.hbm.xml

both hibernate.cfg.xml and my mapping file tima.hbm.xml are under WEB-INF/classes

The problem is not that it cannot find the tima.hbm.xml file in place. Because I tried to rename it to some other thing and it is not the same error. When it cannot find the mapping file, the error becomes:

javax.servlet.ServletException: Resource: tima.hbm.xml not found

So it can find it but something ugly happens while reading it. I am sure nothing is wrong with the mapping as it is already in use by the fat client app. and it passes XML validation.

What could I be missing?
Levent
 
Levent Aksu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it by myself.
It was because it could not find my mapped classes on the classpath. I had to go into Tomcat logs to find this.
Good luck with everyone.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic