ClassNotFoundException inside jar
- From: Gaurav <gaurav1146@xxxxxxxxx>
- Date: Thu, 28 Jun 2007 18:34:27 -0000
Hi,
I have a method getData() in class DataAccess which internally calls a
method in a class inside a jar. The method inside the jar has
somehting like this:
Class.getForName("mypackage.myclass").newInstance();
The class instantiation works perfectly fine when I call getData()
from a main() method inside DataAcess. But I get a
ClassNotFoundException when I try to access the getData() method from
a web application (servlet container-Tomcat).
For the sake of debugging I added the line
Class.getForName("mypackage.myclass").newInstance(); inside the
getData() method itself. I observed there was no error when this line
was executed in getData() even when accessing the method from the
servlet.
Thus I only get the ClassNot FoundException inside the jar when I try
to access the method from the web application.
Someone suggested that this could be a classloader issue as there are
multiple classloaders in case of servlet but I am not really sure how
to resolve it.
I would be grateful if someone could provide some suggestions.
Note: The class in the jar reads the class name (mypackage.myclass)
from an XML file but I did put a debugger and observed that the
correct name was being sent to the jar.
TIA,
Gaurav
.
- Follow-Ups:
- Re: ClassNotFoundException inside jar
- From: Roedy Green
- Re: ClassNotFoundException inside jar
- From: Manish Pandit
- Re: ClassNotFoundException inside jar
- Prev by Date: Re: How to identify cyrillic characters in String?
- Next by Date: Re: Using mandatory libraries (custom class loading vs. expanding libraries)
- Previous by thread: Add certificate from web -> keystore
- Next by thread: Re: ClassNotFoundException inside jar
- Index(es):
Relevant Pages
|
|