• 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

InputStream null

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am running some tests to migrate my application from Jboss 4 to Jboss 5. I'm having some issues with the line:



It's working on Jboss 4, in Jboss 5 I get a NullPointerException.

Can you guys give me some help on why this would happen? Thank you.

 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please confirm that there really is a path to the Jasper Reports, and that the class you are loading actually exists (it must do, or you would have an earlier and different error/exception). Does the Exception occur on that line or on a subsequent line?
 
Deam Lucca Trevisan Dornelles
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your welcome.

This is the code:



And the exception occurs in this line:



But only because the inputStream is null.

What I don't understand is why the same thing works on Jboss 4 and doesn't on Jboss 5. Maybe it's a configuration issue in Eclipse?
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please add a line 2½
System.out.println(inputStream);
There are two or three other things which might be null in your line 2. You need confirmation of what is null.
 
Deam Lucca Trevisan Dornelles
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already debugged, the only parameter null is the inputStream.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Referring to the JavaDocs for ClassLoader we see that:

getResourceAsStream() returns null if the resource can not be found.

 
Deam Lucca Trevisan Dornelles
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:Referring to the JavaDocs for ClassLoader we see that:

getResourceAsStream() returns null if the resource can not be found.



Hello William

Obviously the resource can be found, considering that the same lines of code are working on Jboss 4, but when you run the application on Jboss 5, the very same application, it does not work.

Anyways, thank you all for your help, I'll keep trying to figure what is wrong.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps the class (and resource) loading mechanism has changed significantly between JBoss 4 and 5. Can you show where the class files and reports are located inside your application?
 
Deam Lucca Trevisan Dornelles
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:Perhaps the class (and resource) loading mechanism has changed significantly between JBoss 4 and 5. Can you show where the class files and reports are located inside your application?



Like this:

application
|
-----Java Resources
|
----------context/WEB-INF-src
|
--------------package
|
----------------------classes

-----context
|
----------reports
|
--------------jasper
|
----------------------jasper reports
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic