-->
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.  [ 7 posts ] 
Author Message
 Post subject: DTD config for Linux and Windows
PostPosted: Thu Jul 14, 2005 2:53 pm 
Beginner
Beginner

Joined: Wed May 18, 2005 9:48 am
Posts: 31
Hi all,

I have one question. I have no connection to internet for server that have the application and i want to know if there is any posible to read mapping dtd file from anywhere in your webapplication project. I mean, if I have in windows (Where I have netbeans) and I put in code for example "C:\...\hibernate-mapping-3.0.dtd" this not work on linux.

Is there any possible to have this for all platforms?.

Thanks


Top
 Profile  
 
 Post subject: Re: DTD config for Linux and Windows
PostPosted: Thu Jul 14, 2005 3:23 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
ljpaff wrote:
... and I put in code for example "C:\...\hibernate-mapping-3.0.dtd" this not work on linux.


I'm not sure what you mean by this, but Hibernate reads the DTD as a resource from inside the Hibernate jar. As far as I know, you shouldn't need to do anything to get it to work without an internet connection.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 5:57 am 
Regular
Regular

Joined: Wed Feb 02, 2005 6:33 am
Posts: 70
As nathanmoon said, hibernate uses it's own entity reolver on deploy, so the only time you're probably going to the internet for the DTD is in your editor/ide.

Most advanced editors will allow you to specify an 'XML Catalog', look in the editor/ide help files for this, or use google.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 9:05 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
I had problems with that too.

The DTD resolving is done in:

org.hibernate.util.DTDEntityResolver.resolveEntity

hope this helps.


Top
 Profile  
 
 Post subject: Re: DTD config for Linux and Windows
PostPosted: Thu Aug 04, 2005 12:49 pm 
Beginner
Beginner

Joined: Wed Aug 11, 2004 3:50 pm
Posts: 26
nathanmoon wrote:
ljpaff wrote:
... and I put in code for example "C:\...\hibernate-mapping-3.0.dtd" this not work on linux.


I'm not sure what you mean by this, but Hibernate reads the DTD as a resource from inside the Hibernate jar. As far as I know, you shouldn't need to do anything to get it to work without an internet connection.


Answer and further question:

The .hbm.xml files require (or used to require - clarification please) a clause like:

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

or, if you don't want to use the internet you can place the physical DTDs in the server classpath with:

<!DOCTYPE hibernate-mapping SYSTEM "hibernate-mapping-2.0.dtd" >

And the obvious "further question":

How do I place the files in my WAR so that it does not rely on either the internet or the physical architecture of the machine?

(i.e.: with jBoss, in Windows you can put them in jboss/bin, but in Linux the DTDs have to be on the folder you execute "run" from - a pain if you are using /etc/init.d to start at boot - very bad place for DTDs).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 05, 2005 5:49 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Hi,

my previous posting is perhaps misleading.
In nearly all cases the standard mechanism
is working quiet well. For example
the standard mapping file header:

Code:
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


Hibernate is not loading http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd
via internet. Instead it loads hibernate-mapping-3.0.dtd
via classpath from the hibernate.jar. This should work
on the server too.

to bmelloni: please check the version numbers.
If you use hibernate3 the header should look like the one above.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 05, 2005 8:27 am 
Beginner
Beginner

Joined: Wed Aug 11, 2004 3:50 pm
Posts: 26
thanks steckemetz,

We had the right DTD name for the version in use, but there is a little known dependency that was breaking the behavior for us:

The XML parser must be "recent enough". Once I used Xerces 2.4.0, everything started working even with the original http-based DOCTYPE.


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