Solved

Unable to compile JSP under embedded Tomcat

Posted on 2004-08-13
13
618 Views
Last Modified: 2011-09-20
Hi,

I have a struts-based application running within embedded Tomcat - it works fine on my machine. However, when I move it to another machine and try to run it I get an error from ONE of the jsps - others run fine. The error I get is:
-----
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:83)
      org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:315)
      org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:406)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:463)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.
---------

My JSP file is:

---------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html:html locale="true">
<logic:notPresent name="vstaff" scope="application">
      <logic:redirect href="initialise.do"/>
</logic:notPresent>
<HEAD>
<%@ page
language="java"
import = "uk.co.xks.vtrack.forms.SigninForm, uk.co.xks.vtrack.forms.StaffForm, java.util.Enumeration, java.util.Vector"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
<% Vector vstaff = (Vector) getServletContext().getAttribute("vstaff"); %>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/vtrack.css" rel="stylesheet" type="text/css">
<TITLE><bean:message key="index.title"/></TITLE>
</HEAD>

<BODY>
<center>
<h4><bean:message key="index.welcome"/></h4>

<table width="100%" cellpadding="8" border="0" rules="rows" align="center">
<tr height="20"><td colspan="3"></td></tr>
<tr><td width="20%" valign="top"><html:img srcKey="image.company_logo" altKey="image.company_logo.alt"/></td>
<td align="center"><h1><bean:message key="index.signin"/></h1><h5><bean:message key="index.info"/></h5>
<html:errors/>
<html:form action="signin.do" focus="visitorName">
<table>
<tr valign="top"><td width="50%" align="right"><h3><bean:message key="index.name"/></h3></td>
<td width="50%"  align="left"><input type="text" name="visitorName" size="30" tabindex="1"></td></tr>
<tr valign="top"><td width="50%" align="right"><h3><bean:message key="index.company"/></h3></td>
<td width="50%"  align="left"><input type="text" name="companyName" size="30" tabindex="2"></td></tr>
<tr valign="top"><td width="50%" align="right"><h3><bean:message key="index.car_reg"/></h3></td>
<td width="50%"  align="left"><input type="text" name="carRegistration" size="30" tabindex="3"></td></tr>
<tr valign="top"><td width="50%" align="right"><h3><bean:message key="index.visiting"/></h3></td>
<td width="50%" align="left">
<html:select property="visitingName">
<html:options collection="vstaff" labelProperty="staffName" property="staffId"/></html:select></td></tr>
<tr align="center">
<td align="right"><html:submit><bean:message key="button.signin" /></html:submit></td>
<td align="center"><html:reset><bean:message key="button.reset" /></html:reset></td>
</tr>
</table>
</html:form>
</td><td></td></tr></table>

<table><tr height="70"><td></td></tr></table>

<table width="100%" cellpadding="8" border="0" rules="rows" align="center">
<tr align="center">
<td><h1><bean:message key="index.logout1"/> <a href="listvisitors.do"><bean:message key="index.logout2"/></a></h1></td>
</tr>
</table>

<table width="100%" border="0" rules="rows" align="center">
<tr valign="bottom">
<td align="center"><html:img srcKey="image.spare_logo1" altKey="image.spare_logo1.alt"/></td>
<td align="center"><html:img srcKey="image.spare_logo2" altKey="image.spare_logo2.alt"/></td>
<td align="center"><html:img srcKey="image.spare_logo3" altKey="image.spare_logo3.alt"/></td>
<td align="center"><html:img srcKey="image.spare_logo4" altKey="image.spare_logo4.alt"/></td>
</tr>
</table>

</BODY>
</html:html>
--------

As I said, other JSPs in the application work fine, so I ssumed it might be a typo but I've checked and checked and cannot find one (all "" ; etc are okay as far as I can tell). I've included the tools.jar in my classpath (set in a bat file when the app runs).

Does anyone have any ideas?
0
Comment
Question by:stevebeech
  • 7
  • 4
13 Comments
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11791635
Please try tomcat suggestion

>>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.

You may include this jar file to classpath or set it in bat file but it does not match exactly with what Tomcat suggest.
0
 

Author Comment

by:stevebeech
ID: 11791687
There is no /common directory in Embedded Tomcat - I've copied it to /lib but this doesn't work.

0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11791723
Do you have this directory "C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib" ?
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11791727
Or TOMCAT_HOME\common\lib

what version of tomcat are you using?
0
 

Author Comment

by:stevebeech
ID: 11791751
Its Embedded Tomcat version 5.0.25

The directory structure is:

Tomcat/
         classes
         conf
         lib
         src
         webapps
         work
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11791760
I'm 5.0.25 too but I have ?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11791765
try to reinstall with full package.
0
 

Author Comment

by:stevebeech
ID: 11791823
Are you using standard version 5.0.25 or 5.0.25-embed?

I've reinstalled this embedded version and still don't get a /common folder.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11806523
0
 

Author Comment

by:stevebeech
ID: 11808860
I think that's a different version - not the embedded one.

I've managed to solve this problem anyway - I just re-ordered some of the tags on my JSP page - moved the meta tags above the struts logic tags and it all works okay.

Thanks anyway for your help.

Steve.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11808894
That's ok :)
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 11853489
The question has been PAQ'd and the 250 points have been refunded.
RomMod
Community Support Moderator
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now