我们有一个Struts + Spring + Hibernate应用程序,我们正在尝试集成JSF。为此,我们在web.xml
和struts-config.xml
中进行了一些配置。我添加了一些
JAR文件为WEB-INF/lib
。
此处列出了包含在我的WEB-INF / lib中的jar文件:
ANTLR-2.7.6rc1.jar,asm.jar,ASM-attrs.jar,BSH-2.0b2.jar,c3p0-0.9.1.2-jdk1.3.jar,CGLIB的2.1.3.jar,commons- BeanUtils的-1.7.jar,公地模棱两可-0.8.jar,公共-CLI-1.0.jar,公地编解码器1.3.jar,公地的集合,3.jar,公地DBCP-1.2.1.jar,commons-沼气池-1.7.jar,公共发现-0.2.jar,公地fileupload.jar,公地httpclient的-3.1.jar,公共-IO-1.3.1.jar,公共琅2.3.jar,公地测井1.1.jar,commons-pool的-1.2.jar,公地validator.jar,连接器1_5.jar,dom4j的-1.6.1.jar,ehcache的-1.1.jar,EL-API 6.0.20.jar,EL- IMPL-2.2.0-SNAPSHOT.jar,休眠-3.1.3.jar,码头-UTIL-6.0.0,的.jar,servlet的API-2.3.jar,弹簧2.5.6.jar,standard.jar,支柱的.jar,xercesImpl-2.6.2.jar,xmlParserAPIs-2.6.2.jar,XStream的-1.3.1
以下jar文件是为了集成JSF而新添加的文件:
JSF的API-2.0.jar,JSF的参数impl-2.0.jar,MyFaces的-JSF的API-1.0.9.jar.jar.jar,支柱-面-1.3.10.jar
我的web.xml
是:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>SSHIntgr</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/config/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/config/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>locale</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- struts-faces configuration start -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- struts-faces configuration start -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
我的struts-config.xml
是
<struts-config>
<form-beans>
<form-bean name="usrForm" type="com.sshi.web.form.UsrForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action path="/login" type="com.sshi.web.action.LoginAction"
name="usrForm" scope="request">
<forward name="allowUser" path="/pages/Welcome.jsp"/>
<forward name="denyUser" path="/index.jsp"/>
</action>
</action-mappings>
<controller>
<set-property property="processorClass"
value="org.apache.struts.faces.
application.FacesRequestProcessor"/>
</controller>
<message-resources key="MessageResources" parameter="MessageResources" null="false" />
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/config/validator-rules.xml,/config/validation.xml" />
<set-property property="stopOnFirstError" value="true" />
</plug-in>
</struts-config>
我正在使用Spring源收费套件,Tomcat 5.5和JDK 1.5。
我的Tomcat 5.5\common\lib
包含JAR文件
公地el.jar,碧玉-compiler.jar,碧玉编译-jdt.jar,碧玉-runtime.jar,JSP-api.jar文件,命名-factory.jar,命名-工厂dbcp.jar, 命名-resources.jar,servlet的api.jar文件
我的服务器正常启动但无法加载JSP页面,我收到异常
org.apache.jasper.JasperException: Unable to read TLD "META-INF/jsf_core.tld" from JAR file "file:/SSHIntgr/WEB-INF/lib/jsf-impl-2.0.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: com.sun.faces.taglib.jsf_core.CoreValidator
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:179)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:181)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
我该如何解决这个问题?
答案 0 :(得分:2)
您使用的是tomcat 5.5,它是一个Servlet 2.4容器,但JSF 2.0需要Servlet 2.5或更新版本。
所以你有两个选择:
无关:文件servlet-api-2.3.jar
属于WEB-INF/lib
。摆脱它。它应该由servletcontainer 已经提供(在这种情况下,是Tomcat的/lib
中的那个)。保留此文件只会导致在运行时缺少类def或抽象方法错误。