This has been asked many times before, but not quite the same as this. Everything seems to be present and in the right place. I'm using Java8, Eclipse, Maven, Struts2 w/ Convention Plugin, Spring, Tiles and annotations. The context-root is iquality, FYI.
- The struts.xml is being read because I see the correct constants in the config-browser
-
- struts.convention.default.parent.package=convention-json-tiles
-
- convention-json-tiles extends struts-default
- The web.xml has
-
- the correct "actionPackages" value
-
- welcome-file=index.action
-
- filter-class=org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
- The WAR file has the correct .class files in the actionPackages package
The jar files I'm using:
- struts2-config-browser-plugin 2.5.29
- struts2-convention-plugin 2.5.29
- struts2-core 2.5.29
- struts2-javatemplates-plugin 2.5.29
- struts2-json-plugin 2.5.29
- struts2-spring-plugin 2.5.29
- struts2-tiles-plugin 2.5.29
- spring-orm 4.3.26.RELEASE
- spring-tx 4.3.26.RELEASE
The only error in the log I see is:
- org.apache.struts2.dispatcher.Dispatcher - Could not find action or result: /iquality
- There is no Action mapped for action name.
Here is a standard Action class that I have.
package com.icumed.ifactory.qa.web.actions;
public class ElementsAction extends ActionSupport
{
@Action(value = "/elements-page", results =
{
@Result(name = "success", type = "tiles", location = "elements")
})
public String execute()
{
return SUCCESS;
}
@Action(value = "/element", results =
{
@Result(name = "success", type = "tiles", location = "element")
})
public String getElement() throws ApplicationException
{
return super.get();
}
@Action(value = "/elements", results =
{
@Result(name = "success", type = "json", params =
{
"root",
ROOT_ELEMENT_TAG,
"excludeNullProperties",
"false",
})
})
public String search() throws ApplicationException
{
return super.search();
}
}
Here's my complete struts.xml
:
<struts>
<constant name="struts.custom.i18n.resources" value="iquality_messages" />
<constant name="struts.ui.theme" value="xhtml" />
<constant name="struts.multipart.enabled" value="true" />
<constant name="struts.json.dateformat" value="EEE, dd MMM yyyy HH:mm:ss zzz" />
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.convention.action.includeJars" value=".*?/ifactory.*?jar(!/)?" />
<constant name="struts.convention.exclude.parentClassLoader" value="true" />
<constant name="struts.convention.action.fileProtocols" value="jar,file,zip,vfs,vfsfile,vfszip" />
<constant name="struts.convention.default.parent.package" value="convention-json-tiles" />
<package name="convention-json-tiles" namespace="/" extends="struts-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>
<default-interceptor-ref name="defaultStack" />
<global-results>
<result name="Exception">/WEB-INF/content/application_exception.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="Exception" />
</global-exception-mappings>
</package>
</struts>
What am I missing or what do I have wrong?