**DONOTDELETE**
(Unregistered)
08/13/03 12:07 PM
ClassPath conflict

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.


vlad_roubtsov
(member)
08/14/03 07:45 PM
Re: ClassPath conflict

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.


**DONOTDELETE**
(Unregistered)
09/03/07 02:53 AM
how salve this error

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)



Contact us JavaWorld

Powered by UBB.threads™ 6.5.5

Featured White Papers


RESEARCH CENTERS: Java Standard Edition | Java Enterprise Edition | Java Micro Edition | Development Tools
About Us | Advertise | Contact Us | Terms of Service/Privacy
Copyright, 2006-2008 Network World, Inc. All rights reserved.