2 Replies Latest reply on Aug 17, 2009 12:00 AM by deepak aggarwal

    Jboss 5 vfs protocol integration pain

    deepak aggarwal Newbie

      We have a web application in production that uses:
      a) jboss 4.2.1 + jdk 1.5
      b) spring 2.5.1
      c) hibernate 3.2
      d) struts2

      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. Right now it is spring which is giving the problem but I suspect that other components listed above are also going to start complaining (once I go past resolving the spring problem).

      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.

      I went through "https://jira.jboss.org/jira/browse/JBSPRING-4" and "http://jira.springframework.org/browse/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 "https://jira.jboss.org/jira/browse/JBSPRING-4" :

      <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:

      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:

      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:

      <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. Its very annoying that portability has been broken for widely used components such as spring (and possibly struts2/xworks as well) with jboss 5.

      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 any post where this problem has been reported. Even on jboss forums, a few posts report this problem, but from the context of an ejb deployment.

      Any views will be appreciated. One of the reasons to move to jboss 5.1 is that we wanted to use jdk 1.6. If vfs incompatibilities are not resolved soon, then I might try with jboss 4.2.3 instead (it officially supports jdk 1.6).