Author
org.apache.jasper.JasperException: Unable to compile class for JSP
Lavanya Halliwell
Ranch Hand
Joined: Apr 09, 2010
Posts: 57
I am getting an error that I don't understand. I have a .war file with jsps, java beans, struts, etc.... the application works great on my sun java app server 8.2 running in my local machine. but then when I try to take it to my real server, I can deploy it and I get the error when I try to launch it. (for what it's worth I built a little "hello world" 1 JSP page .war file with no struts and it works on my real server) i'm using JDK 1.6.
Generated servlet error:
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: /generated/jsp/j2ee-modules/test/org/apache/jsp/pages/logon_jsp.java uses unchecked or unsafe operations.
Generated servlet error:
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
(after index.jsp and the initianl struts mapping to the login screen of course)
the first page is a JSP for a login screen:
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<html:html locale="true">
<head>
<title><bean:message key="logon.title" /></title>
<html:base />
</head>
<body background="Aqua_Blue.jpg" bgproperties="fixed">
<html:errors />
<logic:notPresent name="org.apache.struts.action.MESSAGE"
scope="application">
<font color="red"> ERROR: Application resources not loaded --
check servlet container logs for error messages. </font>
</logic:notPresent>
<br></br><br></br><br></br><br></br>
<table align="center" bgcolor="transparent">
<tr>
<td><FONT FACE="TIMES NEW ROMAN" SIZE="30" COLOR="black">
<p><bean:message key="logon.heading" /></p>
</FONT></td>
</tr>
</table>
<br></br>
<center>
<table align="center" bgcolor="transparent">
<tr>
<td><html:form action="/LogonSubmit" focus="username">
<table>
<tr>
<td>
<p><bean:message key="logon.message" /></p>
</td>
</tr>
<tr>
<td><bean:message key="logon.username" /></td>
<td><html:text property="username" size="16" maxlength="18" /></td>
</tr>
<tr>
<td><bean:message key="logon.password" /></td>
<td><html:password property="password" size="16" maxlength="18" redisplay="false" /></td>
</tr>
<tr>
<td> </td>
<td><html:submit property="Submit" value="Submit" /> <html:reset /></td>
</tr>
</table>
</html:form></td>
</tr>
</table>
</center>
</body>
</html:html>
it's bean is:
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.Action;
public final class LogonAction extends Action{
static String PASSWORD = "password";
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
String username = (String) PropertyUtils.getSimpleProperty(form, "username");
String password = (String) PropertyUtils.getSimpleProperty(form, "password");
ActionMessages errors = new ActionMessages();
if ( username.equals("admin") && password.equals("welcome1") ) {
request.setAttribute("fullName", "Sarah Jane");
request.setAttribute("logonID", username);
} else {
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.logon.invalid"));
}
if ( errors.isEmpty() ) {
return (mapping.findForward("success"));
} else {
this.saveErrors(request, errors);
return (mapping.findForward("failure"));
}
}
}
thanks for any tips
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56229
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
And please UseCodeTags (⇐ click this)
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
Lavanya Halliwell
Ranch Hand
Joined: Apr 09, 2010
Posts: 57
so i guess I answered my own question,
my personal sun java app server - JDK 1.6
my real sun java app server - JDK 1.5......................had to recompile everything with 1.5
also, when deploying a WAR file that uses JSPs....I learned that you have to check the "precompile JSP" option
struts doesn't seem to be the issue, but thanks for moving my question!
How does one write a blog on here? I should note down all my experiences with JSP/Struts/IDEs/java beans etc for others to see!
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted Apr 09, 2010 17:57:59
0
Lavanya Halliwell wrote: also, when deploying a WAR file that uses JSPs....I learned that you have to check the "precompile JSP" option
That's not true in general; I've rarely (ever?) deployed pre-compiled JSPs in WARs or otherwise.
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56229
Lavanya Halliwell wrote: also, when deploying a WAR file that uses JSPs....I learned that you have to check the "precompile JSP" option
Pre-compilation is never required .
struts doesn't seem to be the issue, but thanks for moving my question!
If your code contains Struts markup, posting in the general JSP forum is not appropriate. Not everyone using JSP (far from it) uses Struts.
How does one write a blog on here? I should note down all my experiences with JSP/Struts/IDEs/java beans etc for others to see!
Feel free to blog elsewhere and advertise in the Blatant Advertising forum. JavaRanch does not provide blogging space itself.
subject: org.apache.jasper.JasperException: Unable to compile class for JSP