2016-05-16 40 views
0

我正在經歷這個舊應用程序的大規模遷移。它使用JSF1.2,Seam 2.2和Richfaces 2.x.我們將它遷移到JSF 2.1,Seam 2.3和Richfaces 4.x.遷移後,我無法加載任何CSS或JS。Uncaught ReferenceError:RichFaces未定義Richfaces 3.x到4.x

我已經得到了來自螢火蟲這樣的錯誤:

orderForm.seam:9 Uncaught ReferenceError: jQuery is not defined(anonymous function) @ orderForm.seam:9 orderForm.seam:17 Uncaught ReferenceError: RichFaces is not defined

這裏是我的模板XHTML(編輯替換爲名稱的src屬性):

<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:a4j="http://richfaces.org/a4j" 
    xmlns:rich="http://richfaces.org/rich" 
    xmlns:s="http://jboss.org/schema/seam/taglib"> 


<h:head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title>company name</title> 
    <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico" /> 
    <h:outputStylesheet name="/private/stylesheet/theme.xcss" /> 
<h:outputStylesheet name="/private/stylesheet/default.css" /> 
<h:outputStylesheet name="/private/stylesheet/CalendarControl.css" /> 
<h:outputStylesheet name="/private/stylesheet/theme.css" /> 
<h:outputScript name="/private/js/jquery.js" /> 
<h:outputScript name="/private/js/idle-timer.js" /> 
<h:outputScript name="/private/js/jquery.formatCurrency.js" /> 
<h:outputScript name="/private/js/CalendarControl.js" /> 
</h:head> 
<body> 
    <ui:insert name="head" /> 
    <script type="text/javascript"> 
     jQuery.noConflict(); 
    </script> 

    <rich:popupPanel style="background-color: white;" id="eula" 
     autosized="true" width="500" moveable="false" resizeable="false"> 
     <f:facet name="header"> 
      <h:outputText value="Eula" /> 
     </f:facet> 
     <center> 
      <iframe src="eula.html" 
       style="height: 410px; width: 500px; overflow: auto; border: 1px solid #666; padding: 8px;" /> 
      <h:form> 
       <h:commandButton action="#{identity.logout()}" value="I Decline" /> 
       <h:commandButton action="#{authenticator.markEulaAgreed()}" 
        value="I Accept" /> 
      </h:form> 
     </center> 
    </rich:popupPanel> 



</body> 
</html> 

,我試圖簡化儘可能多組成來跟蹤問題如此:

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:s="http://jboss.org/schema/seam/taglib" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:a="http://agilers.com/taglib" 
    xmlns:rich="http://richfaces.org/rich" 
    xmlns:a4j="http://richfaces.org/a4j" 
    template="layout/2columns-even.xhtml"> 



</ui:composition> 

這裏是web.xml:

