• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regadring JBoss5 Problem for VFSZIP

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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("")."
 
Goodbye moon men. Hello tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic