Results 1 to 7 of 7

Thread: java.lang.NoClassDefFoundError

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Angry java.lang.NoClassDefFoundError

    java.lang.NoClassDefFoundError: com/MyCompany/Beans/Crawler (wrong name: Crawler). I keep getting this error when i try and run a .jsp page. The problem stems from this line: <jsp:useBean id="craw" class="com.MyCompany.Beans.Crawler">. The line looks right to me.

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: java.lang.NoClassDefFoundError

    Are you using an IDE now? If so, try to add tools.jar to the project.


    ØØ

  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: java.lang.NoClassDefFoundError

    I went back to using notepad for now. As far as i understand it tomcat looks for classes stored in the following directory C:\Jakarta\jakarta-tomcat-5.0.28\webapps\ora\WEB-INF\classes. Im storing my classes in com\MyCompany\Beans which is off of the classes dir. So i should just have to use the latter directory path within the <jsp:useBean> tag but it doesn't work.

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: java.lang.NoClassDefFoundError

    do you add -classpath as a parameter when you compile JSP files with javac? If so, check to see that it is pointing to the right location. So it can locate the classes you need.



    ØØ

  5. #5

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: java.lang.NoClassDefFoundError

    I think -classpath can be only used when running .class files using java. C:\jdk1.5.0\bin> javac -classpath C:\; Test.java won't work. The build.xml file should give the paths where the tomcat container can find the files. Shouldn't it?

  6. #6

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: java.lang.NoClassDefFoundError

    After looking at the build.xml file i found the following line. It looks like it's telling tomcat where to find any files to run. I don't know squat about .xml so im just guessing.
    Code:
    <classpath>
      <pathelement location="${webapp.path}/WEB-INF/classes"/>

  7. #7
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: java.lang.NoClassDefFoundError

    Quote Originally Posted by Dilenger4
    I think -classpath can be only used when running .class files using java. C:\jdk1.5.0\bin> javac -classpath C:\; Test.java won't work. The build.xml file should give the paths where the tomcat container can find the files. Shouldn't it?

    You should do it when you compile servlets too, but not sure about JSP though. I am more of a pure Java langauge guy.....so I have no idea about your XML file either, but it looks like you are right about what you say.



    But then it HAS to be something with your varaibles. When I google on it I keep finding stuff like this:

    Answer
    java.lang.NoClassDefFoundError: sun/tools/javac/Main means that your classpath is not set correctly. Make sure your JAVA_HOME is set up right before you run the tomcat or startup scripts. If that doesn't do it, see these FAQ.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width