JSP编译问题 [英] JSP Compilation Issue

查看:55
本文介绍了JSP编译问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Java Web应用程序,该Web应用程序之前已经由其他人处理过,而这个人只是向我提供了该应用程序的源代码.问题是,如果我尝试对此应用程序进行一些更改并将其部署在tomcat(7.0.35)上,则JSP不会呈现,并且出现以下错误:

I am working on a Java web application that was worked upon by somebody else earlier and this person just provided me the source code of the application. The problem is if I try to make some changes to this application and deploy it on tomcat (7.0.35) the JSPs do not render and I get the following error:

此外,我注意到未创建此welcome.jsp的类文件.

Additionally, I notice that the class file for this welcome.jsp is not created.

我可以使该应用程序正常运行的唯一方法是重新安装新版本的tomcat,然后构建,部署和访问原始源代码.当我构建和部署该代码并访问JSP时,它们会正确编译,并且还会在tomcat工作目录中创建.class和.java文件.

The only way I can get the app working is re-installing new version of tomcat and then building, deploying and accessing the original source code. When I build and deploy that code, and access the JSPs they compile properly and also .class and .java files get created in the tomcat work directory.

此后,我将所有更改复制粘贴到原始源代码中,然后重新部署修改后的应用程序,由于在部署和访问原始应用程序后创建了与JSP页面相对应的类和Java文件,因此它可以正常工作.

After this I copy paste all my changes to the original source code and redeploy the modified app and it works fine because the class and java files corresponding to the JSP pages were created after deploying and accessing the original application.

此外,如果我尝试修改JSP,也会出现相同的错误.

Also, if I try to modify the JSPs, the same error starts appearing.

我不知道这里出了什么问题,如果有人可以帮助我,那将是很棒的.我正在使用的JDK版本是1.6.0_38-b05. Tomcat也指向相同的JDK版本,并且我的计算机上没有安装任何其他版本的JDK或JRE.

I have no clue what is going wrong here.It would be great if some one can please help me with this. The JDK version that I am using is 1.6.0_38-b05. Tomcat also points to the same JDK version and I do not have any other version of JDK or JRE installed on my computer.

这是代码:

    <!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">&nbsp;</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 Config:使用CATALINA_BASE:

Here is the Tomcat Config:Using 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"

推荐答案

您正在使用JspC从旧版本的Tomcat中预编译JSP,并尝试在新版本中运行它们.通常,来自一个主要版本Tomcat的JspC可以与来自相同主要版本的任何其他发行版一起使用,但是不能保证.为了确保正确编译,您需要使用与打算在同一版本的Tomcat上使用的JspC.

You are precompiling your JSPs using JspC from an old version of Tomcat and trying to run them on a newer version. Generally JspC from one major version of Tomcat will work with any other release from the same major version but that isn't guaranteed. To be sure of correct compilation, you need to use JspC from the same version of Tomcat as you intend to run on.

这篇关于JSP编译问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