Results 1 to 4 of 4

Thread: FileSystemXmlApplicationContext Error on IBM Java 1.4 on AIX

  1. #1
    Join Date
    Aug 2004
    Location
    Vermont
    Posts
    27

    Default FileSystemXmlApplicationContext Error on IBM Java 1.4 on AIX

    I'm seeing some strang behavior when running my application on AIX 5.2 using IBM's Java 1.4 or 1.3 VM.

    I use the FileSystemXmlApplicationContext container and use the single String constructor. I am passing a string that is an absolute path to my bean def file. The problem is the container can never find the file. The path to the file seems to always have the leading '/' removed and my guess is it is trying to load it as a relative path from my working directory.

    My code works fine on windows so this makes me think it is either an AIX problem or an IBM java VM problem. Anyone seen anything like this before?

    here is my program's log output

    String to pass to FileSystemXmlApplication Constructor is /dmiw/dvengine/dmiw/active/config/DMIWUserEmailListApp.xml
    current working dir is /dmiw/dvengine/dmiw/HEAD/Install_Image/bin
    [INFO] XmlBeanDefinitionReader - Loading XML bean definitions from file [/dmiw/dvengine/dmiw/HEAD/Install_Image/bin/dmiw/dvengine/dmiw/active/config/DMIWUserEmailListApp.xml]
    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from file [/dmiw/dvengine/dmiw/HEAD/Install_Image/bin/dmiw/dvengine/dmiw/active/config/DMIWUserEmailListApp.xml]; nested exception is java.io.FileNotFoundException: dmiw/dvengine/dmiw/active/config/DMIWUserEmailListApp.xml (A file or directory in the path name does not exist.)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:144)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:83)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:101)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:69)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:87)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:262)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:82)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:67)
    at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:58)
    David Noel

  2. #2
    Join Date
    Aug 2004
    Location
    Toulouse, France
    Posts
    148

    Default

    Absolute filename access is bad and spring doesn't encourage you to do so by making your filename relative by stripping the leading /
    now, it works on windows because of their filename notation, beginning with a letter.
    At this point, I suggest some things : either you put your configuration into your classpath and use the adapted applicationContext (I prefer this one usually) or you only need a bean factory and you jump on the xmlBeanFactory with the ressource constructor (the ressource can be made from a File, hence using an absolute filename), eventually you can to make the absolute filename relative to your current location or such and keep using the fileSystemXmlApplicationContext...
    Olivier

  3. #3
    Join Date
    Aug 2004
    Location
    Vermont
    Posts
    27

    Default

    Thanks for the response Olivier. I do agree that using absolute paths is not the greatest thing to do but my current environment requires it. Putting the config file in the classpath or as a resource in a jar is not an option for me either. The xmlBeanFactory does not really do what I want. Granted I can "cd" to the directory that contains the config files before I start the app but I feel that is just a work around to my problem.

    Either way I feel this is a bug in Spring. Either it should support absoulte file names or the JavaDocs should state that they are not supported.

    Another thing... if I pass a string like "//tmp/myBeans.xml" to the constructor it works
    David Noel

  4. #4
    Join Date
    Aug 2004
    Location
    Vermont
    Posts
    27

    Default

    well If I I took more time to read the actual JavaDocs I would see that the info is there
    David Noel

Similar Threads

  1. Bizzare ClassLoader issue in Java WebStart?
    By timothygordon32 in forum Container
    Replies: 1
    Last Post: Sep 6th, 2005, 05:19 AM
  2. Replies: 1
    Last Post: May 18th, 2005, 02:10 PM
  3. Dilemma: Write code in Java or glue in Spring?
    By Alarmnummer in forum Container
    Replies: 5
    Last Post: May 4th, 2005, 08:01 AM
  4. Replies: 5
    Last Post: Mar 2nd, 2005, 07:11 AM
  5. Replies: 0
    Last Post: Jan 26th, 2005, 01:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •