-->
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.  [ 2 posts ] 
Author Message
 Post subject: hibernate with tomcat: No persister for
PostPosted: Fri Feb 27, 2004 10:06 am 
Newbie

Joined: Fri Feb 27, 2004 9:53 am
Posts: 1
I'm trying to use Hibernate with Tomcat. I've got a few persistent classes located in WEB-INF/classes.

I'm using the singleton/ThreadLocal pattern. I initialize hibernate with this code in a static init method:
Code:
Properties props = new java.util.Properties();
props.load( SitecasterState.getContext().getResourceAsStream( "WEB-INF/hibernate.conf" ) );
Configuration config = new Configuration();
config.setProperties( props );
config.addDirectory( new File( SitecasterState.getContext().getRealPath( "WEB-INF/classes" ) ) );
factory = config.buildSessionFactory();

No Exceptions are thrown, I can use the config to do a succesfull SchemaExport in the same singleton.

hibernate.conf contains:
Code:
connection.datasource=jdbc/testdb
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
show_sql=false
use_outer_join=true


The problem arises when I try to use a Session. Hibernate can't find my persistent classes. It throws a MappingException, width the message: No persister for: [classname].

I've read the documentation on this issue and added <Loader delegate="false"/> to the configuration of the context. If I do a Class.forName() the persistent classes are loaded without trouble.

To me this doesn't really seem like a hibernate problem, but more like a Tomcat classloading problem.

Could anybody give me any clue on how to resolve this problem? I don't see what I'm doing different compared to the tomcat examples I've seen.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 11:31 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the log. Your classes should be mapped by Hibernate at init time.

_________________
Emmanuel


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