Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regadring JBoss5 Problem for VFSZIP

 
vinny kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.io.File isn't recommended with server side resources. Why don't you just do:

 
vinny kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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("")."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic