(jsp) class loader not finding generated JSP class

Discussion in 'Java' started by unixfreak0037@gmail.com, Dec 13, 2005.

  1. Guest

    I hope my subject line is close enough. Assume a JSP file that calls a
    static function "A" on some class. "A" then goes down the stack
    looking for what class called it. It then tries to get a Class object
    for that class with forName.

    It works when the function is called from a class I create outside of
    the JSP. But when called from inside a JSP scriptlet, the className it
    finds on the stack is one (I assume is) genated by the compile from JSP
    into a Java class file, and it does not find that one. I get the
    ClassNotFound exception.

    So I guess that means the class loader can't find it, so I would then
    guess that there is more than one class loader and I'm not using the
    right one in a call to forName. Am I on the right track here?

    I'm using Tomcat 5.5.7.

    john
     
    , Dec 13, 2005
    #1
    1. Advertising

  2. wrote:
    > I hope my subject line is close enough. Assume a JSP file that calls a
    > static function "A" on some class. "A" then goes down the stack
    > looking for what class called it. It then tries to get a Class object
    > for that class with forName.
    >
    > It works when the function is called from a class I create outside of
    > the JSP. But when called from inside a JSP scriptlet, the className it
    > finds on the stack is one (I assume is) genated by the compile from JSP
    > into a Java class file, and it does not find that one. I get the
    > ClassNotFound exception.
    >
    > So I guess that means the class loader can't find it, so I would then
    > guess that there is more than one class loader and I'm not using the
    > right one in a call to forName. Am I on the right track here?


    Probably. You can check it by looking at the class loader and its
    parents, finding out where they look for classes. You should also be
    able to debug the generated jsp, to see what class loader is used there.
    How to solve the problem, I don't know. What you are trying to do is
    very strange, and it's probably related to the specific
    implementation/configuration of the server. Maybe you can add the needed
    jars/directories to the classpath. I don't know what your goal is, but I
    personally would think of a different solution.
     
    Andrea Desole, Dec 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?q?Andr=E9_Wagner?=

    Loading a class using the applet class loader

    =?iso-8859-1?q?Andr=E9_Wagner?=, May 30, 2007, in forum: Java
    Replies:
    7
    Views:
    455
    Mark Space
    May 31, 2007
  2. Karsten Wutzke
    Replies:
    0
    Views:
    400
    Karsten Wutzke
    Jun 29, 2007
  3. gorudonu
    Replies:
    0
    Views:
    1,057
    gorudonu
    Aug 5, 2010
  4. Replies:
    0
    Views:
    346
  5. Replies:
    0
    Views:
    187
Loading...

Share This Page