-->
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: Accessing configuration and mapping files on the classpath
PostPosted: Sun Dec 19, 2004 1:13 pm 
Newbie

Joined: Sun Dec 19, 2004 12:48 pm
Posts: 3
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate configuration DTD/EN" "http://hibernate.sf.net/hibernate-configuration-2.0.dtd">

hibernate manual says that it checks the classpath first for the DTD file. This is not happening. I've tried every combination of paths and using SYSTEM instead of PUBLIC.
It will work with a full URL i.e. HTTP://localhost/blah or FILE://c:/blah
But i can't get it to access the hibernate-configuration-2.0.dtd on the classpath.
I have also tried the latest Dom4j1-4.jar to no success.

Any ideas?


Top
 Profile  
 
 Post subject: solved!
PostPosted: Mon Dec 20, 2004 9:03 am 
Newbie

Joined: Sun Dec 19, 2004 12:48 pm
Posts: 3
I have solved my own problem

DTDEntityResolver:

private static final String URL = "http://hibernate.sourceforge.net/";

public InputSource resolveEntity (String publicId, String systemId) {
if ( systemId!=null && systemId.startsWith(URL) ) {
log.debug("trying to locate " + systemId + " in classpath under net/sf/hibernate/");
// Search for DTD
ClassLoader classLoader = this.getClass().getClassLoader();
InputStream dtdStream = classLoader.getResourceAsStream( "net/sf/hibernate/" + systemId.substring( URL.length() ) );


specifically uses string "http://hibernate.sourceforge.net/";

I was using "http://hibernate.sf.net/";

Therfore can access the internet but no on the classpath.

Darren.


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.