Announcement Announcement Module
Collapse
No announcement yet.
FileSystemXmlApplicationContext Error on IBM Java 1.4 on AIX Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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)

  • #2
    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...

    Comment


    • #3
      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

      Comment


      • #4
        well If I I took more time to read the actual JavaDocs I would see that the info is there

        Comment

        Working...
        X