Announcement Announcement Module
Collapse
No announcement yet.
Jboss 5 vfsfile protocol problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jboss 5 vfsfile protocol problem

    We have a web application in production that uses:
    a) jboss 4.2.1
    b) spring 2.5.1
    c) hibernate 3.2

    We use ContextLoaderListener to bootstrap our application context and our app is heavily dependent on spring (bean creation, transaction management, dao classes use hibernatedaosupport, pojo based service classses) and we don't use ejb.

    We want to migrate to jdk 1.6 and jboss 5.1. While doing that, our application has stopped loading because of jboss5 vfsfile protocol. I went through JBSPRING-4 and SPR-5120 and added the jboss5-spring integration jars attached therein in my WEB-INF/lib. I also added the following to my web.xml based on the recommendation in JBSPRING-4 :

    Code:
    <context-param>
          <param-name>contextClass</param-name>
          <param-value>org.jboss.spring.factory.VFSXmlWebApplicationContext</param-value>
     </context-param>
    Despite doing all the above, I am still getting this exception:

    HTML Code:
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/ds-hibernate/applicationContext-jtads-hibernate.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [hibernate/com/dataobject] cannot be resolved to absolute file path because it does not reside in the file system: vfsfile:/D:/Programs/jboss-5.1.0/jboss-5.1.0.GA/server/default/deploy/myapp.war/WEB-INF/classes/hibernate/com/dataobject/
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    	at 
    caused by:

    Code:
    Caused by: java.io.FileNotFoundException: class path resource [hibernate/com/dataobject] cannot be resolved to absolute file path because it does not reside in the file system: vfsfile:/D:/Programs/jboss-5.1.0/jboss-5.1.0.GA/server/default/deploy/myapp.war/WEB-INF/classes/hibernate/com/dataobject/
    	at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:201)
    	at org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:175)
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:660)
    	at
    Snippet from spring applicationcontext-jta-ds.xml:

    Code:
    <bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    
    		<property name="mappingDirectoryLocations">
    			<list>
    				<value>
    					classpath:hibernate/com/dataobject
                                     </value>
    I even tried upgrading to spring 2.5.6 but no luck. I am beginning to get annoyed with jboss 5 for having broken portability with such an important component such as spring. We also use struts-2/xwork and I suspect we are going to find a similar problem there (but before i get there, i should be able to load my spring app context first )

    Am I missing anything? I am sure we are not the only ones who use spring webapplication context moving to jboss 5? I searched the spring forum and didn't find a single post where this problem has been reported.:o Even on jboss forums, a few posts report this problem, but from the context of an ejb deployment.

  • #2
    For the benefit of others, the concerns I have raised above are already addressed in jboss5 forum thread:
    Jboss 5 spring portability issue

    I am going to give it a last try using the code in:
    https://anonsvn.jboss.org/repos/jbos.../branches/1_0/

    If it doesn't work, I'm going to switch to jboss 4.2.3 which also support jdk 1.6.
    Last edited by aggarwald; Aug 17th, 2009, 12:08 AM.

    Comment


    • #3
      Hi!

      I am wondering if this is still an issue for JBoss 5?

      I have an enterprise app that we want to deploy onto JBoss 5.1, and we are running into this same issue.
      We have the current version of snowdrop-vfs (2.0.2) as a dependency, and are using Spring 3.0.5, and we are using the version of Spring built into JBoss 5 (3.3.2?).

      I saw elsewhere on these forums that there is a patch purported to fix this same issue, but when it seems to be assuming that one is using JPA to delegate to Hibernate (the patches seem to be against org.jboss.jpa.*) - and we're using Hibernate directly.

      At the moment, we have have found a workaround: we build the Hibernate session factory in our web application context, and we copy the Hibernate mapping files into the web app (/WEB-INF/classes). This seems to be exploded into a real folder/file structure, while the rest of the EAR remains zipped up - and real files seem to be acceptable.

      But we would rather not have to do this ...

      Any help?

      Thank you!

      Moises

      Comment


      • #4
        We might have figured out what the problem was, or how to fix it...

        We originally configured our hibernate session in a spring context xml file using the "mappingDirLocations" property, set to "classpath:folder" - expecting that the session would then read all hbm files in that folder. Unfortunately, it looks like Spring properly references that "class path:folder" resource using a VFS object - which does not support navigation into the folder, as hibernate attempts to do.

        The easy out is to simply change the property used to configure the hibernate session to "mappingLocations" - it requires that we list all relevant hbm files in the spring context xml file (in the form "classpath:folder/some.hbm.xml") but which can be successfully accessed by hibernate in order to initialize the session.

        Moises

        Comment

        Working...
        X