You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Erin O'Neill <eo...@stanford.edu> on 2004/03/18 19:10:08 UTC

error running JSP Config on tomcat examples - tomcat 5.0.19

Hello all -
I'm new to setting up a tomcat server. I was asked to install tomcat 5. I 
can get a stand alone tomcat server up and running but some of the examples 
fail. Particulars of my system:

Tomcat/5.0.18  (I've got t.0.19 running??)
Apache/2.0.48
JVM  version:  1.4.2_03-b02
Solaris 2.8

I use a shell script to start up tomcat. The env vars are:
CATALINA_HOME=/usr/local/tomcat;export CATALINA_HOME
JAVA_HOME=/usr/j2se;export JAVA_HOME

(I also tried setting JAVA_HOME to point to the symlink /usr/java which 
points to /usr/j2se but it gave me the same error).

(on tomcat-users it was recommended to add the CLASSPATH)
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$DAEMON_HOME/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
export CLASSPATH

I added a PATH
PATH=\
/usr/java/bin:/usr/local/bin:\
/usr/sbin:/usr/bin:/usr/local/tomcat/bin:\
/usr/local/mysql/bin:/usr/ccs/bin:
export PATH

The error message is:

description The server encountered an internal error () that prevented it 
from fulfilling this request.

exception
org.apache.jasper.JasperException: Unable to compile class for JSP

No Java compiler was found to compile the generated source for the JSP.
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar 
from the JDK
to the common/lib directory of the Tomcat server, followed by a Tomcat 
restart.
If using an alternate Java compiler, please check its installation and 
access path.



org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

In the catalina.out log I see this error:
Mar 18, 2004 9:58:46 AM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Javac exception
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK


BUT the javac compiler is in the CLASSPATH AND the PATH?? Do I need to set 
this up elsewhere? JAVA_HOME is also set up??

I know this is something simple, but for some reason I can see it.

thanks,
erin

Re: error running JSP Config on tomcat examples - tomcat 5.0.19

Posted by Erin O'Neill <eo...@stanford.edu>.
I found out what my configuration error was! I'm sending it to this list so 
if another newbie has problems they might google out this answer! :)

