aspose file tools*
The moose likes JSP and the fly likes java.lang.Class NotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "java.lang.Class NotFoundException" Watch "java.lang.Class NotFoundException" New topic
Author

java.lang.Class NotFoundException

Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169

That's where the error comes from. I'm trying to use JSP to connect to my DB. The connection line doesn't appear to give any errors, but it is tough to tell since this line doesn't work... without this line I get a connection problem anyways because this line isn't there.
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
I have used practically identicle code in Java Apps before and it worked without a problem. I am new to JSP in general, but regular pages do work. This is the exception I "out.print" to the screen upon connection try failure.
I am running the most recent version of Tomcat as my JSP server on a Windows 2000 machine.
I also have classes12.zip in the Tomcat/common/lib directory as well as added it to my CLASSPATH in the Environmental Variables even though, from all the searches I have done, the most recent version of Tomcat does not even use the system CLASSPATH anymore. But figured it couldn't hurt.
Any help would be greatly appreciated, I am doing this on the side but I must be missing something.
I am attempting to connect to an Oracle 9i database.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Try renaming the file to classes12.jar
The classloader won't look in .zip files, only jars.
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Same error... doesn't seem to have helped renaming it to .jar instead of .zip.
Btw, I also put the .jar into my CLASSPATH anyways, just in case by some fluke it decided to use it.
[ December 09, 2002: Message edited by: Jeff Grant ]
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
I found out you cannot just simply rename a .zip to a .jar. So I unzipped it and then jar'd it up using jar.exe with the tags c, v, and s.
Still no luck.
Michael Zalewski
Ranch Hand

Joined: Apr 23, 2002
Posts: 168
Put classes12.zip into your WEB-INF/lib directory. (Or into your .war file at that spot).
Alternatively, you can add it to Tomcat's classpath by sticking it into tomcat.bat (tomcat.sh, Catalina.bat... whatever it is depends on your version of tomcat and platform).
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
Originally posted by Michael Zalewski:
Put classes12.zip into your WEB-INF/lib directory. (Or into your .war file at that spot).
Alternatively, you can add it to Tomcat's classpath by sticking it into tomcat.bat (tomcat.sh, Catalina.bat... whatever it is depends on your version of tomcat and platform).

Tried it... no luck, stuck it in Catalina.bat. Next idea?
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
I figured it out.
The only reply I got was all that helped me. Come on guys, where were you?!
Anyways, turned out I had a bunch of things wrong with my Tomcat setup. I did have to unzip then jar the Classes12.zip for use with Tomcat.
I also tried the %CATALINA_HOME%\bin\setclasspath.bat from the command prompt and saw it had many errors in it.
Firstly, I had my JAVA_HOME pointing to a Java directory, but it did not contain all the exe's which setclasspath.bat was looking for.
I also did not have the variable BASEDIR defined in my Environmental Variables... causing setclasspath.bat to end early.
From here, it still did not work, but at least my startup of Tomcat was no longer giving errors.
I tried changing the classpath in setclasspath.bat to include the newly created Classes12.jar. But that still did not help.
Come to find out, you don't need to set any classpath differently, just place the file you want included inside the %CATALINA_HOME%\shared\lib folder.
Worked like a charm from there!
Now I haven't had a chance to actually run a query. But I think the tough part is over with.. I hope this thread helps someone else by the listing of my trials and errors.
[ December 10, 2002: Message edited by: Jeff Grant ]
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
By the way. Messing around with the setclasspath.bat might have been completely unnecessary if I had placed the Classes12.jar in the proper directory to begin with. But the way I see it, fixing it now will probably have saved me many headaches once my JSP program got to be longer than 20 lines.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.Class NotFoundException