java.io.FileNotFoundException: class path resource [com/my/data] cannot be re solved to absolute file path because it does not reside in the file system: jar:file:/C:/jboss-4.0.1 sp1/server/default/tmp/deploy/tmp13967my.ear-contents/my-server.jar!/com/my/data

Spring JIRA | Andreas Schildbach | 1 decade ago
  1. 0

    When I use the "classpath:" syntax, for example in <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="mappingDirectoryLocations"> <list> <value>classpath:/com/my/data</value> </list> </property> </bean> the following exception is raised when I run the application from the jar (e.g. deploy it to JBoss as EAR): org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ry' defined in ServletContext resource [/WEB-INF/classes/com/bmw/tw2/server/hibernateContext.xml]: I nitialization of bean failed; nested exception is java.io.FileNotFoundException: class path resource [com/my/data] cannot be resolved to absolute file path because it does not r eside in the file system: jar:file:/C:/jboss-4.0.1sp1/server/default/tmp/deploy/tmp13967my .ear-contents/my-server.jar!/com/my/data java.io.FileNotFoundException: class path resource [com/my/data] cannot be re solved to absolute file path because it does not reside in the file system: jar:file:/C:/jboss-4.0.1 sp1/server/default/tmp/deploy/tmp13967my.ear-contents/my-server.jar!/com/my/data at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:172) at org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:154) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessio nFactoryBean.java:487) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe thods(AbstractAutowireCapableBeanFactory.java:1077) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A bstractAutowireCapableBeanFactory.java:347) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A bstractAutowireCapableBeanFactory.java:255) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory .java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory .java:145) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingle tons(DefaultListableBeanFactory.java:285) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicatio nContext.java:317) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh( AbstractRefreshableWebApplicationContext.java:131) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.j ava:224) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.jav a:150) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderLis tener.java:48) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343) I can't see why this should not work, as classpaths can point inside JAR files AFAIK.

    Spring JIRA | 1 decade ago | Andreas Schildbach
    java.io.FileNotFoundException: class path resource [com/my/data] cannot be re solved to absolute file path because it does not reside in the file system: jar:file:/C:/jboss-4.0.1 sp1/server/default/tmp/deploy/tmp13967my.ear-contents/my-server.jar!/com/my/data
  2. 0

    When I use the "classpath:" syntax, for example in <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="mappingDirectoryLocations"> <list> <value>classpath:/com/my/data</value> </list> </property> </bean> the following exception is raised when I run the application from the jar (e.g. deploy it to JBoss as EAR): org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ry' defined in ServletContext resource [/WEB-INF/classes/com/bmw/tw2/server/hibernateContext.xml]: I nitialization of bean failed; nested exception is java.io.FileNotFoundException: class path resource [com/my/data] cannot be resolved to absolute file path because it does not r eside in the file system: jar:file:/C:/jboss-4.0.1sp1/server/default/tmp/deploy/tmp13967my .ear-contents/my-server.jar!/com/my/data java.io.FileNotFoundException: class path resource [com/my/data] cannot be re solved to absolute file path because it does not reside in the file system: jar:file:/C:/jboss-4.0.1 sp1/server/default/tmp/deploy/tmp13967my.ear-contents/my-server.jar!/com/my/data at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:172) at org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:154) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessio nFactoryBean.java:487) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe thods(AbstractAutowireCapableBeanFactory.java:1077) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A bstractAutowireCapableBeanFactory.java:347) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A bstractAutowireCapableBeanFactory.java:255) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory .java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory .java:145) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingle tons(DefaultListableBeanFactory.java:285) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicatio nContext.java:317) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh( AbstractRefreshableWebApplicationContext.java:131) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.j ava:224) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.jav a:150) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderLis tener.java:48) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343) I can't see why this should not work, as classpaths can point inside JAR files AFAIK.

    Spring JIRA | 1 decade ago | Andreas Schildbach
    java.io.FileNotFoundException: class path resource [com/my/data] cannot be re solved to absolute file path because it does not reside in the file system: jar:file:/C:/jboss-4.0.1 sp1/server/default/tmp/deploy/tmp13967my.ear-contents/my-server.jar!/com/my/data
  3. 0

    ClassPathResource.getFile() throws FileNotFoundException within WAR

    Stack Overflow | 6 years ago | Tapas Bose
    java.io.FileNotFoundException: class path resource [ems-init.properties] cannot be resolved to absolute file path because it does not reside in the file system: vfs:/home/tanmoy/JBoss/jboss-as-distribution-6.0.0.Final/server/default/deploy/EMS.war/WEB-INF/classes/ems-init.properties
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    get File from JAR

    Stack Overflow | 6 years ago | Dónal
    java.io.FileNotFoundException: class path resource [META-INF/foo/file.txt] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/D:/m2repo/uic-3.2.6-0.jar!/META-INF/foo/file.txt
  6. 0

    GRAILS-307: Stack traces when using domainObject.validate() in tests

    GitHub | 1 decade ago | graemerocher
    java.io.FileNotFoundException: class path resource [WEB-INF/grails-app/i18n/messages_en_GB.xml] cannot be resolved to URL because it does not exist

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.FileNotFoundException

      class path resource [com/my/data] cannot be re solved to absolute file path because it does not reside in the file system: jar:file:/C:/jboss-4.0.1 sp1/server/default/tmp/deploy/tmp13967my.ear-contents/my-server.jar!/com/my/data

      at org.springframework.util.ResourceUtils.getFile()
    2. Spring Core
      ClassPathResource.getFile
      1. org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:172)
      2. org.springframework.core.io.ClassPathResource.getFile(ClassPathResource.java:154)
      2 frames
    3. Hibernate
      LocalSessionFactoryBean.afterPropertiesSet
      1. org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:487)
      1 frame
    4. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1077)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:347)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:255)
      4. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:221)
      5. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
      6. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
      6 frames
    5. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
      1 frame
    6. Spring
      ContextLoaderListener.contextInitialized
      1. org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131)
      2. org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:224)
      3. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:150)
      4. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
      4 frames
    7. Glassfish Core
      StandardContext.start
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
      2. org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
      2 frames