(I really hate it when someone just replies to the list -- oh never mind I 
got it! and then doesn't give the answer!)

I found this link:
http://johnturner.com/howto/apache2-tomcat4127-jk-rh9-howto.html
AND even though it was for Tomcat 4 and linux I figured it might have *the* 
answer for me. It did.

I needed to run tomcat as the tomcat user (this involved changing the 
ownership of the tomcat directory & files as I'd already set it up as 
root). While the ENV variables were being set in the /etc/init.d/tomcat 
script and EXPORTED -- they weren't making it to catalina.sh. I explicitly 
set JAVA_HOME, CLASSPATH, PATH in setclasspath.sh.

CLASSPATH is set thusly in setclasspath.sh:
CLASSPATH="$JAVA_HOME"/lib/tools.jar

It seems to add to the already setup CLASSPATH in the startup script.  PATH 
needed to include $JAVA_HOME/bin, $CATALINA_HOME/bin and $JRE_HOME/bin. 
Suddenly the java compiler was found!

Now I'm on to my next error in the jsp examples (repeat tag):
  StandardWrapperValve[org.apache.jsp.jsp2.simpletag.repeat_jsp]: Servlet.serv
ice() for servlet org.apache.jsp.jsp2.simpletag.repeat_jsp threw exception
java.lang.NoSuchFieldError: _jspx_page_context

Do I need to add a jar file to my CLASSPATH?

thanks all!

erin


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: error running JSP Config on tomcat examples - tomcat 5.0.19

Posted by todd runstein <to...@yahoo.com>.
Erin,

Thank you!  Your post looks a lot like mine, which
gave me an idea.  The "Unable to compile class for
JSP" has only shown up for me in version 5.0.19.

I switched to tomcat 5.0.16 and the problem is gone. 
Trying switching to a different version of tomcat and
see if the problem disappears for you too.  Maybe
there's something in 5.0.19 that's messed up. 

Todd


--- Erin O'Neill <eo...@stanford.edu> wrote:
> Thanks for your input. I've already checked what
> version of java I've got:
> 
>  > $JAVA_HOME/bin/java -version
> java version "1.4.2_03"
> Java(TM) 2 Runtime Environment, Standard Edition
> (build 1.4.2_03-b02)
> Java HotSpot(TM) Client VM (build 1.4.2_03-b02,
> mixed mode)
> 
> My first impulse was that I was missing the java
> compiler but it's there:
>  >  ls $JAVA_HOME/bin/javac
> /usr/java/bin/javac
> 
> I have a startup script in /etc/init.d. In that
> script I set up a number of 
> ENV vars, including JAVA_HOME, CLASSPATH, PATH. I
> have both the catalina.sh 
> & the setclasspath.sh echo what those variables hold
> (after I found that 
> setclasspath reset the CLASSPATH to something
> limited I commented out that 
> line).
> 
> When I google for this problem, the hints are that
> either the java version 
> and the tomcat version are not compatible OR the
> CLASSPATH is lacking some 
> jar file....
> 
> My CLASSPATH has this:
>
/usr/java/lib/tools.jar:/usr/jre/lib:/usr/local/tomcat/bin/commons-daemon.jar:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.19/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.19/bin/commons-logging-api.jar:/usr/local/jakarta-tomcat-5.0.19/common/lib/servlet-api.jar:/usr/local/jakarta-tomcat-5.0.19/common/lib/jsp-api.jar
> 
> Am I missing some important Sun Java classpath? I
> have the general jre/lib 
> directory but should I point to a special jar file?
> Do I need more than the 
> tools.jar file in the /usr/java/lib in my
> CLASSPATH??
> 
> I have a symlink set up so that /usr/java points to
> /usr/java -> 
> /usr/j2se  and /usr/jre --> j2re1.4.2_04.
> 
> Should I NOT use symlinks??
> 
> Any other suggestions?
> 
> thanks all!
> 
> erin
> 
> At 08:59 PM 3/22/2004 -0600, you wrote:
> >On Mon, Mar 22, 2004 at 02:20:03PM -0800, Erin
> O'Neill wrote:
> >: My error message says this (in a small part):
> >: org.apache.jasper.JasperException: Unable to
> compile class for JSP
> >
> >Two gut feelings strike me:
> >
> >1/ the Java you have installed, what version is it?
>  You said you
> >have 1.4.x, but which one is Tomcat calling?
> >
> >         ${JAVA_HOME}/bin/java -version
> >
> >Back in the day, and perhaps still, Solaris shipped
> with Java version
> >1.2 in /usr/bin.
> >
> >
> >2/  JDK or JRE?  -as in, do you have
> >
> >         ${JAVA_HOME}/bin/javac
> >
> >If this is still a no-go for you, I'll think it
> over when I'm awake. ;)
> >-QM
> >
> >--
> >
> >software  -- http://www.brandxdev.net
> >tech news -- http://www.RoarNetworX.com
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 

=====
The only "dumb question" is the one you were too afraid to ask.
________________________________________

Check out RouteRuler - Free software for runners, cyclists, walkers, etc.
http://routeruler.sourceforge.net
________________________________________

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: error running JSP Config on tomcat examples - tomcat 5.0.19

Posted by Erin O'Neill <eo...@stanford.edu>.
Thanks for your input. I've already checked what version of java I've got:

 > $JAVA_HOME/bin/java -version
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

My first impulse was that I was missing the java compiler but it's there:
 >  ls $JAVA_HOME/bin/javac
/usr/java/bin/javac

I have a startup script in /etc/init.d. In that script I set up a number of 
ENV vars, including JAVA_HOME, CLASSPATH, PATH. I have both the catalina.sh 
& the setclasspath.sh echo what those variables hold (after I found that 
setclasspath reset the CLASSPATH to something limited I commented out that 
line).

When I google for this problem, the hints are that either the java version 
and the tomcat version are not compatible OR the CLASSPATH is lacking some 
jar file....

My CLASSPATH has this:
/usr/java/lib/tools.jar:/usr/jre/lib:/usr/local/tomcat/bin/commons-daemon.jar:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.19/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.19/bin/commons-logging-api.jar:/usr/local/jakarta-tomcat-5.0.19/common/lib/servlet-api.jar:/usr/local/jakarta-tomcat-5.0.19/common/lib/jsp-api.jar

Am I missing some important Sun Java classpath? I have the general jre/lib 
directory but should I point to a special jar file? Do I need more than the 
tools.jar file in the /usr/java/lib in my CLASSPATH??

I have a symlink set up so that /usr/java points to /usr/java -> 
/usr/j2se  and /usr/jre --> j2re1.4.2_04.

Should I NOT use symlinks??

Any other suggestions?

thanks all!

erin

At 08:59 PM 3/22/2004 -0600, you wrote:
>On Mon, Mar 22, 2004 at 02:20:03PM -0800, Erin O'Neill wrote:
>: My error message says this (in a small part):
>: org.apache.jasper.JasperException: Unable to compile class for JSP
>
>Two gut feelings strike me:
>
>1/ the Java you have installed, what version is it?  You said you
>have 1.4.x, but which one is Tomcat calling?
>
>         ${JAVA_HOME}/bin/java -version
>
>Back in the day, and perhaps still, Solaris shipped with Java version
>1.2 in /usr/bin.
>
>
>2/  JDK or JRE?  -as in, do you have
>
>         ${JAVA_HOME}/bin/javac
>
>If this is still a no-go for you, I'll think it over when I'm awake. ;)
>-QM
>
>--
>
>software  -- http://www.brandxdev.net
>tech news -- http://www.RoarNetworX.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: error running JSP Config on tomcat examples - tomcat 5.0.19

