Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958382

Pages: 1
Anonymous
Unregistered




ClassPath conflict
      #993 - 08/13/03 12:07 PM

I have a commons.jar file which has all the utilities to do a load of xml files. When an application uses the commons.jar file to lookup a xml file that exists in the war file path ( WEB-INF/classes/config/application-desc.xml ), it throws a not found exception.

What the utility does is,
AppXmlLoader.getInputStream( CallingClass.class, config/application-desc.xml );
public static InputStream getInputStream(Class clazz, String theFile) {
InputStream stream = clazz.getResourceAsStream("/" + theFile);
return stream;
}

The same problem happens for EJB's as they are in a different classLoader.
Any Thoughts on how i can do it a different way.


Post Extras: Print Post   Remind Me!   Notify Moderator  
vlad_roubtsov
member


Reged: 06/21/03
Posts: 169
Re: ClassPath conflict [Re: Anonymous]
      #1036 - 08/14/03 07:45 PM

A lot depends on what that CallingClass.class is. If it was loaded by a classloader that is above the web classloader in the hierarchy then loading any web app resource will of course fail.

This is because Class.getResourceXXX() methods use the classloader that is the defining loader for the class they were called on, not the caller's current loader. In my article I suggest using either the thread context loader or, better yet, techniques like in Find a way out of the ClassLoader maze.

This could be quite complicated, I can't be more specific without seeing the actual code.


Post Extras: Print Post   Remind Me!   Notify Moderator  

Unregistered




how salve this error [Re: Anonymous]
      #52741 - 09/03/07 02:53 AM

The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /insert.jsp(8,0) The value for the useBean class attribute xxxx.insertbean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 4 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 15914

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5