aspose file tools*
The moose likes JBoss/WildFly and the fly likes Regadring JBoss5 Problem for VFSZIP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Regadring JBoss5 Problem for VFSZIP" Watch "Regadring JBoss5 Problem for VFSZIP" New topic
Author

Regadring JBoss5 Problem for VFSZIP

vinny kumar
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Dear All,

Please solve Jboss5 Problem Regarding VFS(Virtual File System)

My Application Code:-

URL url = getClass().getClassLoader().getResource("com/test/ticketTemplate.tpl");
URLConnection objJarURLConnection = url.openConnection();
URI uri=url.toURI();
File file=new File(uri);
System.out.println("Step 3 ");
fileStream = new FileInputStream(file);
byte[] b = new byte[fileStream.available()];
fileStream.read(b);


above code executing sucessfull Jbos4.0.5Ga whenever we are deployed Jboss5.0.1Ga at the time we will get this error

"URI scheme is not "file""

Server Console:-

19:11:17,296 INFO [STDOUT] vfszip:/E:/jboss-5.0.1.GA/server/all/deploy/T
estFileWeb.war/WEB-INF/classes/com/test/ticketTemplate.tpl
19:11:17,296 INFO [STDOUT] uri:--> /E:/jboss-5.0.1.GA/server/all/deploy/TestFil
eWeb.war/WEB-INF/classes/com/test/ticketTemplate.tpl


Please tell me what'is the Problem aln also explain VFSZIP


Thanks&Regards
Vinaya

19:11:17,296 INFO [STDOUT] Exception URI scheme is not "file"
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

java.io.File isn't recommended with server side resources. Why don't you just do:



[My Blog] [JavaRanch Journal]
vinny kumar
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Dear Sir,

Thanks for your Replay,

InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("com/testticketTemplate.tpl");

whenver i am executing above code i got the NullPointer Exception,

Thanks&Regards
Vinaya Kumar
Sergiu Dumitriu
Greenhorn

Joined: Feb 01, 2011
Posts: 1
Jaikiran Pai wrote:java.io.File isn't recommended with server side resources. Why don't you just do:



And what to do in case I'm interested in all resources for that name? There's no equivalent for this:

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

For each of those URLs, you can do http://download.oracle.com/javase/1.5.0/docs/api/java/net/URL.html#openStream%28%29
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Hi there, if it is not yet resolved then just try getting the class loader from the current thread. I faced a similar problem with getResourceAsStream while migrating from 3.2.6 to 5.1.0. It worked for me though, not so sure in your case, sorry if i waste your time. Use somthing like this "Thread.currentThread().getContextClassLoader().getResourceAsStream("")."


Have Fun with Java
little,little.. little by little makes a lot..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regadring JBoss5 Problem for VFSZIP