I declared a package in struts.xml. But tomcat6 can't startup since I added it. The configuration in struts.xml is:
<package name="pkg2" namespace="/0314">
<interceptors>
<interceptor name="myInterceptor" class="com.chailie.test4.MyInterceptor"/>
<interceptor-stack name="myInterceptorStack">
<interceptor-ref name="myInterceptor"/>
</interceptor-stack>
</interceptors>
<global-results>
<result name="success">/success.jsp</result>
</global-results>
<action name="test1" class="com.chailie.test4.HelloWorld1">
<result name="success">/success.jsp</result>
<interceptor-ref name="myInterceptorStack"/>
</action>
</package>
When I booted tomcat6 the exception's stacktrace was:
INFO: Choosing bean (struts) for interface org.apache.struts2.dispatcher.StaticContentLoader
三月 14, 2013 10:07:52 下午 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Choosing bean (struts) for interface com.opensymphony.xwork2.UnknownHandlerManager
三月 14, 2013 10:07:53 下午 com.opensymphony.xwork2.util.logging.jdk.JdkLogger error
SEVERE: Dispatcher initialization failed
Unable to load configuration. - result - file:/C:/tomcat6/webapps/sstart/WEB-INF/classes/struts.xml:57:27
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: No result type specified for result named 'success', perhaps the parent package does not specify the result type? - result - file:/C:/tomcat6/webapps/sstart/WEB-INF/classes/struts.xml:57:27
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:636)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadGlobalResults(XmlConfigurationProvider.java:807)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:477)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:278)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 31 more
三月 14, 2013 10:07:53 下午 org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
三月 14, 2013 10:07:53 下午 org.apache.catalina.core.StandardContext start
SEVERE: Context [/sstart] startup failed due to previous errors
三月 14, 2013 10:07:53 下午 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
Once I added extends='struts-default' in package as
<package name="pkg2" namespace="/0314" extends='struts-default'>
<interceptors>
<interceptor name="myInterceptor" class="com.chailie.test4.MyInterceptor"/>
<interceptor-stack name="myInterceptorStack">
<interceptor-ref name="myInterceptor"/>
</interceptor-stack>
</interceptors>
<global-results>
<result name="success">/success.jsp</result>
</global-results>
<action name="test1" class="com.chailie.test4.HelloWorld1">
<result name="success">/success.jsp</result>
<interceptor-ref name="myInterceptorStack"/>
</action>
</package>
the tomcat6 could startup properly.
So my question is when I add one "package" in struts.xml. Does the package have to extend from "struts-default" package? I googled this but the "extends" attribute is just an option attribute for package element. Then why would I have this issue?
Check the original strus-default.xml , you'll see that it defines all default interceptors and results, you are not defining results in yours, that's why is most likely failing.
I can't test it right now, but I would assume that if you add the definition for the dispatcher result and the default class reference, then it should start without extending it.
<result-types>
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
</result-types>
<default-class-ref class="com.opensymphony.xwork2.ActionSupport" />
Related
My flutter app get crash on android 4.4.2 on startup
and this is the log
I've tried to remove the firebase from the application put it still get crash
This is the log that I get after running
04-11 11:23:39.709 4391-4391/com.brain_socket.almadar E/AndroidRuntime: FATAL
EXCEPTION: main Process:
com.brain_socket.almadar, PID: 4391
java.lang.RuntimeException: Unable to get
provider com.google.firebase.provider.FirebaseInitProvider:
java.lang.ClassNotFoundException: Didn't find class
"com.google.firebase.provider.FirebaseInitProvider" on path:
DexPathList[[zip file
"/data/app/com.brain_socket.almadar-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.brain_socket.almadar-1,
/vendor/lib, /system/lib]]
at
android.app.ActivityThread.installProvider(ActivityThread.java:4793)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
at
android.app.ActivityThread.access$1500(ActivityThread.java:135)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at
android.os.Handler.dispatchMessage(Handler.java:102)
at
android.os.Looper.loop(Looper.java:136)
at
android.app.ActivityThread.main(ActivityThread.java:5017)
at
java.lang.reflect.Method.invokeNative(Native Method)
at
java.lang.reflect.Method.invoke(Method.java:515)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at
dalvik.system.NativeStart.main(Native Method)
Caused by:
java.lang.ClassNotFoundException: Didn't find class
"com.google.firebase.provider.FirebaseInitProvider" on path:
DexPathList[[zip file
"/data/app/com.brain_socket.almadar-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.brain_socket.almadar-1,
/vendor/lib, /system/lib]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at
android.app.ActivityThread.installProvider(ActivityThread.java:4778)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
at
android.app.ActivityThread.access$1500(ActivityThread.java:135)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at
android.os.Handler.dispatchMessage(Handler.java:102)
at
android.os.Looper.loop(Looper.java:136)
at
android.app.ActivityThread.main(ActivityThread.java:5017)
at
java.lang.reflect.Method.invokeNative(Native Method)
at
java.lang.reflect.Method.invoke(Method.java:515)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at
dalvik.system.NativeStart.main(Native Method)
Manifest file :
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Holidays"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in #style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
/>
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
</application> </manifest>
Writing a simple HelloWorld application using Struts2.5. Getting the following error.
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
FATAL StrutsSpringObjectFactory ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
ERROR DefaultConversionPropertiesProcessor Conversion registration error
java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:165)
at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:177)
at com.opensymphony.xwork2.conversion.impl.DefaultTypeConverterCreator.createTypeConverter(DefaultTypeConverterCreator.java:40)
......
INFO: Server startup in [11,384] milliseconds
Following is struts.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="default" extends="struts-default">
<action name="reg" class="action.EmployeeController">
<result name="input">/input.jsp</result>
<result name="success">/success.jsp</result>
</action>
</package>
</struts>
How can it be resolved without configuring Spring?
Unable to load configuration. - action -
file:/D:/DATA/STUDY/anup/Struts2Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/FirstStrutsApplication/WEB-INF/classes/struts.xml:6:55
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
at
org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:107)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at
java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source) Caused by: Action class
[com.javatpoint.Product] not found - action -
file:/D:/DATA/STUDY/anup/Struts2Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/FirstStrutsApplication/WEB-INF/classes/struts.xml:6:55
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:409)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:354)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
at
org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "struts.apache.org/dtds/struts-2.0.dtd">;
<struts>
<package name="default" extends="struts-default">
<action name="getTutorial" class="com.anup.work.TutorialAction" method="execute">
<result name="success">/success.jsp</result>
</action>
</package>
</struts>
The answer states explicitly what the problem is:
Action class [com.javatpoint.Product] not found
Your action class is not being deployed, or simply doesn't exist.
Your .class file is not being created. right click on your project, go to properties. select java compiler and check the settings(uncheck the Enable check-box).
I'm trying to get my Struts2 project running with Tiles and REST Plugin but I just can't get it working.
I've looked at the documentation for both and I think i'm doing it right. here are my files:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app metadata-complete="true" version="2.5"
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_2_5.xsd">
<!-- listeners -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<!-- context params -->
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles-tradesman.xml</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring-tradesman.xml</param-value>
</context-param>
<!-- filters -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<!-- filter mappings -->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
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" />
<!-- RESTful plugin setup -->
<constant name="struts.mapper.class" value="rest" />
<constant name="struts.convention.action.suffix" value="Controller"/>
<constant name="struts.convention.action.mapAllMatches" value="true"/>
<constant name="struts.convention.default.parent.package" value="rest-default"/>
<constant name="struts.convention.package.locators" value="tp"/>
<package name="tradesman" namespace="/beta/tradesman" extends="default">
<result-types>
<result-type name="json" class="org.apache.struts2.json.JSONResult"/>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<interceptors>
<interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/>
</interceptors>
</package>
</struts>
JobAlertsController.java
package uk.co.ratedpeople.tp;
import com.opensymphony.xwork2.ActionSupport;
import java.util.logging.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
public class JobAlertsController extends ActionSupport {
private static final Logger LOGGER = Logger.getLogger(JobAlertsController.class.getName());
#Action(results={
#Result(name = SUCCESS, location = "tradesman.page.jobalerts", type = "tiles")
})
public String index() {
LOGGER.info("executing index action...");
LOGGER.info("leaving index action...");
return SUCCESS;
}
}
When i try to run the project I get this error:
SEVERE: Exception starting filter struts2
Unable to load configuration. - [unknown location]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:195)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4542)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5220)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5215)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
... 13 more
Caused by: The Result type [tiles] which is defined in the Result annotation on the class [class uk.co.ratedpeople.tp.JobAlertsController] or determined by the file extension or is the default result type for the PackageConfig of the action, could not be found as a result-type defined for the Struts/XWork package [uk.co.ratedpeople.tp#rest-default#] - [unknown location]
at org.apache.struts2.convention.DefaultResultMapBuilder.createResultConfig(DefaultResultMapBuilder.java:427)
at org.apache.struts2.convention.DefaultResultMapBuilder.createFromAnnotations(DefaultResultMapBuilder.java:399)
at org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:200)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:864)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:650)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:335)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 15 more
27-Jul-2011 17:07:07 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
I'm sure i'm doing something really stupid but I can't see it myself. Anyone?
First, I would suggest putting your struts actions in a package simply called struts, I've had much less configuration issues when using standard conventions plugin architecture. Move your actions to a package like:
uk.co.ratedpeople.struts
instead of
uk.co.ratedpeople.tp;
The less out of the box configuration, the better off you typically are.
This also eliminates the need for this:
<constant name="struts.convention.package.locators" value="tp"/>
Second, part of your problem is with your xml configuration:
<struts>
<constant name="struts.devMode" value="true" />
<!-- RESTful plugin setup -->
<constant name="struts.mapper.class" value="rest" />
<constant name="struts.convention.action.suffix" value="Controller"/>
<constant name="struts.convention.action.mapAllMatches" value="true"/>
<constant name="struts.convention.default.parent.package" value="rest-default"/>
<constant name="struts.convention.package.locators" value="tp"/>
<package name="tradesman" namespace="/beta/tradesman" extends="default">
<result-types>
<result-type name="json" class="org.apache.struts2.json.JSONResult"/>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<interceptors>
<interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/>
</interceptors>
</package>
Try something like this instead (providing you moved your actions as previously suggested):
<struts>
<constant name="struts.devMode" value="true" />
<!-- RESTful plugin setup -->
<constant name="struts.mapper.class" value="rest" />
<constant name="struts.convention.action.suffix" value="Controller"/>
<constant name="struts.convention.action.mapAllMatches" value="true"/>
<constant name="struts.convention.default.parent.package" value="tradesman"/>
<package name="tradesman" namespace="/beta/tradesman" extends="rest-default">
<result-types>
<result-type name="json" class="org.apache.struts2.json.JSONResult"/>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
</package>
</struts>
Notice the constant name="struts.convention.default.parent.package" value="tradesman" which is referring to the package below it which defines your result types and extends rest-default. This should eliminate your tiles result definition errors.
I've also run into issues using the struts filter you have in your web.xml, I would change from:
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
to:
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
I'm new to Struts and I got issue like this
INFO: Starting service Catalina
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Mar 10, 2011 10:40:39 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/StrutsPrj] startup failed due to previous errors
Mar 10, 2011 10:40:39 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 10, 2011 10:40:39 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 10, 2011 10:40:39 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16 config=null
Mar 10, 2011 10:40:39 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 625 ms
Also I got some probs in my struts.xml file
<?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.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="AppResources" />
<package name="default" extends="struts-default" namespace="/">
<action name="login"
class="sturts2.LoginAction">
<result name="success">Welcome.jsp</result>
<result name="error">Login.jsp</result>
</action>
</package>
</struts>
In first line of struts.xml, I got error like this:
Referenced file contains errors (http://struts.apache.org/dtds/struts-2.0.dtd). For more information, right click on the message in the Problems View and select "Show Details..."
This worked for me:
Copy all the necessary jar files to WebContent > WEB-INF > lib folder
Make sure that you have added commons-lang3-3.1 and struts2-core-2.3.16.3