Your action mapping has class="mainpage", but your Spring configuration
has id="mainpageAction". These should be the same. I'm not quite sure
how you're getting the error you are, though, based on that
configuration. And I don't see how introducing an @Result annotation
would effect it. I suspect you have some out-of-date config files
deployed or something, since the error is inconsistent with what you
show here.
Try doing a clean build/deploy and check that the deployed configuration
is what you think it is. One other point to check: do you have the
struts2-spring plugin deployed? You need that to allow your actions to
be managed by Spring.
L.
georgievh wrote:
Every thing works perfectly if I do not use annotations but use configuration
xml files.
My annotation part is as follows:
@Result(
name="success",
value="mainpage.page",
type=TilesResult.class)
I use the following configuration in an xml file and it works:
<package name="mainpage" namespace="/" extends="tiles-default">
<action name="mainpage" class="mainpage">
<result name="success" type="tiles">mainpage.page</result>
</action>
<!-- Add actions here -->
</package>
Using annotations I have error message (look below)
From the error message I think that Struts is trying to create my Action
object and it fails because I do not have a default constructor.
It could be the case, thought, that Spring managed to successfully create
the object but I do not refer to it the right way.
In my applicationContext.xml I have:
<bean id="mainpageAction"
class="com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction"
autowire="autodetect"
singleton="false">
<constructor-arg>
<value>Buenos Dias!</value>
</constructor-arg>
</bean>
Does my id have the right value (id=”mainpageAction”)?
ERROR:
=======
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: Unable to intantiate Action!
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
Unable to intantiate Action!
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:277)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
java.lang.InstantiationException:
com.gbsoft.belfin.communitypages.actions.mainpage.MainpageAction
java.lang.Class.newInstance0(Class.java:335)
java.lang.Class.newInstance(Class.java:303)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:123)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:148)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:128)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:113)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:275)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
note The full stack trace of the root cause is available in the
JBossWeb/2.0.1.GA logs.
JBossWeb/2.0.1.GA
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]