JSP says "Cannot find class" but the class is there!

Discussion in 'Java' started by laredotornado, May 24, 2005.

  1. Hello,
    I'm using WebLogic 5.1 sp12 on Solaris and when i try and compile a
    JSP page I get the error

    /tmp/support/jsp_servlet/_www/__listCurriculum.java:75: Class
    cms.logic.Curriculum not found.

    However, I have verified that the file "cms/logic/Curriculum.class"
    exists and that "cms" is in the classpath. The whole thing is in a jar
    file and the jar file itself is in the classpath. One thing I have
    noticied, however, is that there are other jar files in the classpath
    that contain files like


    Is the fact that "cms" is referenced at a sub-directory throwing things

    Thanks, -Dave
    laredotornado, May 24, 2005
    1. Advertisements

  2. laredotornado

    kaeli Guest

    You need the directory ABOVE cms to be in the classpath.
    For example, say I have a package foo sitting in /home/kaeli/bar.
    If I want to use that stuff, /home/kaeli/bar needs to be in the classpath,
    not /home/kaeli/bar/foo.

    kaeli, May 24, 2005
    1. Advertisements

  3. Thanks for your reply. As it happens /home/kaeli/bar/ (or the
    equivalent in my example) is in fact in the classpath and not
    /home/kaeli/bar/foo. What other possible reasons are there for this
    problem, however obscure those reasons may be?

    - Dave
    laredotornado, May 24, 2005
  4. If WebLogic can be trusted to be providing the correct error message
    (i.e. for the rootmost cause) then it is a classpath-related error --
    that's what it _means_ that the class cannot be found. Before you go
    much further, however, you should be sure *which* classpath you're
    talking about, as there may be more than one depending on how you
    compile the JSP. It looks like you're letting the JSP engine
    autocompile it, which should be fine. In that case you should have a
    jar in the webapp's WEB-INF/lib directory, and in that jar you should
    have an entry named exactly "cms/logic/Curriculum.class" that contains
    the bytecode for class cms.logic.Curriculum.class. There may also be
    other files in the same jar, of course.
    John C. Bollinger, May 24, 2005
  5. laredotornado

    kaeli Guest

    The invoking code in the JSP and a stack trace would help.

    Some random thoughts...

    Whose classpath? Yours, or the web server? It has to be the server's
    (weblogic's) classpath, not the normal environment classpath.

    Did you check case-sensitivity? Caller and class and directory must all match

    Unlikely, but see if you can tell what exactly is the process doing the
    compile and check how (i.e. whence javac and javac -version, but for the
    processes, not your login). Could be a JVM version issue where one process is
    using one version and the other, another. For example, the compiler to take
    the JSP into java uses /usr/bin/java1.2 and the one that compiles java to
    class uses /usr/local/bin/java1.4.

    Going to church doesn't make you a Christian any more than
    standing in a garage makes you a car.
    kaeli, May 24, 2005
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.