我正在开发一个之前由其他人开发过的 Java Web 应用程序,而这个人只是向我提供了该应用程序的源代码。问题是如果我尝试对此应用程序进行一些更改并将其部署在 tomcat (7.0.35) 上,则 JSP 不会呈现,并且我收到以下错误:
此外,我注意到没有创建此welcome.jsp 的类文件。
让应用程序正常工作的唯一方法是重新安装新版本的 tomcat,然后构建、部署和访问原始源代码。当我构建和部署该代码并访问 JSP 时,它们会正确编译,并且 .class 和 .java 文件也会在 tomcat 工作目录中创建。
在此之后,我将所有更改复制粘贴到原始源代码并重新部署修改后的应用程序,它工作正常,因为与 JSP 页面对应的类和 java 文件是在部署和访问原始应用程序后创建的。
此外,如果我尝试修改 JSP,则会开始出现相同的错误。
我不知道这里出了什么问题。如果有人可以帮我解决这个问题,那就太好了。我使用的 JDK 版本是 1.6.0_38-b05。Tomcat 也指向相同的 JDK 版本,我的计算机上没有安装任何其他版本的 JDK 或 JRE。
这是代码:
<!DOCTYPE html>
<%@page import="com.xyz.toolkit.utils.FormConstant"%>
<%@page import="org.jasig.cas.client.util.AbstractCasFilter"%>
<%@page import="org.jasig.cas.client.validation.Assertion"%>
<%@page import="org.jasig.cas.client.util.AssertionHolder"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Map"%>
<%@ taglib uri="/WEB-INF/tld/AccessValidateHandlerTag.tld" prefix="toolkit"%>
<html>
<head>
<title>ToolKit</title>
<meta http-equiv="Content-Type" content="text/html CHARSET=UTF-8" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<link href="css/jquery-ui-1.10.1.custom.css" type="text/css" rel="stylesheet" />
<link href="css/jquery.ui.tabs.css" type="text/css" rel="stylesheet" />
<link href="css/migration_toolkit.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/plugins/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/plugins/jquery.validate.js"></script>
<script type="text/javascript" src="js/plugins/jquery.dateFormat-1.0.js"></script>
<script type="text/javascript" src="js/plugins/jquery-ui-1.10.1.custom.js"> </script>
<script type="text/javascript" src="js/plugins/commons.js"></script>
<script type="text/javascript" src="js/login.js"></script>
<link href="css/jquery.jqplot.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/plugins/jquery.jqplot.js"></script>
<script type="text/javascript" src="js/plugins/jquery.blockUI.js"></script>
<script type="text/javascript" src="js/plugins/jqplot.pieRenderer.js"></script>
</head>
<%
String roleAdmin = FormConstant.ROLE_ADMIN + "," + FormConstant.ROLE_ALL;
String roleUser = FormConstant.ROLE_USER + "," + FormConstant.ROLE_ALL;
%>
<body>
<jsp:include page="header.jsp" />
<div id="tabs">
<div style="padding-bottom: 10px;">
<div id="welcome_msg">
Welcome
<%=session.getAttribute(FormConstant.USER_NAME)%>
</div>
<div id="logoutBTN">
<button id="logoutButton" onclick="javascript:loadFeedBack();">Logout</button>
</div>
</div>
<div id="feedbackForm">
<form method="POST" action="logout" class="box tableBox">
<div class="form_field">
<div class="box_body">
Thank you for using the Migration Toolkit. Please enter
any feedback you may have and tell us how you would like us to
improve the user experience.
</div>
</div>
<p style="clear: both"></p>
<div class="form_field" class="box_body">
<div class="box_body">
<label for="projectName">User Name :</label> <input type="text"
value="<%=session.getAttribute(FormConstant.USER_NAME)%>"
disabled /> <input type="hidden" name="userName" id="userName"
value="<%=session.getAttribute(FormConstant.USER_NAME)%>" />
</div>
</div>
<p style="clear: both"></p>
<div class="form_field">
<div class="box_body">
<label for="projectName">User Feedback:</label>
<textarea id="userFeedBack" name="userFeedBack"
style="width: 450px; height:250px"></textarea>
<br>
</div>
</div>
<p style="clear: both"></p>
<div class="form_field">
<div class="box_body">
<label for="submitFeedback"> </label>
<button id="submitFeedback" type="submit" style="float: right;">Submit Feedback</button>
</div>
</div>
</form>
</div>
<ul>
<toolkit:AccessValidateHandlerTag group="<%=roleAdmin%>">
<li><a href="pages/generateRule.jsp">Review & Generate
Rulesets</a></li>
</toolkit:AccessValidateHandlerTag>
<toolkit:AccessValidateHandlerTag group="<%=roleUser%>">
<li><a href="pages/codeParser.jsp">Parse a Codebase</a></li>
<li><a href="pages/reportViewer.jsp">Generate Consolidated Report</a></li>
</toolkit:AccessValidateHandlerTag>
</ul>
</div>
<jsp:include page="footer.jsp" />
</body>
</html>
这是 Tomcat 配置:使用 CATALINA_BASE:
"C:\Users\kinjal.doshi\Apache Software Foundation\Tomcat 7.0"
Using CATALINA_HOME: "C:\Users\kinjal.doshi\Apache Software Foundation\Tomcat 7.0"
Using CATALINA_TMPDIR: "C:\Users\kinjal.doshi\Apache Software Foundation\Tomcat 7.0\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.6.0_38"
Using CLASSPATH: "C:\Users\kinjal.doshi\Apache Software Foundation\Tomcat 7.0\bin\bootstrap.jar;C:\Users\kinjal.doshi\Apache Software Foundation\Tomcat 7.0\bin\tomcat-juli.jar"
Using JAVA_OPTS: " -Djava.util.logging.config.file="C:\Users\kinjal.doshi\Apache Software Foundation\Tomcat 7.0\conf\logging.properties" -XX:PermSize=256m -XX:MaxPermSize=256m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"