Re: ClassNotFoundException inside jar
- From: Gaurav <gaurav1146@xxxxxxxxx>
- Date: Thu, 28 Jun 2007 19:35:34 -0000
Tha jar is in thw WEB-INF/lib folder. I am not getting classNotFound
for the jar. But inside the class in jar there is a line
Class.getForName("mypackage.myclass").newInstance();
and it is for mypackage.myclass that I get a ClassNotFoundException.
mypackage.myclass resides under WEB-INF/lib.
Regards,
Gaurav
On Jun 28, 11:49 pm, Manish Pandit <pandit.man...@xxxxxxxxx> wrote:
On Jun 28, 11:34 am, Gaurav <gaurav1...@xxxxxxxxx> wrote:
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
Can you try putting the jar file in the WEB-INF/lib folder of your
webapp?
-cheers,
Manish
.
- Follow-Ups:
- Re: ClassNotFoundException inside jar
- From: Manish Pandit
- Re: ClassNotFoundException inside jar
- References:
- ClassNotFoundException inside jar
- From: Gaurav
- Re: ClassNotFoundException inside jar
- From: Manish Pandit
- ClassNotFoundException inside jar
- Prev by Date: Re: How to identify cyrillic characters in String?
- Next by Date: Re: Anonymous class - I don't know how to...
- Previous by thread: Re: ClassNotFoundException inside jar
- Next by thread: Re: ClassNotFoundException inside jar
- Index(es):
Relevant Pages
|
|