Click to See Complete Forum and Search --> : org.apache.jasper.JasperException: Unable to compile class for JSP
Dillinger4
Mar 15th, 2005, 07:43 PM
I've been trying to run this jsp page i have which uses a bean. Everytime i run the jsp page a get an error "unable to compile class" Is there anyway i can fix this? Thanks
Dillinger4
Mar 15th, 2005, 08:58 PM
I found this. http://www.coreservlets.com/Apache-Tomcat-Tutorial/ and followed number 3. I took the classes out of the development directory C:\Jakarta\jakarta-tomcat-5.0.28\webapps\ora\WEB-INF\classes and put them in C:\JavaBeans, set the class path in the autpexec.bat file to @SET CLASSPATH=C:\JavaBeans and added the package directory to the top of my bean. ie package JavaBeans; and i still have the same problem :confused: I am using the following tag in the jsp page. <jsp:useBean id = "testbean" class = "TestBean"/>
Dillinger4
Mar 16th, 2005, 11:45 AM
I just created this directory structure classes\com\MyCompany\Beans, dumped my beans in there and added package com.MyCompany.Beans; to the top of them. Seems to work. Why i can't get them to run just in the classes directory i havent a clue.
CornedBee
Mar 16th, 2005, 04:41 PM
Because of the way Java looks for classes.
(Side note: naming convention says that package names are always all lowercase.)
If you have a class called com.cornedbee.beans.CacaoBean, Java will look for the file CacaoBean.class, running a little loop like this:
$file = null;
for each path in $used_class_path do
if exists $path/com/cornedbee/beans/CacaoBean.class then
$file = $path/com/cornedbee/beans/CacaoBean.class
fi
done
if $file == null then throw ClassDefNotFoundError
In addition to this, web containers don't seem to like beans without a package name. No idea why.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.