Struts2 用tomcat5.0 与 tomcat-5.5.9 都不能启动,报同一个错误,而我在学校的 Windows 2000加tomcat5.0 可以运行,而带回家就不能运行了.以下是我加的 struts2 的包
错误信息
2007-10-19 12:05:18 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2007-10-19 12:05:18 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1188 ms
2007-10-19 12:05:18 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2007-10-19 12:05:18 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.9
2007-10-19 12:05:18 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2007-10-19 12:05:19 org.apache.catalina.core.ApplicationContext log
信息: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2007-10-19 12:05:19 org.apache.catalina.startup.HostConfig deployWAR
信息: Deploying web application archive jsp-examples.war
2007-10-19 12:05:20 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2007-10-19 12:05:20 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2007-10-19 12:05:20 org.apache.catalina.startup.HostConfig deployWAR
信息: Deploying web application archive ROOT.war
2007-10-19 12:05:20 org.apache.catalina.startup.HostConfig deployWAR
信息: Deploying web application archive servlets-examples.war
2007-10-19 12:05:20 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2007-10-19 12:05:20 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2007-10-19 12:05:20 org.apache.catalina.startup.HostConfig deployWAR
信息: Deploying web application archive tomcat-docs.war
2007-10-19 12:05:20 org.apache.catalina.startup.HostConfig deployWAR
信息: Deploying web application archive webdav.war
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.
2007-10-19 12:05:23 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2007-10-19 12:05:23 org.apache.catalina.core.StandardContext start
严重: Context [/strutsb] startup failed due to previous errors
2007-10-19 12:05:23 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2007-10-19 12:05:23 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2007-10-19 12:05:23 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/78 config=null
2007-10-19 12:05:23 org.apache.catalina.storeconfig.StoreLoader load
信息: Find registry server-registry.xml at classpath resource
2007-10-19 12:05:23 org.apache.catalina.startup.Catalina start
信息: Server startup in 5234 ms
我的struts.xml
xml 代码
- <!---->xml version="1.0" encoding="UTF-8" ?>
- <!---->
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
- <struts>
- <constant name="struts.devMode" value="true">constant>
- <constant name="struts.i18n.reload" value="true">constant>
- <constant name="struts.enable.DynamicMethodInvocation" value="true">constant>
- <constant name="struts.tag.altSyntax" value="true">constant>
-
- <constant name="struts.custom.i18n.resources" value="action.BookMgrAction">constant>
- <package name="bookmgr" namespace="/"
- extends="struts-default">
- <action name="addsave"
- class="action.BookMgrAction"
- method="addBook"
- >
- <result name="index">/addbook.jspresult>
- <result name="input">/addbook.jspresult>
- <result>/showbook.jspresult>
- action>
- <action name="addUser" class="action.addUserAction">
- <result name="input">/adduser.jspresult>
- <result name="index">/adduser.jspresult>
- <result>/user.jspresult>
- action>
-
- package>
- struts>
Web.xml
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>strutsfilter-name>
- <filter-class>org.apache.struts2.dispatcher.FilterDispatcherfilter-class>
- filter>
- <filter-mapping>
- <filter-name>strutsfilter-name>
- <url-pattern>/*url-pattern>
- filter-mapping>
- web-app>
我的 addUserAction.java
java 代码
- package action;
-
- import com.opensymphony.xwork2.ActionSupport;
-
- import entity.User;
-
- public class addUserAction extends ActionSupport {
-
- private static final long serialVersionUID = 0L;
- private User user=null;
-
- public User getUser() {
- return user;
- }
-
- public void setUser(User user) {
- this.user = user;
- }
- @Override
- public String execute() throws Exception {
- System.out.println("已经执行了");
- return SUCCESS;
- }
- }
BookMgrAction.java 代码如下
java 代码
- package action;
-
- import com.opensymphony.xwork2.ActionSupport;
-
- import entity.Book;
-
- public class BookMgrAction extends ActionSupport {
- private Book bk = null;
- public Book getBk() {
- return bk;
- }
- public void setBk(Book bk) {
- this.bk = bk;
- }
-
- public String addBook() throws Exception {
-
- System.out.println("Name:" + bk.getName() + " price:" + bk.getPrice());
- return super.execute();
- }
- }
addbook.jsp 如下
js 代码