You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Amine BADID <am...@yahoo.fr> on 2014/06/22 16:06:58 UTC
Tiles Struts2 Annotations
Hi All.
I'm workgin on JEE web application, using Struts2 with annotations and tiles too.
I've an error:
- 2014-06-22 15:53:51,187 ERROR [org.apache.struts2.dispatcher.Dispatcher] - <Dispatcher initialization failed>
Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
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.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: The Result type [tiles] which is defined in the Result annotation on the class [class mypackage.WelcomeAction] 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 [mypackage#convention-default#/] - [unknown location]
at org.apache.struts2.convention.DefaultResultMapBuilder.createResultConfig(DefaultResultMapBuilder.java:438)
at org.apache.struts2.convention.DefaultResultMapBuilder.createFromAnnotations(DefaultResultMapBuilder.java:410)
at org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:202)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:935)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:718)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:348)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:260)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
Here is WelcomeAction class:
@Action(value = "menu",
results = {
@Result(name = SUCCESS, location = "/search", type= "tiles"),
@Result(name=INPUT, location = "/index", type = "tiles"),
@Result(name = ERROR, location = "/index", type = "tiles")
}
)
And here are defintions in tiles.xml:
<definition name="baseLayout" template="/jsp/layout/BaseLayout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/jsp/header.jsp" />
<put-attribute name="menu" value="" />
<put-attribute name="body" value="" />
</definition>
<definition name="/index" extends="baseLayout">
<put-attribute name="title" value="Index" />
<put-attribute name="menu" value="/jsp/menu_index.jsp" />
<put-attribute name="body" value="/jsp/index.jsp" />
</definition>
<definition name="/search" extends="baseLayout">
<put-attribute name="title" value="Search" />
<put-attribute name="menu" value="/jsp/menu_index.jsp" />
<put-attribute name="body" value="/jsp/search.jsp" />
</definition>
Here is Struts.xml:
<struts>
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.convention.action.packages" value="fr.itsystem.masyv.web" />
<constant name="struts.convention.package.locators" value="action,actions,struts,struts2,web"/>
<constant name="struts.convention.action.suffix" value="Action" />
<constant name="struts.convention.action.mapAllMatches" value="true" />
<constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
<constant name="struts.custom.i18n.resources" value="global" />
<package name="default" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
</package>
</struts>
Here are declarations of the context and listener of tiles in my web.xml:
<context-param>
<description>Tiles configuration file</description>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>
/WEB-INF/classes/tiles.xml
</param-value>
</context-param>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
Thank you a lot in advance.
Sincerly
Amine
Re: Tiles Struts2 Annotations
Posted by Amine BADID <am...@yahoo.fr>.
Hi Lukasz.
Thank you a lot.
The problem is resolved.
Le Dimanche 22 juin 2014 16h27, Lukasz Lenart <lu...@apache.org> a écrit :
When using the Convention plugin you must set
struts.convention.default.parent.package = tiles-default
to use tiles result
2014-06-22 16:24 GMT+02:00 Amine BADID <am...@yahoo.fr>:
> Hi Dave.
> I tried to use theses syntaxe:
> <package name="default" extends="struts-default">
> and
>
> <package name="tiles-default" extends="struts-default">
> The both are "false" and did not resolve my problem
>
> Here are a scan image of libraries and thank you a lot :
>
>
>
> Le Dimanche 22 juin 2014 16h14, Dave Newton <da...@gmail.com> a écrit :
>
>
>
> What libraries/jars are you deploying? Are you using a parent package that
> extends tiles-default?
>
> On Jun 22, 2014 10:07 AM, "Amine BADID" <am...@yahoo.fr> wrote:
>
>> Hi All.
>> I'm workgin on JEE web application, using Struts2 with annotations and
>> tiles too.
>> I've an error:
>> - 2014-06-22 15:53:51,187 ERROR [org.apache.struts2.dispatcher.Dispatcher]
>> - <Dispatcher initialization failed>
>> Unable to load configuration. - [unknown location]
>> at
>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
>> at
>> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
>> at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
>> at
>> org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
>> at
>> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
>> at
>> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
>> at
>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
>> at
>> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
>> at
>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
>> at
>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
>> 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.run(FutureTask.java:262)
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>> at java.lang.Thread.run(Thread.java:745)
>> Caused by: The Result type [tiles] which is defined in the Result
>> annotation on the class [class mypackage.WelcomeAction] 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 [mypackage#convention-default#/] - [unknown location]
>> at
>> org.apache.struts2.convention.DefaultResultMapBuilder.createResultConfig(DefaultResultMapBuilder.java:438)
>> at
>> org.apache.struts2.convention.DefaultResultMapBuilder.createFromAnnotations(DefaultResultMapBuilder.java:410)
>> at
>> org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:202)
>> at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:935)
>> at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:718)
>> at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:348)
>> at
>> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
>> at
>> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:260)
>> at
>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
>> Here is WelcomeAction class:
>> @Action(value = "menu",
>> results = {
>> @Result(name = SUCCESS, location = "/search", type=
>> "tiles"),
>> @Result(name=INPUT, location = "/index", type =
>> "tiles"),
>> @Result(name = ERROR, location = "/index", type =
>> "tiles")
>> }
>> )
>> And here are defintions in tiles.xml:
>> <definition name="baseLayout" template="/jsp/layout/BaseLayout.jsp">
>> <put-attribute name="title" value="" />
>> <put-attribute name="header" value="/jsp/header.jsp" />
>> <put-attribute name="menu" value="" />
>> <put-attribute name="body" value="" />
>> </definition>
>>
>> <definition name="/index" extends="baseLayout">
>> <put-attribute name="title" value="Index" />
>> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
>> <put-attribute name="body" value="/jsp/index.jsp" />
>> </definition>
>>
>> <definition name="/search" extends="baseLayout">
>> <put-attribute name="title" value="Search" />
>> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
>> <put-attribute name="body" value="/jsp/search.jsp" />
>> </definition>
>> Here is Struts.xml:
>> <struts>
>> <constant name="struts.objectFactory" value="spring" />
>> <constant name="struts.convention.action.packages"
>> value="fr.itsystem.masyv.web" />
>> <constant name="struts.convention.package.locators"
>> value="action,actions,struts,struts2,web"/>
>> <constant name="struts.convention.action.suffix" value="Action" />
>> <constant name="struts.convention.action.mapAllMatches" value="true" />
>> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
>> <constant name="struts.custom.i18n.resources" value="global" />
>> <package name="default" extends="struts-default">
>> <result-types>
>> <result-type name="tiles"
>> class="org.apache.struts2.views.tiles.TilesResult" />
>> </result-types>
>> </package>
>> </struts>
>> Here are declarations of the context and listener of tiles in my web.xml:
>> <context-param>
>> <description>Tiles configuration file</description>
>>
>> <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
>> <param-value>
>> /WEB-INF/classes/tiles.xml
>> </param-value>
>> </context-param>
>> <listener>
>>
>> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
>> </listener>
>>
>> Thank you a lot in advance.
>>
>> Sincerly
>>
>> Amine
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Tiles Struts2 Annotations
Posted by Lukasz Lenart <lu...@apache.org>.
When using the Convention plugin you must set
struts.convention.default.parent.package = tiles-default
to use tiles result
2014-06-22 16:24 GMT+02:00 Amine BADID <am...@yahoo.fr>:
> Hi Dave.
> I tried to use theses syntaxe:
> <package name="default" extends="struts-default">
> and
>
> <package name="tiles-default" extends="struts-default">
> The both are "false" and did not resolve my problem
>
> Here are a scan image of libraries and thank you a lot :
>
>
>
> Le Dimanche 22 juin 2014 16h14, Dave Newton <da...@gmail.com> a écrit :
>
>
>
> What libraries/jars are you deploying? Are you using a parent package that
> extends tiles-default?
>
> On Jun 22, 2014 10:07 AM, "Amine BADID" <am...@yahoo.fr> wrote:
>
>> Hi All.
>> I'm workgin on JEE web application, using Struts2 with annotations and
>> tiles too.
>> I've an error:
>> - 2014-06-22 15:53:51,187 ERROR [org.apache.struts2.dispatcher.Dispatcher]
>> - <Dispatcher initialization failed>
>> Unable to load configuration. - [unknown location]
>> at
>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
>> at
>> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
>> at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
>> at
>> org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
>> at
>> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
>> at
>> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
>> at
>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
>> at
>> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
>> at
>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
>> at
>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
>> 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.run(FutureTask.java:262)
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>> at java.lang.Thread.run(Thread.java:745)
>> Caused by: The Result type [tiles] which is defined in the Result
>> annotation on the class [class mypackage.WelcomeAction] 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 [mypackage#convention-default#/] - [unknown location]
>> at
>> org.apache.struts2.convention.DefaultResultMapBuilder.createResultConfig(DefaultResultMapBuilder.java:438)
>> at
>> org.apache.struts2.convention.DefaultResultMapBuilder.createFromAnnotations(DefaultResultMapBuilder.java:410)
>> at
>> org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:202)
>> at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:935)
>> at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:718)
>> at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:348)
>> at
>> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
>> at
>> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:260)
>> at
>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
>> Here is WelcomeAction class:
>> @Action(value = "menu",
>> results = {
>> @Result(name = SUCCESS, location = "/search", type=
>> "tiles"),
>> @Result(name=INPUT, location = "/index", type =
>> "tiles"),
>> @Result(name = ERROR, location = "/index", type =
>> "tiles")
>> }
>> )
>> And here are defintions in tiles.xml:
>> <definition name="baseLayout" template="/jsp/layout/BaseLayout.jsp">
>> <put-attribute name="title" value="" />
>> <put-attribute name="header" value="/jsp/header.jsp" />
>> <put-attribute name="menu" value="" />
>> <put-attribute name="body" value="" />
>> </definition>
>>
>> <definition name="/index" extends="baseLayout">
>> <put-attribute name="title" value="Index" />
>> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
>> <put-attribute name="body" value="/jsp/index.jsp" />
>> </definition>
>>
>> <definition name="/search" extends="baseLayout">
>> <put-attribute name="title" value="Search" />
>> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
>> <put-attribute name="body" value="/jsp/search.jsp" />
>> </definition>
>> Here is Struts.xml:
>> <struts>
>> <constant name="struts.objectFactory" value="spring" />
>> <constant name="struts.convention.action.packages"
>> value="fr.itsystem.masyv.web" />
>> <constant name="struts.convention.package.locators"
>> value="action,actions,struts,struts2,web"/>
>> <constant name="struts.convention.action.suffix" value="Action" />
>> <constant name="struts.convention.action.mapAllMatches" value="true" />
>> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
>> <constant name="struts.custom.i18n.resources" value="global" />
>> <package name="default" extends="struts-default">
>> <result-types>
>> <result-type name="tiles"
>> class="org.apache.struts2.views.tiles.TilesResult" />
>> </result-types>
>> </package>
>> </struts>
>> Here are declarations of the context and listener of tiles in my web.xml:
>> <context-param>
>> <description>Tiles configuration file</description>
>>
>> <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
>> <param-value>
>> /WEB-INF/classes/tiles.xml
>> </param-value>
>> </context-param>
>> <listener>
>>
>> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
>> </listener>
>>
>> Thank you a lot in advance.
>>
>> Sincerly
>>
>> Amine
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Tiles Struts2 Annotations
Posted by Amine BADID <am...@yahoo.fr>.
Hi Dave.
I tried to use theses syntaxe:
<package name="default" extends="struts-default">
and
<package name="tiles-default" extends="struts-default">
The both are "false" and did not resolve my problem
Here are a scan image of libraries and thank you a lot :
Le Dimanche 22 juin 2014 16h14, Dave Newton <da...@gmail.com> a écrit :
What libraries/jars are you deploying? Are you using a parent package that
extends tiles-default?
On Jun 22, 2014 10:07 AM, "Amine BADID" <am...@yahoo.fr> wrote:
> Hi All.
> I'm workgin on JEE web application, using Struts2 with annotations and
> tiles too.
> I've an error:
> - 2014-06-22 15:53:51,187 ERROR [org.apache.struts2.dispatcher.Dispatcher]
> - <Dispatcher initialization failed>
> Unable to load configuration. - [unknown location]
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
> at
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
> at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
> at
> org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
> at
> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
> at
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
> at
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
> at
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
> at
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
> at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
> 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.run(FutureTask.java:262)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: The Result type [tiles] which is defined in the Result
> annotation on the class [class mypackage.WelcomeAction] 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 [mypackage#convention-default#/] - [unknown location]
> at
> org.apache.struts2.convention.DefaultResultMapBuilder.createResultConfig(DefaultResultMapBuilder.java:438)
> at
> org.apache.struts2.convention.DefaultResultMapBuilder.createFromAnnotations(DefaultResultMapBuilder.java:410)
> at
> org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:202)
> at
> org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:935)
> at
> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:718)
> at
> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:348)
> at
> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:260)
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
> Here is WelcomeAction class:
> @Action(value = "menu",
> results = {
> @Result(name = SUCCESS, location = "/search", type=
> "tiles"),
> @Result(name=INPUT, location = "/index", type =
> "tiles"),
> @Result(name = ERROR, location = "/index", type =
> "tiles")
> }
> )
> And here are defintions in tiles.xml:
> <definition name="baseLayout" template="/jsp/layout/BaseLayout.jsp">
> <put-attribute name="title" value="" />
> <put-attribute name="header" value="/jsp/header.jsp" />
> <put-attribute name="menu" value="" />
> <put-attribute name="body" value="" />
> </definition>
>
> <definition name="/index" extends="baseLayout">
> <put-attribute name="title" value="Index" />
> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
> <put-attribute name="body" value="/jsp/index.jsp" />
> </definition>
>
> <definition name="/search" extends="baseLayout">
> <put-attribute name="title" value="Search" />
> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
> <put-attribute name="body" value="/jsp/search.jsp" />
> </definition>
> Here is Struts.xml:
> <struts>
> <constant name="struts.objectFactory" value="spring" />
> <constant name="struts.convention.action.packages"
> value="fr.itsystem.masyv.web" />
> <constant name="struts.convention.package.locators"
> value="action,actions,struts,struts2,web"/>
> <constant name="struts.convention.action.suffix" value="Action" />
> <constant name="struts.convention.action.mapAllMatches" value="true" />
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> <constant name="struts.custom.i18n.resources" value="global" />
> <package name="default" extends="struts-default">
> <result-types>
> <result-type name="tiles"
> class="org.apache.struts2.views.tiles.TilesResult" />
> </result-types>
> </package>
> </struts>
> Here are declarations of the context and listener of tiles in my web.xml:
> <context-param>
> <description>Tiles configuration file</description>
>
> <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
> <param-value>
> /WEB-INF/classes/tiles.xml
> </param-value>
> </context-param>
> <listener>
>
> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
> </listener>
>
> Thank you a lot in advance.
>
> Sincerly
>
> Amine
>
Re: Tiles Struts2 Annotations
Posted by Dave Newton <da...@gmail.com>.
What libraries/jars are you deploying? Are you using a parent package that
extends tiles-default?
On Jun 22, 2014 10:07 AM, "Amine BADID" <am...@yahoo.fr> wrote:
> Hi All.
> I'm workgin on JEE web application, using Struts2 with annotations and
> tiles too.
> I've an error:
> - 2014-06-22 15:53:51,187 ERROR [org.apache.struts2.dispatcher.Dispatcher]
> - <Dispatcher initialization failed>
> Unable to load configuration. - [unknown location]
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
> at
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
> at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
> at
> org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
> at
> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
> at
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
> at
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
> at
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
> at
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
> at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
> 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.run(FutureTask.java:262)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: The Result type [tiles] which is defined in the Result
> annotation on the class [class mypackage.WelcomeAction] 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 [mypackage#convention-default#/] - [unknown location]
> at
> org.apache.struts2.convention.DefaultResultMapBuilder.createResultConfig(DefaultResultMapBuilder.java:438)
> at
> org.apache.struts2.convention.DefaultResultMapBuilder.createFromAnnotations(DefaultResultMapBuilder.java:410)
> at
> org.apache.struts2.convention.DefaultResultMapBuilder.build(DefaultResultMapBuilder.java:202)
> at
> org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:935)
> at
> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:718)
> at
> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:348)
> at
> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:260)
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
> Here is WelcomeAction class:
> @Action(value = "menu",
> results = {
> @Result(name = SUCCESS, location = "/search", type=
> "tiles"),
> @Result(name=INPUT, location = "/index", type =
> "tiles"),
> @Result(name = ERROR, location = "/index", type =
> "tiles")
> }
> )
> And here are defintions in tiles.xml:
> <definition name="baseLayout" template="/jsp/layout/BaseLayout.jsp">
> <put-attribute name="title" value="" />
> <put-attribute name="header" value="/jsp/header.jsp" />
> <put-attribute name="menu" value="" />
> <put-attribute name="body" value="" />
> </definition>
>
> <definition name="/index" extends="baseLayout">
> <put-attribute name="title" value="Index" />
> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
> <put-attribute name="body" value="/jsp/index.jsp" />
> </definition>
>
> <definition name="/search" extends="baseLayout">
> <put-attribute name="title" value="Search" />
> <put-attribute name="menu" value="/jsp/menu_index.jsp" />
> <put-attribute name="body" value="/jsp/search.jsp" />
> </definition>
> Here is Struts.xml:
> <struts>
> <constant name="struts.objectFactory" value="spring" />
> <constant name="struts.convention.action.packages"
> value="fr.itsystem.masyv.web" />
> <constant name="struts.convention.package.locators"
> value="action,actions,struts,struts2,web"/>
> <constant name="struts.convention.action.suffix" value="Action" />
> <constant name="struts.convention.action.mapAllMatches" value="true" />
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> <constant name="struts.custom.i18n.resources" value="global" />
> <package name="default" extends="struts-default">
> <result-types>
> <result-type name="tiles"
> class="org.apache.struts2.views.tiles.TilesResult" />
> </result-types>
> </package>
> </struts>
> Here are declarations of the context and listener of tiles in my web.xml:
> <context-param>
> <description>Tiles configuration file</description>
>
> <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
> <param-value>
> /WEB-INF/classes/tiles.xml
> </param-value>
> </context-param>
> <listener>
>
> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
> </listener>
>
> Thank you a lot in advance.
>
> Sincerly
>
> Amine
>