在发布的时候出现下面错误:
2010-5-20 7:29:08 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2010-5-20 7:29:08 org.apache.catalina.core.StandardContext start
严重: Context [/Struts2Demo] startup failed due to previous errors
运行的时候错误提示
The requested resource (/Struts2Demo/) is not available.
web.xml代码如下:<?xml version="1.0" encoding="UTF-8"?>
<web-app 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">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>还有就是在hello.jsp中显示
Multiple annotations found at this line:
- Unknown tag (s:property).
- Undefined attribute name (value).
hello.jsp代码如下:
[code=jsp]
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>My JSP 'hello.jsp' starting page</title>
</head>
<body>
<s:property value="msg"/>
</body>
</html>[/code]
2010-5-20 7:29:08 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2010-5-20 7:29:08 org.apache.catalina.core.StandardContext start
严重: Context [/Struts2Demo] startup failed due to previous errors
运行的时候错误提示
The requested resource (/Struts2Demo/) is not available.
web.xml代码如下:<?xml version="1.0" encoding="UTF-8"?>
<web-app 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">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>还有就是在hello.jsp中显示
Multiple annotations found at this line:
- Unknown tag (s:property).
- Undefined attribute name (value).
hello.jsp代码如下:
[code=jsp]
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>My JSP 'hello.jsp' starting page</title>
</head>
<body>
<s:property value="msg"/>
</body>
</html>[/code]
你可以搜索一下 tag 库在哪里,纠正一下 uri
2startup failed due to previous errors可能(遇到过,忘了咋解决的了)是jar包冲突,这个不解决,tomcat正常不了
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd" >
<struts>
<package name="mldn" namespace="/" extends="struts-default">
<action name="hello" class="org.lxh.struts2.demo.HelloAction">
<result name="success">/hello.jsp</result>
</action>
</package>
</struts>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
我想知道你那mapping那里怎么有个/在
http://localhost:8080/Struts2Demo/hello.action
http://localhost:8080/Struts2/hello
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
认为是由于jdk1.5 与 tomcat5.0之间的关于 TransformerFactoryImpl 类的冲突造成的。
tomcat-5.0.28\common\endorsed下有两个jar包:xercesImpl.jar和xml-apis.jar,其中的类 javax.xml.transform.TransformerFactory 与jdk1.5中的类org.apache.xalan.processor.TransformerFactoryImpl其实是同一个类。
in tomcat java is called with the following argument:
-Djava.endorsed.dirs="X:\my_app\Portal\tomcat\common\endorsed"
In this directory you find two jar files: xercesImpl.jar and xml-apis.jar needed by tomcat and that must be loaded before all xmsl stuff present in the jdk (1.4 naming problem). And in the file xml-apis.jar the TransformerFactoryImpl is set to "org.apache.xalan.processor.TransformerFactoryImpl".
解决办法:
1. 将xml-apis.jar移出endorsed文件夹。
2. 用xalan系列jar包替换原来的xercesImpl.jar和xml-apis.jar。
xalan系列jar包:serializer.jar、xalan.jar、xercesImpl.jar和xml-apis.jar。
3. For other application, just check this file or dom3-xml-apis.jar in your class path.
如果你不会这样做,就使用1.4的JDK和tomcat5.0
或者JDK1.5 tomcat5.5 这2种类型才是匹配的