Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Loading a file with classloader in WebSphere v5.1

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're having problems to load an XSL from and EJB using standard classloader method :
InputStream is = ClassLoader.getSystemResourceAsStream("org/xxx/myxsl.xsl");
Is there any special manner to do this in WebSphere v5.1 ?
Thanks in advance.
--
Martin
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the problem? Are you getting an exception? If so what? We can't help you if you don't give us any more information...
Kyle
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response.
Yes, of course, I can put the name of the exception, is very known.
NullPointerException. It's thrown because getSystemResource() can't find the xsl file. Also, you can be sure that the xsl file is within the .jar file. The code works without any problem outside of WebSphere Application Server.
Thanks
Martin
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using a class that is in the same package as the xsl file, e.g.
theClass.class.getResourseAsStream("a.xsl")
../Melogy
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to look at your classloader policy and make sure the app has access to the jar file where it is loaded. I would try changing your server application classloader policy through the admin console from module to application.
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic