Anonymous
Unregistered
|
|
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
Reged: 06/21/03
Posts: 169
|
|
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.
|
Unregistered
|
|
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)
|