0 Replies Latest reply on Mar 6, 2013 8:09 AM by cbw

    Reading a file from WEB-INF/classes; VFS?

    cbw Newbie

      Hi,

      I am trying to read the contents of a file from a folder in my eclipse maven project (src/main/resources). The file gets built into WEB-INF/classes in the war and deployed to my JBoss AS7 instance.

      I have been trying to access the file from the classpath. getClass().getResource() or getResourceAsStream() however it returns a location that does not exist, C:\windows\system32\content...WEB-INF/classes. As you might expect my file does not exist at this location. I have been reading about snowdrop and have added;

      <init-param>

      <param-name>contextClass</param-name>

      <param-value>org.jboss.spring.vfs.contextVFSXmlWebApplicationContext</param-value>

      </init-param>

      ...to my servlet declaration in web.xml in an atempt to get vfs working.

      I have then tried using VirtualFile vf = VFS.getChild(filename) to obtain the file with no luck. The file is not found.

      Is there an easy way to read a file from within the application when using Spring on JBoss???

      Any help would be appreciated,

      Thanks.