You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ashish chawre <as...@gmail.com> on 2010/12/06 15:46:51 UTC

Problem in calling method from Struts.xml in struts2

Hi list,

I am trying to call execute method of my UserRegistrationAction class but it
doesn't call the method.
Here is the code of my struts.xml :

<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false"/>
    <constant name="struts.devMode" value="false"/>

    <package name="company" extends="tiles-default">
        <action name="d_*" class="com.company.action.{1}" method="input">
            <result type="tiles">{1}</result>
            <result name="input" type="tiles">{1}</result>
        </action>
        <action name="LoginAction" class="com.company.action.LoginAction"
method="execute">
            <result type="redirect">d_UserRegistrationAction</result>
            <result name="input" type="tiles">LoginAction</result>
        </action>
        <action name="UserRegistrationAction"
class="com.company.action.UserRegistrationAction" method="execute">
            <result type="tiles">d_UserListAction</result>
            <result name="input" type="tiles">d_UserListAction</result>
        </action>
    </package>
</struts>

In above code when I am calling execute for LoginAction action its working
fine but when I do the same for UserRegistrationAction, the execute method
of this class is not getting called instead its giving error
*java.lang.NoSuchMethodError:
com.company.delegate.UserDelegate.add(Lcom/blisstech/dto/UserDTO;)J
com.company.action.UserRegistrationAction.execute(UserRegistrationAction.java:175)
*

Any help will be much appreciated.

Thanks in advance.

-- Ashish

Re: Problem in calling method from Struts.xml in struts2

Posted by Li Ying <li...@gmail.com>.
BTW, according to the exception message:

The execute method of UserRegistrationAction IS CALLED,
but some code invoked by this method raised an exception.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem in calling method from Struts.xml in struts2

Posted by ashish chawre <as...@gmail.com>.
Thanks Li.. Yeh, it happens.. This trick certainly saves time.


-- Ashish

On Mon, Dec 6, 2010 at 4:02 PM, Li Ying <li...@gmail.com> wrote:

> It looks like, the latest class files were not deployed to the WebApp
> Context.
>
> Sometimes this happens.
>
> When you find something getting wrong, and your source code looks like
> right,
> Just try turn off the web app, and re-deployed your latest code again.
> See if it the error get fixed.
>
> Sometimes, this can save your lots of time.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Problem in calling method from Struts.xml in struts2

Posted by Li Ying <li...@gmail.com>.
It looks like, the latest class files were not deployed to the WebApp Context.

Sometimes this happens.

When you find something getting wrong, and your source code looks like right,
Just try turn off the web app, and re-deployed your latest code again.
See if it the error get fixed.

Sometimes, this can save your lots of time.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem in calling method from Struts.xml in struts2

Posted by ashish chawre <as...@gmail.com>.
Thanks everyone for your responses. The problem is fixed but I don't know
how :).. What I did is just turn off my computer after battling with the
prob, thought to take a drive and when I came back and start the application
again
its just working fine. I got all my records in db using the same
configuration.

I will be posting my findings if I could regenerate the problem again.

Thanks a lot!

-- Ashish

On Mon, Dec 6, 2010 at 9:53 AM, Dave Newton <da...@gmail.com> wrote:

> You might *think* it's there, but I'm pretty sure it isn't--is the correct
> version deployed? Are its dependencies deployed?
>
> The message is pretty explicit with regards to what's wrong.
>
> Dave
>
> On Mon, Dec 6, 2010 at 12:10 PM, ashish chawre <ashish.chawre80@gmail.com
> >wrote:
>
> > .
>

Re: Problem in calling method from Struts.xml in struts2

Posted by Dave Newton <da...@gmail.com>.
You might *think* it's there, but I'm pretty sure it isn't--is the correct
version deployed? Are its dependencies deployed?

The message is pretty explicit with regards to what's wrong.

Dave

On Mon, Dec 6, 2010 at 12:10 PM, ashish chawre <as...@gmail.com>wrote:

> .

Re: Problem in calling method from Struts.xml in struts2

Posted by ashish chawre <as...@gmail.com>.
Thanks for the prompt reply Maurizio.
I also thought the same but I checked my UserDelegates class and got
add(UserDTO) declared there. In this delegate I am getting service class
object trough a ServiceLocator and it seems the object is not getting
created for UserService class.

