簡體   English   中英

JBoss中的JSP部署問題

[英]JSP deploy problem in jboss

我在Linux中安裝了Jboss 4.0.4GA。 毫無問題地啟動我的jboss之后,我嘗試在瀏覽器中訪問JSP頁面,出現錯誤:

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

然后單擊刷新按鈕,或稍后再試。


名稱以無效字符開頭。 處理資源' https://uappdev.marvell.com/login/index.jsp '時出錯。 林...

<%@頁面import =“ com.marvell.macroip.util.Constants”%>-^

並且我發現轉換后的servlets類文件不在[jboss home] /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>

我確實找到了解決方案。 從jsight所說:“是的,我認為這是內部的……我只是想知道apache-> jboss進程(或其他)是否實際上沒有到達您認為是的頁面。例如,如果apache本身提供頁面(錯誤配置的apache)而不是重定向到jboss,則可能會看到這樣的問題。或者可能是您遇到了.jsp之外的其他內容(URL的其他排列)。– jsight。

我發現應該是apache + ssl嘗試自行解決jsp,而不是將jsp請求傳遞給jboss。 然后我的同事和我發現mod_jk沒有在Apache中正確加載。 因此,在httpd.conf文件中加載的mod-jk.conf之后立即添加“ JkMountCopy ALL”。 並重新啟動Apache,瞧……。

問題在於,JSP並未按預期進行編譯或執行。

負責此工作的是JspServlet ,它在servlet容器的web.xml中配置。 如果是JBoss AS,則為Tomcat,默認情況下,其web.xml位於Tomcat安裝的/conf文件夾中。 必須包含org.apache.jasper.servlet.JspServlet的有效(即不被注釋)的<servlet>定義,以及在同一servlet-name上的<servlet-mapping>以及*.jspurl-pattern 驗證是否正確。

另一個原因可能是該Web應用程序本身的web.xml/WEB-INF文件夾中的那個)在與JspServlet完全相同的url-pattern上具有另一個FilterServlet (因此將其覆蓋),但這是在判斷您發布的web.xml之后情況並非如此。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM