2 Replies Latest reply on Apr 4, 2006 6:54 AM by Maarten Roosendaal

    'class path resource cannot be found'-problem

    Maarten Roosendaal Newbie

      Hi,

      I have a simple EAR file with an application.xml which refers to a .sar and to a .jar (ejb) file in the EAR. I also have a lib-dir which contains all the 3rd party libs. I also have a jar which contains the Hibernate-mappings (i tried to add this to the application.xml but no luck) but on deployment is see:
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [config/applica
      tionContext-ejb.xml]: Initialization of bean failed; nested exception is java.io.FileNotFoundException: class path resource [spg-hbm.jar] cannot be re
      solved to absolute file path because it does not reside in the file system: jar:file:/C:/jboss-4.0.2/server/spg_maarten/tmp/deploy/tmp23624spg.ear!/sp
      g-hbm.jar
      java.io.FileNotFoundException: class path resource [spg-hbm.jar] cannot be resolved to absolute file path because it does not reside in the file syste
      m: jar:file:/C:/jboss-4.0.2/server/spg_maarten/tmp/deploy/tmp23624spg.ear!/spg-hbm.jar
      at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:172)
      at org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:192)
      at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:636)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1003
      )
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:348)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)

      But when i look in the ear file in the tmp directory the needed jar is right there. I tried placing the hbm files in the ear directly, in different jars, in the server/node>/lib-directory but the only things that seems to work is to create a folder in the deploy directory with a .deployer or .sar extenstion, add a META-INF folder with an empty jboss-service.xml and the spg-hbm.jar. Only then can it be found

      Does anyone have any ideas or suggestions?

      Thanks,
      Maarten