View Full Version : Initialising resource from relative filename
ptah
Aug 25th, 2004, 05:18 AM
Basically, I need to initialise a LocalSessionFactoryBean using it's mappingJarLocations property. I find using a url of the file:// scheme works if I specify an absolute path to the jar. I need to specify a relative path though. I am unable to figure out what the pathname needs to be relative to to find the jar though. Can anyone help?
Thanks in advance.
Juergen Hoeller
Aug 25th, 2004, 07:15 AM
Simply use a relative path like "/WEB-INF/mypath": The application context will automatically convert this to a context-relative resource. In case of a web app (XmlWebApplicationContext), this will be relative to the web app root. In case of a standalone app, it will either be relative to the VM execution directory (FileSystemXmlApplicationContext) or relative to the classpath root (ClassPathXmlApplicationContext).
Juergen
ptah
Aug 25th, 2004, 07:43 AM
And if I am using ContextSingletonBeanFactoryLocator to get a handle to the applicationcontext?
ptah
Aug 25th, 2004, 10:04 AM
Ahhh...solved it... it turns out the directory the jar is in should be on the classpath.
8)
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.