<?xml version="1.0" ?> 
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
    version="3.0"> 

    <session-config> 
     <cookie-config> 
      <http-only>true</http-only> 
     </cookie-config> 
    </session-config> 


    <!-- RichFaces --> 
    <context-param> 
     <param-name>org.richfaces.skin</param-name> 
     <param-value>DEFAULT</param-value> 
    </context-param> 

    <!-- Suppress spurious stylesheets --> 
    <context-param> 
     <param-name>org.richfaces.enableControlSkinning</param-name> 
     <param-value>false</param-value> 
    </context-param> 

    <context-param> 
     <param-name>org.richfaces.enableControlSkinningClasses</param-name> 
     <param-value>false</param-value> 
    </context-param> 

    <!-- Change load strategy to DEFAULT to disable sending scripts/styles as 
     packs --> 
    <context-param> 
     <param-name>org.richfaces.resourceOptimization.enabled</param-name> 
     <param-value>false</param-value> 
    </context-param> 


    <error-page> 
     <error-code>400</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>401</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>402</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>403</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>404</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>405</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>406</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>407</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>408</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>409</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>410</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>411</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>412</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>413</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>414</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>415</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>416</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>417</error-code> 
     <location>/Error404.html</location> 
    </error-page> 
    <error-page> 
     <error-code>500</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>501</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>502</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>503</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>504</error-code> 
     <location>/index.html</location> 
    </error-page> 
    <error-page> 
     <error-code>505</error-code> 
     <location>/index.html</location> 
    </error-page> 




    <context-param> 
     <description>CAS renew</description> 
     <param-name>renew</param-name> 
     <param-value>false</param-value> 
    </context-param> 
    <context-param> 
     <param-name>facelets.LIBRARIES</param-name> 
     <param-value>/WEB-INF/taglib/company.taglib.xml</param-value> 
    </context-param> 

    <filter> 
     <display-name>HSTS Filter</display-name> 
     <filter-name>HSTSFilter</filter-name> 
     <filter-class>com.company.filter.HSTSFilter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>HSTSFilter</filter-name> 
     <url-pattern>*</url-pattern> 
     <dispatcher>REQUEST</dispatcher> 
    </filter-mapping> 

    <filter> 
     <display-name>IE9 Filter</display-name> 
     <filter-name>ie9filter</filter-name> 
     <filter-class>com.company.filter.IE9Filter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>ie9filter</filter-name> 
     <url-pattern>*</url-pattern> 
     <dispatcher>REQUEST</dispatcher> 
    </filter-mapping> 
    <filter> 
     <filter-name>SessionIdFilter</filter-name> 
     <filter-class>com.company.filter.SessionIdFilter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>SessionIdFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <filter> 
     <filter-name>CAS Authentication Filter</filter-name> 
     <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> 
     <init-param> 
      <param-name>casServerLoginUrl</param-name> 
      <param-value>https://www.company.com/login/login</param-value> 
     </init-param> 
     <init-param> 
      <param-name>serverName</param-name> 
      <param-value>https://www.company.com</param-value> 
     </init-param> 
    </filter> 
    <filter> 
     <filter-name>CAS Validation Filter</filter-name> 
     <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class> 
     <init-param> 
      <param-name>casServerUrlPrefix</param-name> 
      <param-value>https://www.company.com/login</param-value> 
     </init-param> 
     <init-param> 
      <param-name>redirectAfterValidation</param-name> 
      <param-value>true</param-value> 
     </init-param> 
     <init-param> 
      <param-name>serverName</param-name> 
      <param-value>https://www.company.com</param-value> 
     </init-param> 
    </filter> 
    <filter> 
     <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name> 
     <filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class> 
    </filter> 
    <filter> 
     <filter-name>CAS Assertion Thread Local Filter</filter-name> 
     <filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class> 
    </filter> 
    <filter> 
     <filter-name>CAS Single Sign Out Filter</filter-name> 
     <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>CAS Single Sign Out Filter</filter-name> 
     <url-pattern>/private/*</url-pattern> 
    </filter-mapping> 
    <filter-mapping> 
     <filter-name>CAS Authentication Filter</filter-name> 
     <url-pattern>/private/*</url-pattern> 
    </filter-mapping> 
    <filter-mapping> 
     <filter-name>CAS Validation Filter</filter-name> 
     <url-pattern>/private/*</url-pattern> 
    </filter-mapping> 
    <filter-mapping> 
     <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name> 
     <url-pattern>/private/*</url-pattern> 
    </filter-mapping> 
    <filter-mapping> 
     <filter-name>CAS Assertion Thread Local Filter</filter-name> 
     <url-pattern>/private/*</url-pattern> 
    </filter-mapping> 
    <listener> 
     <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class> 
    </listener> 
    <listener> 
     <listener-class>org.jboss.seam.servlet.SeamListener</listener-class> 
    </listener> 
    <listener> 
     <listener-class>com.company.servlet.SessionServletListener</listener-class> 
    </listener> 
    <filter> 
     <filter-name>Seam Filter</filter-name> 
     <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> 
     <init-param> 
      <param-name>createTempFiles</param-name> 
      <param-value>false</param-value> 
     </init-param> 
     <init-param> 
      <param-name>maxRequestSize</param-name> 
      <param-value>1000000</param-value> 
     </init-param> 
    </filter> 
    <filter-mapping> 
     <filter-name>Seam Filter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <servlet> 
     <servlet-name>Seam Resource Servlet</servlet-name> 
     <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>Seam Resource Servlet</servlet-name> 
     <url-pattern>/seam/resource/*</url-pattern> 
    </servlet-mapping> 
    <context-param> 
     <param-name>facelets.DEVELOPMENT</param-name> 
     <param-value>false</param-value> 
    </context-param> 
    <context-param> 
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
     <param-value>.xhtml</param-value> 
    </context-param> 
    <servlet> 
     <servlet-name>Faces Servlet</servlet-name> 
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>Faces Servlet</servlet-name> 
     <url-pattern>*.seam</url-pattern> 
    </servlet-mapping> 
    <security-constraint> 
     <display-name>Restrict raw XHTML Documents</display-name> 
     <web-resource-collection> 
      <web-resource-name>XHTML</web-resource-name> 
      <url-pattern>*.xhtml</url-pattern> 
     </web-resource-collection> 
     <auth-constraint /> 
    </security-constraint> 
    <persistence-unit-ref> 
     <persistence-unit-ref-name>companyEntityManagerFactory</persistence-unit-ref-name> 
     <persistence-unit-name>company</persistence-unit-name> 
    </persistence-unit-ref> 




</web-app><servlet-name>Seam Resource Servlet</servlet-name> 
     <url-pattern>/seam/resource/*</url-pattern> 
    </servlet-mapping> 
    <context-param> 
     <param-name>facelets.DEVELOPMENT</param-name> 
     <param-value>false</param-value> 
    </context-param> 
    <context-param> 
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
     <param-value>.xhtml</param-value> 
    </context-param> 
    <servlet> 
     <servlet-name>Faces Servlet</servlet-name> 
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>Faces Servlet</servlet-name> 
     <url-pattern>*.seam</url-pattern> 
    </servlet-mapping> 
    <security-constraint> 
     <display-name>Restrict raw XHTML Documents</display-name> 
     <web-resource-collection> 
      <web-resource-name>XHTML</web-resource-name> 
      <url-pattern>*.xhtml</url-pattern> 
     </web-resource-collection> 
     <auth-constraint /> 
    </security-constraint> 
    <persistence-unit-ref> 
     <persistence-unit-ref-name>companyEntityManagerFactory</persistence-unit-ref-name> 
     <persistence-unit-name>company</persistence-unit-name> 
    </persistence-unit-ref> 




</web-app> 

編輯2:我覈實,對老版螢火蟲的資源選項卡中的資源從JSF和RichFaces的是不存在,但它依然工作,在XHTML中添加的資源在那裏,正確的,而在遷移版本上只有JSF和richfaces,但所有的擴展名都是.seam,我的顯式聲明的資源不在那裏。另一個有趣的事實是,它正好,如果我把這個在web.xml中:

<context-param> 
     <param-name>org.richfaces.resourceOptimization.enabled</param-name> 
     <param-value>false</param-value> 
    </context-param> 

否則wont't帶來什麼加載的資源。

考慮到與錯誤的新的web.xml已更改爲:

未捕獲的ReferenceError:A4J沒有定義

+0

那麼,對於一個'h:output *'[標籤沒有src屬性](https://javaserverfaces.java.net/nonav/docs/2.1/vdldocs/facelets/h/outputStylesheet的.html)。但是如果你有任何Seam過濾器可能會干擾資源。 – Makhiel

+0

嘗試禁用資源servlet,並檢查'​​'中產生了什麼,資源沒有正確鏈接。 – Makhiel

+0

禁用Seam資源servlet沒有區別,但我有一些更多的信息添加到問題描述 –

回答

0

這LIB 「A4J」 從RichFaces的4去除如下所述:access.redhat .com/solutions/882623

相關問題