Posted by QM <qm...@brandxdev.net>.
On Mon, Mar 22, 2004 at 02:20:03PM -0800, Erin O'Neill wrote:
: My error message says this (in a small part):
: org.apache.jasper.JasperException: Unable to compile class for JSP

Two gut feelings strike me:

1/ the Java you have installed, what version is it?  You said you
have 1.4.x, but which one is Tomcat calling?

	${JAVA_HOME}/bin/java -version

Back in the day, and perhaps still, Solaris shipped with Java version
1.2 in /usr/bin.


2/  JDK or JRE?  -as in, do you have

	${JAVA_HOME}/bin/javac

If this is still a no-go for you, I'll think it over when I'm awake. ;)
-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: error running JSP Config on tomcat examples - tomcat 5.0.19

Posted by Erin O'Neill <eo...@stanford.edu>.
I probably didn't supply enough info as I haven't received any responses. I 
have googled this error and tried everything that I could find.

Details:
Tomcat 5.0.19
OS: Solaris 2.8 (with the latest J2SEE OS patches)
Apache: 2.0.48
Java: (build 1.4.2_03-b02, mixed mode)


My error message says this (in a small part):
org.apache.jasper.JasperException: Unable to compile class for JSP

This is when I try to run the jsp2 example JSP Configuration. I can find 
the class file here:

/usr/local/jakarta-tomcat-5.0.19/webapps/jsp-examples/WEB-INF/classes/org/apache/jsp/jsp2/misc/config_jsp.class

This same error is occurring when I try to run our app which worked under 
Tomcat 4.

And even though someone here said NOT to copy over the 
$JAVA_HOME/lib/tools.jar into the common/lib for tomcat -- I did as per the 
error message. Then stopped and started tomcat. I continue to get the same 
error.

It's been my experience with other UNIX apps that when an app is called for 
and can not be found I have a PATH problem. So I added to the tomcat 
start-up script the following ENV VARS:
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar
export CLASSPATH

PATH=\
/usr/java/bin:/usr/local/bin:\
/usr/sbin:/usr/bin:/usr/local/tomcat/bin:\
/usr/local/mysql/bin:/usr/ccs/bin:
export PATH

Then I added to the catalina.sh the following:
echo "Using CLASSPATH:       $CLASSPATH"
echo "Using PATH:       $PATH"


And to the setclasspath.sh
#CLASSPATH="$JAVA_HOME"/lib/tools.jar  <-- commented this out to keep the 
classpath I set in the startup script.
echo "Using CLASSPATH in setclasspath.sh:       $CLASSPATH"


Started and stopped tomcat & I see this:
Using CLASSPATH in 
setclasspath.sh: 
/usr/java/lib/tools.jar:/usr/local/tomcat/bin/commons-daemon.jar:/usr/local/tomcat/bin/bootstrap.jar
Using CATALINA_BASE:   /usr/local/jakarta-tomcat-5.0.19
Using CATALINA_HOME:   /usr/local/jakarta-tomcat-5.0.19
Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-5.0.19/temp
Using JAVA_HOME:       /usr/java
Using 
CLASSPATH: 
/usr/java/lib/tools.jar:/usr/local/tomcat/bin/commons-daemon.jar:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.19/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.19/bin/commons-logging-api.jar
Using 
PATH: 
/usr/java/bin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/tomcat/bin:/usr/local/mysql/bin:/usr/ccs/bin:

It looks like the $JAVA_HOME/bin directory is being accessed. So, do I have 
the wrong java installed?

I've been here:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/ and tried the suggestions.

When I goggle the only reoccurring answer is that the jdk version & tomcat 
version are not compatible. True?  I thought Tomcat 5 needed this version 
of jdk?

Suggestions?

thanks,
erin


At 10:10 AM 3/18/2004 -0800, Erin O'Neill wrote:
>Hello all -
>I'm new to setting up a tomcat server. I was asked to install tomcat 5. I 
>can get a stand alone tomcat server up and running but some of the 
>examples fail. Particulars of my system:
>
>Tomcat/5.0.18  (I've got t.0.19 running??)
>Apache/2.0.48
>JVM  version:  1.4.2_03-b02
>Solaris 2.8
>
>I use a shell script to start up tomcat. The env vars are:
>CATALINA_HOME=/usr/local/tomcat;export CATALINA_HOME
>JAVA_HOME=/usr/j2se;export JAVA_HOME
>
>(I also tried setting JAVA_HOME to point to the symlink /usr/java which 
>points to /usr/j2se but it gave me the same error).
>
>(on tomcat-users it was recommended to add the CLASSPATH)
>CLASSPATH=\
>$JAVA_HOME/lib/tools.jar:\
>$DAEMON_HOME/commons-daemon.jar:\
>$CATALINA_HOME/bin/bootstrap.jar
>export CLASSPATH
>
>I added a PATH
>PATH=\
>/usr/java/bin:/usr/local/bin:\
>/usr/sbin:/usr/bin:/usr/local/tomcat/bin:\
>/usr/local/mysql/bin:/usr/ccs/bin:
>export PATH
>
>The error message is:
>
>description The server encountered an internal error () that prevented it 
>from fulfilling this request.
>
>exception
>org.apache.jasper.JasperException: Unable to compile class for JSP
>
>No Java compiler was found to compile the generated source for the JSP.
>This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar 
>from the JDK
>to the common/lib directory of the Tomcat server, followed by a Tomcat 
>restart.
>If using an alternate Java compiler, please check its installation and 
>access path.
>
>
>
>org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
> 
>org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
>         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
>         org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
>         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
> 
>org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
> 
>org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
> 
>org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
>         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
>         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>
>In the catalina.out log I see this error:
>Mar 18, 2004 9:58:46 AM org.apache.jasper.compiler.Compiler generateClass
>SEVERE: Javac exception
>Unable to find a javac compiler;
>com.sun.tools.javac.Main is not on the classpath.
>Perhaps JAVA_HOME does not point to the JDK
>
>
>BUT the javac compiler is in the CLASSPATH AND the PATH?? Do I need to set 
>this up elsewhere? JAVA_HOME is also set up??
>
>I know this is something simple, but for some reason I can see it.
>
>thanks,
>erin


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org