2010-01-11 95 views
0

我在Linux中安裝了Jboss 4.0.4GA。之後我開始我的JBoss沒有問題,我想在瀏覽器訪問JSP頁面,得到了錯誤:jboss中的JSP部署問題

The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please correct the error 

and then click the Refresh button, or try again later.


A name was started with an invalid character. Error processing resource ' https://uappdev.marvell.com/login/index.jsp '. Lin...

<%@ page import="com.marvell.macroip.util.Constants" %> -^

,我找出轉換的servlet類文件不在[JBoss主] /work/jboss.web/ localhost/_/org ...目錄。 Jboss日誌文件沒有錯誤。

有人可以幫我解決這個問題嗎?我已經花了很多時間處理這個問題,但沒有運氣。

這裏是我的web.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> 
<web-app> 
    <filter> 
    <filter-name>AuthenticationFilter</filter-name> 
    <filter-class>com.marvell.macroip.web.util.AuthenticationFilter</filter-class> 
    </filter> 
    <filter-mapping> 
    <filter-name>AuthenticationFilter</filter-name> 
    <url-pattern>/extract/*</url-pattern>  
    </filter-mapping> 
    <filter-mapping> 
    <filter-name>AuthenticationFilter</filter-name>  
    <url-pattern>/admin/*</url-pattern> 
    </filter-mapping> 
    <listener> 
    <listener-class>com.marvell.macroip.web.util.PublicSessionListener</listener-class> 
    </listener> 
    <servlet> 
    <servlet-name>action</servlet-name> 
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> 
    <init-param> 
     <param-name>debug</param-name> 
     <param-value>2</param-value> 
    </init-param> 
    <init-param> 
     <param-name>config</param-name> 
     <param-value>/WEB-INF/struts-config.xml</param-value> 
    </init-param> 
    <init-param> 
     <param-name>application</param-name> 
     <param-value>com.marvell.macroip.web.ApplicationResources</param-value> 
    </init-param> 
    <init-param> 
     <param-name>detail</param-name> 
     <param-value>2</param-value> 
    </init-param> 
    <init-param> 
     <param-name>validate</param-name> 
     <param-value>true</param-value> 
    </init-param> 
    <load-on-startup>2</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
    <servlet-name>action</servlet-name> 
    <url-pattern>*.do</url-pattern> 
    </servlet-mapping> 
    <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
    <welcome-file>index.html</welcome-file> 
    </welcome-file-list> 
    <error-page> 
    <error-code>400</error-code> 
    <location>/error/index.jsp?code=400</location> 
    </error-page> 
    <error-page> 
    <error-code>401</error-code> 
    <location>/error/index.jsp?code=401</location> 
    </error-page> 
    <error-page> 
    <error-code>403</error-code> 
    <location>/error/index.jsp?code=403</location> 
    </error-page> 
    <error-page> 
    <error-code>404</error-code> 
    <location>/error/index.jsp?code=404</location> 
    </error-page> 
    <error-page> 
    <error-code>405</error-code> 
    <location>/error/index.jsp?code=405</location> 
    </error-page> 
    <error-page> 
    <error-code>408</error-code> 
    <location>/error/index.jsp?code=408</location> 
    </error-page> 
    <error-page> 
    <error-code>410</error-code> 
    <location>/error/index.jsp?code=410</location> 
    </error-page> 
    <error-page> 
    <error-code>411</error-code> 
    <location>/error/index.jsp?code=411</location> 
    </error-page> 
    <error-page> 
    <error-code>412</error-code> 
    <location>/error/index.jsp?code=412</location> 
    </error-page> 
    <error-page> 
    <error-code>413</error-code> 
    <location>/error/index.jsp?code=413</location> 
    </error-page> 
    <error-page> 
    <error-code>414</error-code> 
    <location>/error/index.jsp?code=414</location> 
    </error-page> 
    <error-page> 
    <error-code>415</error-code> 
    <location>/error/index.jsp?code=415</location> 
    </error-page> 
    <error-page> 
    <error-code>500</error-code> 
    <location>/error/index.jsp?code=500</location> 
    </error-page> 
    <error-page> 
    <error-code>501</error-code> 
    <location>/error/index.jsp?code=501</location> 
    </error-page> 
    <error-page> 
    <error-code>502</error-code> 
    <location>/error/index.jsp?code=502</location> 
    </error-page> 
    <error-page> 
    <error-code>503</error-code> 
    <location>/error/index.jsp?code=503</location> 
    </error-page> 
    <error-page> 
    <error-code>506</error-code> 
    <location>/error/index.jsp?code=506</location> 
    </error-page> 
    <taglib> 
    <taglib-uri>/WEB-INF/for-loop.tld</taglib-uri> 
    <taglib-location>/WEB-INF/for-loop.tld</taglib-location> 
    </taglib> 
    <taglib> 
    <taglib-uri>/WEB-INF/root.tld</taglib-uri> 
    <taglib-location>/WEB-INF/root.tld</taglib-location> 
    </taglib> 
    <taglib> 
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> 
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> 
    </taglib> 
    <taglib> 
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri> 
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location> 
    </taglib> 
    <taglib> 
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> 
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location> 
    </taglib> 
    <taglib> 
    <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri> 
    <taglib-location>/WEB-INF/struts-nested.tld</taglib-location> 
    </taglib> 
    <security-constraint> 
    <display-name>MacroIP Login</display-name> 
    <web-resource-collection> 
     <web-resource-name>MacroIP Login</web-resource-name> 
     <url-pattern>/login/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
    </security-constraint> 
    <security-constraint> 
    <display-name>Extract</display-name> 
    <web-resource-collection> 
     <web-resource-name>Extract</web-resource-name> 
     <url-pattern>/extract/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
    </security-constraint> 
    <security-constraint> 
    <display-name>Admin</display-name> 
    <web-resource-collection> 
     <web-resource-name>Admin</web-resource-name> 
     <url-pattern>/admin/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
    </security-constraint> 
</web-app> 

jsp頁面:

<?xml version="1.0" encoding="iso-8859-1"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<%@ page import="com.marvell.macroip.util.Constants" %> 
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> 
<%@ taglib uri="/WEB-INF/logic-ext.tld" prefix="logic-ext" %> 
<bean:parameter id="logout" name="logout" value="false"/> 

<html> 
<head> 
<title>Tracking System</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<script language="JavaScript" type="text/JavaScript" src="/includes/imgChange.js"></script> 
<script language="JavaScript" type="text/JavaScript" src="/includes/css_bCheck.js"></script> 
<script language="javascript" type="text/javascript" src="/includes/sifr.js">// flash insert code</script> 
</head> 

<body bgcolor="#eeeeee" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> 
       <table width="470" border="0" cellspacing="0" cellpadding="0"> 
        <tr valign="middle"> 
<td align="right" bgcolor="#ebebeb" class="smallgrey"><span class="red">*</span>User Name &nbsp;</td> 
        <td> 
<html:text property="userName" styleClass="formElement" size="29" disabled="false" style="width:290px"/> 
        </td> 
       </tr> 

       <tr valign="middle"> 
        <td align="right" bgcolor="#ebebeb" class="smallgrey"><span class="red">*</span>Password&nbsp;</td> 
        <td> 
        <html:password property="password" maxlength="35" redisplay="false" styleClass="formElement" size="29" disabled="false" style="width:290px"/> 
        </td> 
       </tr> 
       </table> 

       <table width="440" border="0" cellspacing="0" cellpadding="0"> 

       <tr> 
        <td align="right"> 
        <input type="image" alt="Submit" border="0" /> 
        </td>       
       </tr> 
       </table> 

,如果我嘗試這個jsp頁面,這將是空白頁或顯示原來的JSP代碼在瀏覽器中。

<html><head><title>JSP Test</title> 
    <%! 
    String message = "Hello, World."; 
    %> 
    </head> 
    <body> 
    <h2><%= message%></h2> 
    <%= new java.util.Date() %> 
    </body></html> 
+0

您確定您已安裝jdk,以便JBoss可以編譯JSP嗎? (不知道這是什麼原因) – 2010-01-11 23:11:29

+0

Tomcat + JBoss不再使用javac來編譯JSP,它們在內部執行 – skaffman 2010-01-11 23:18:36

+0

是的,對,JBoss捆綁了Tomcat 5.5。我錯誤地認爲它是Tomcat 5.0。感謝您指出了這一點。 – 2010-01-11 23:30:44

回答

0

現在的問題是,JSP並沒有按預期編譯或執行。

負責此事的人是在servlet容器的web.xml中配置的JspServlet。對於JBoss AS,這是Tomcat及其默認位於Tomcat安裝的/conf文件夾中的web.xml。其必須包含在同一servlet-name上的org.apache.jasper.servlet.JspServlet<servlet-mapping>的有效(即未未註釋的)<servlet>定義以及*.jspurl-pattern。驗證一切是否正確。

另一個原因可能是該web應用本身(一個在/WEB-INF文件夾)的web.xml有另一個FilterServlet完全一樣url-patternJspServlet(因此被覆蓋它),但是這並非如此在判斷你發佈的web.xml之後。

+0

謝謝!我確實發現在jbossweb-tomcat55.sar/conf/web.xml中有一個地方是「取消註釋使用jdk1.5」,我從Iam使用jdk 1.5.0_16開始取消註釋。但重新啓動jboss後仍然有同樣的問題。它是不是jboss 4.0.4ga不能與jdk 1.5一起使用? – mengmenger 2010-01-12 06:14:46

+0

我還檢查了org.apache.jasper.servlet.JspServlet的定義以及* .jsp的url-pattern。它在那裏。 – mengmenger 2010-01-12 06:49:47

1

我確實找到了解決方案。根據jsight所說的「是的,我認爲它是內部的......我只是想知道apache-> jboss過程(或其他)是否實際上並未觸及你認爲它的頁面,例如,你會看到這樣的問題,如果Apache服務的頁面本身(錯誤配置的Apache),而不是重定向到JBoss。或者如果你打的東西以外的.jsp(一些其他排列的網址) - jsight「

我發現它應該是apache + ssl,試圖通過自己來解析jsp,而不是將jsp請求傳遞給jboss。然後我的同事,我發現mod_jk沒有在Apache中正確加載。因此,在加載到httpd.conf文件中的mod-jk.conf後面添加「JkMountCopy ALL」。並重新啓動Apache,瞧...它的工作!