java - Struts2.3.20 Helloworld errors: The requested resource is not available -
this question has answer here:
to use struts2 finished first helloworld example here
got error : description : requested resource not available.
i'm not able understand what's wrong.

here code:
struts.xml
<?xml version="1.0" encoding="utf-8"?> <!doctype struts public "-//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" /> <package name="helloworld" extends="struts-default"> <action name="hello" class="com.tutorialspoint.struts2.helloworldaction" method="execute"> <result name="success">/helloworld.jsp</result> </action> </package> web.xml
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>struts 2</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> helloworldaction.java
package com.tutorialspoint.struts2; public class helloworldaction { private string name; public string execute() throws exception { return "success"; } public string getname() { return name; } public void setname(string name) { this.name = name; } } index.jsp
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>hello world</title> </head> <body> <h1>hello world struts2</h1> <form action="hello"> <label for="name">please enter name</label><br/> <input type="text" name="name"/> <input type="submit" value="say hello"/> </form> </body> </html> helloworld.jsp
<%@ page contenttype="text/html; charset=utf-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>hello world</title> </head> <body> hello world, <s:property value="name"/> </body> </html> console
嚴重: dispatcher initialization failed unable load configuration. - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myweb1/web-inf/lib/struts2-gxp-plugin-2.3.20.jar!/struts-plugin.xml:8:162 @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:70) @ org.apache.struts2.dispatcher.dispatcher.getcontainer(dispatcher.java:967) @ org.apache.struts2.dispatcher.dispatcher.init_preloadconfiguration(dispatcher.java:435) @ org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:479) @ org.apache.struts2.dispatcher.ng.initoperations.initdispatcher(initoperations.java:74) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.init(strutsprepareandexecutefilter.java:57) @ org.apache.catalina.core.applicationfilterconfig.initfilter(applicationfilterconfig.java:279) @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:260) @ org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:105) @ org.apache.catalina.core.standardcontext.filterstart(standardcontext.java:4854) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5546) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source) caused by: unable load bean: type:org.apache.struts2.views.gxp.inject.injectedobjectcontainer class:org.apache.struts2.views.gxp.inject.injectedobjectcontainer - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myweb1/web-inf/lib/struts2-gxp-plugin-2.3.20.jar!/struts-plugin.xml:8:162 @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:247) @ org.apache.struts2.config.strutsxmlconfigurationprovider.register(strutsxmlconfigurationprovider.java:102) @ com.opensymphony.xwork2.config.impl.defaultconfiguration.reloadcontainer(defaultconfiguration.java:240) @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:67) ... 17 more caused by: java.lang.classnotfoundexception: org.apache.struts2.views.gxp.inject.injectedobjectcontainer @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1720) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) @ com.opensymphony.xwork2.util.classloaderutil.loadclass(classloaderutil.java:152) @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:218) ... 20 more 四月 29, 2015 3:30:26 下午 org.apache.catalina.core.standardcontext filterstart 嚴重: exception starting filter struts2 unable load configuration. - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myweb1/web-inf/lib/struts2-gxp-plugin-2.3.20.jar!/struts-plugin.xml:8:162 @ org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:493) @ org.apache.struts2.dispatcher.ng.initoperations.initdispatcher(initoperations.java:74) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.init(strutsprepareandexecutefilter.java:57) @ org.apache.catalina.core.applicationfilterconfig.initfilter(applicationfilterconfig.java:279) @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:260) @ org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:105) @ org.apache.catalina.core.standardcontext.filterstart(standardcontext.java:4854) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5546) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source) caused by: unable load configuration. - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myweb1/web-inf/lib/struts2-gxp-plugin-2.3.20.jar!/struts-plugin.xml:8:162 @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:70) @ org.apache.struts2.dispatcher.dispatcher.getcontainer(dispatcher.java:967) @ org.apache.struts2.dispatcher.dispatcher.init_preloadconfiguration(dispatcher.java:435) @ org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:479) ... 14 more caused by: unable load bean: type:org.apache.struts2.views.gxp.inject.injectedobjectcontainer class:org.apache.struts2.views.gxp.inject.injectedobjectcontainer - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myweb1/web-inf/lib/struts2-gxp-plugin-2.3.20.jar!/struts-plugin.xml:8:162 @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:247) @ org.apache.struts2.config.strutsxmlconfigurationprovider.register(strutsxmlconfigurationprovider.java:102) @ com.opensymphony.xwork2.config.impl.defaultconfiguration.reloadcontainer(defaultconfiguration.java:240) @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:67) ... 17 more caused by: java.lang.classnotfoundexception: org.apache.struts2.views.gxp.inject.injectedobjectcontainer @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1720) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1571) @ com.opensymphony.xwork2.util.classloaderutil.loadclass(classloaderutil.java:152) @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:218) ... 20 more 四月 29, 2015 3:30:26 下午 org.apache.catalina.core.standardcontext startinternal 嚴重: error filterstart 四月 29, 2015 3:30:26 下午 org.apache.catalina.core.standardcontext startinternal 嚴重: context [/myweb1] startup failed due previous errors 四月 29, 2015 3:30:26 下午 org.apache.catalina.startup.tagliburirule body 資訊: tld skipped. uri: /struts-tags defined 四月 29, 2015 3:30:27 下午 com.opensymphony.xwork2.util.logging.jdk.jdklogger info 資訊: parsing configuration file [struts-default.xml] 四月 29, 2015 3:30:27 下午 com.opensymphony.xwork2.util.logging.jdk.jdklogger error 嚴重: dispatcher initialization failed unable load configuration. - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.8.jar!/struts-default.xml:30:124 @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:70) @ org.apache.struts2.dispatcher.dispatcher.getcontainer(dispatcher.java:967) @ org.apache.struts2.dispatcher.dispatcher.init_preloadconfiguration(dispatcher.java:435) @ org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:479) @ org.apache.struts2.dispatcher.filterdispatcher.init(filterdispatcher.java:193) @ org.apache.catalina.core.applicationfilterconfig.initfilter(applicationfilterconfig.java:279) @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:260) @ org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:105) @ org.apache.catalina.core.standardcontext.filterstart(standardcontext.java:4854) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5546) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source) caused by: unable load bean: type:com.opensymphony.xwork2.objectfactory class:org.apache.struts2.impl.strutsobjectfactory - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.8.jar!/struts-default.xml:30:124 @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:247) @ org.apache.struts2.config.strutsxmlconfigurationprovider.register(strutsxmlconfigurationprovider.java:102) @ com.opensymphony.xwork2.config.impl.defaultconfiguration.reloadcontainer(defaultconfiguration.java:240) @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:67) ... 16 more caused by: bean type class com.opensymphony.xwork2.objectfactory name struts has been loaded bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.20.jar!/struts-default.xml:57:72 - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.8.jar!/struts-default.xml:30:124 @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:231) ... 19 more 四月 29, 2015 3:30:27 下午 org.apache.catalina.core.standardcontext filterstart 嚴重: exception starting filter struts2 unable load configuration. - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.8.jar!/struts-default.xml:30:124 @ org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:493) @ org.apache.struts2.dispatcher.filterdispatcher.init(filterdispatcher.java:193) @ org.apache.catalina.core.applicationfilterconfig.initfilter(applicationfilterconfig.java:279) @ org.apache.catalina.core.applicationfilterconfig.getfilter(applicationfilterconfig.java:260) @ org.apache.catalina.core.applicationfilterconfig.<init>(applicationfilterconfig.java:105) @ org.apache.catalina.core.standardcontext.filterstart(standardcontext.java:4854) @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5546) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1575) @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1565) @ java.util.concurrent.futuretask.run(unknown source) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source) caused by: unable load configuration. - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.8.jar!/struts-default.xml:30:124 @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:70) @ org.apache.struts2.dispatcher.dispatcher.getcontainer(dispatcher.java:967) @ org.apache.struts2.dispatcher.dispatcher.init_preloadconfiguration(dispatcher.java:435) @ org.apache.struts2.dispatcher.dispatcher.init(dispatcher.java:479) ... 13 more caused by: unable load bean: type:com.opensymphony.xwork2.objectfactory class:org.apache.struts2.impl.strutsobjectfactory - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.8.jar!/struts-default.xml:30:124 @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:247) @ org.apache.struts2.config.strutsxmlconfigurationprovider.register(strutsxmlconfigurationprovider.java:102) @ com.opensymphony.xwork2.config.impl.defaultconfiguration.reloadcontainer(defaultconfiguration.java:240) @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:67) ... 16 more caused by: bean type class com.opensymphony.xwork2.objectfactory name struts has been loaded bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.20.jar!/struts-default.xml:57:72 - bean - jar:file:/d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/helloworldstruts2/web-inf/lib/struts2-core-2.3.8.jar!/struts-default.xml:30:124 @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.register(xmlconfigurationprovider.java:231) ... 19 more
problem in project's struts.xml file. close logintest project , try. should work.
or delete struts.xml file d:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/logintest/web-inf/classes/
update : shows error in myweb1 project close other projects or import helloworldstruts2 project new workspace.
Comments
Post a Comment