Please find UserRegistrationAction.java in the attachment which you have
asked for. I am amazed why the log is not being printed which I have put
inside execute() method.

Thanks!
--
Ashish

On Mon, Dec 6, 2010 at 6:55 AM, Maurizio Cucchiara <
maurizio.cucchiara@gmail.com> wrote:

> It looks like there is something wrong in your UserDelegate class.
> Have you declared an add(UserDTO) method inside it?
> Could you post UserRegistrationAction code?
>
>
> 2010/12/6 ashish chawre <as...@gmail.com>:
> > Hi list,
> >
> > I am trying to call execute method of my UserRegistrationAction class but
> it
> > doesn't call the method.
> > Here is the code of my struts.xml :
> >
> > <struts>
> >    <constant name="struts.enable.DynamicMethodInvocation" value="false"/>
> >    <constant name="struts.devMode" value="false"/>
> >
> >    <package name="company" extends="tiles-default">
> >        <action name="d_*" class="com.company.action.{1}" method="input">
> >            <result type="tiles">{1}</result>
> >            <result name="input" type="tiles">{1}</result>
> >        </action>
> >        <action name="LoginAction" class="com.company.action.LoginAction"
> > method="execute">
> >            <result type="redirect">d_UserRegistrationAction</result>
> >            <result name="input" type="tiles">LoginAction</result>
> >        </action>
> >        <action name="UserRegistrationAction"
> > class="com.company.action.UserRegistrationAction" method="execute">
> >            <result type="tiles">d_UserListAction</result>
> >            <result name="input" type="tiles">d_UserListAction</result>
> >        </action>
> >    </package>
> > </struts>
> >
> > In above code when I am calling execute for LoginAction action its
> working
> > fine but when I do the same for UserRegistrationAction, the execute
> method
> > of this class is not getting called instead its giving error
> > *java.lang.NoSuchMethodError:
> > com.company.delegate.UserDelegate.add(Lcom/blisstech/dto/UserDTO;)J
> >
> com.company.action.UserRegistrationAction.execute(UserRegistrationAction.java:175)
> > *
> >
> > Any help will be much appreciated.
> >
> > Thanks in advance.
> >
> > -- Ashish
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Problem in calling method from Struts.xml in struts2

Posted by Maurizio Cucchiara <ma...@gmail.com>.
It looks like there is something wrong in your UserDelegate class.
Have you declared an add(UserDTO) method inside it?
Could you post UserRegistrationAction code?


2010/12/6 ashish chawre <as...@gmail.com>:
> Hi list,
>
> I am trying to call execute method of my UserRegistrationAction class but it
> doesn't call the method.
> Here is the code of my struts.xml :
>
> <struts>
>    <constant name="struts.enable.DynamicMethodInvocation" value="false"/>
>    <constant name="struts.devMode" value="false"/>
>
>    <package name="company" extends="tiles-default">
>        <action name="d_*" class="com.company.action.{1}" method="input">
>            <result type="tiles">{1}</result>
>            <result name="input" type="tiles">{1}</result>
>        </action>
>        <action name="LoginAction" class="com.company.action.LoginAction"
> method="execute">
>            <result type="redirect">d_UserRegistrationAction</result>
>            <result name="input" type="tiles">LoginAction</result>
>        </action>
>        <action name="UserRegistrationAction"
> class="com.company.action.UserRegistrationAction" method="execute">
>            <result type="tiles">d_UserListAction</result>
>            <result name="input" type="tiles">d_UserListAction</result>
>        </action>
>    </package>
> </struts>
>
> In above code when I am calling execute for LoginAction action its working
> fine but when I do the same for UserRegistrationAction, the execute method
> of this class is not getting called instead its giving error
> *java.lang.NoSuchMethodError:
> com.company.delegate.UserDelegate.add(Lcom/blisstech/dto/UserDTO;)J
> com.company.action.UserRegistrationAction.execute(UserRegistrationAction.java:175)
> *
>
> Any help will be much appreciated.
>
> Thanks in advance.
>
> -- Ashish
>



-- 
Maurizio Cucchiara

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org