"No context factory" exception thrown when using JBoss' VFS
I am trying to get a ressource contained in a JAR file . This Jar is used as a dependancy of a web projet MyWebApp. I am using JBOSS 5.1.0
The code in the jar file is :
// MyClass Class
// part of myFunction
...
Enumeration<URL> configEnum;
configEnum = this.getClass().getClassLoader().getResources("MyFile");
while (configEnum.hasMoreElements()) {
URL configURL = configEnum.nextElement();
VirtualFile file = VFS.getRoot(configURL);
...开发者_StackOverflow中文版
but when I import this jar in a web application (myWebApp) and I use this function, I get an Exception :
java.io.IOException: No context factory for vfszip:/...PATH.../MyWebApp.war/WEB-INF/lib/MyJar.jar/my/resources/path/
at org.jboss.virtual.VFS.getVFS(VFS.java:129)
If someone knows how to fix that it would be very usefull.
I found what the problem was. I wasn't using the same version of org.jboss.virtual.VirtualFile in my jar and on the server (found that when i got :
"can not cast org.jboss.virtual.VirtualFile into org.jboss.virtual.VirtualFile )
Hope it would be usefull for someone.
精彩评论