Currently, the relative path will only work if the database file absolute path is a URL (e.g. file:/com/opendemand/jdo/database.xml). One way to solve this is to convert the String to a file URL by default.
See http://bugzilla.exolab.org/show_bug.cgi?id=944 for more information. Stephen Ince wrote:
Alex,
You can use the Class.getResource(<file>) method to lookup a resource file. This will use the classpath to search for the file. Example:
String database = "mydatabase";
String databaseFile = "/com/opendemand/jdo/database.xml";
JDO jdo = new JDO();
jdo.setConfiguration( this.getClass().getResource( databaseFile ).toString() );
jdo.setDatabaseName(database);
Steve
----- Original Message -----
*From:* Bates, Alex <mailto:[EMAIL PROTECTED]>
*To:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
*Sent:* Tuesday, December 03, 2002 8:19 PM
*Subject:* [castor-dev] mapping file has to be in curr working
directory or else absolute path??
Hi,
I'm using Castor in a webapp, where I can't specify the current
working directory. The Castor configuration file has a reference to
the mapping file
<mapping href="...mymapping.xml" />
Q: does this href path have to be an absolute path??
1) I can't control current working directory since the webapp
is running in Tomcat.
2) When I used a relative path, Castor treated it as relative
to current working directory, which in Tomcat was C:\tomcat\bin\
An absolute path in this config file would make deployment very
difficult.
Cheers
Alex
--
Mickael Guessant
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
