You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peer Mohammad <pe...@gmail.com> on 2020/11/01 11:05:43 UTC

Re: Issue in migration from struts2.3.35 to struts2.5.22

I have not used Xwork, index.jsp has <tiles:inserDefinition name="cheetta.login" flush="true"/> and cheetta.login is given in struts.xml with action class.This setup is working last 7 years on struts2.3.35 .
Note sure why its failing on upgraded version.I debugged and saw that Valustack returning null for the request.

Thanks & Regards,
Peer M Ansari

On 2020/10/29 12:57:57, Lukasz Lenart <lu...@apache.org> wrote: 
> czw., 29 paź 2020 o 11:24 Peer Mohammad <pe...@gmail.com> napisał(a):
> > list of jars for Strust2.5.22
> >
> > struts2-core 2.5.22
> > freemarker -2.3.30
> > xwork-core -2.3.37
> 
> As I said, this is not needed, XWork was merged into Struts Core, you
> are duplicating classes now
> 
> > Caused by: There is no ActionContext for current request! - [unknown location]
> >
> >     at org.apache.jsp.index_jsp._jspx_meth_tiles_005finsertDefinition_005f0(index_jsp.java:151)
> 
> You are accessing index.jsp directly by
>         <welcome-file-list>
>                 <welcome-file>index.jsp</welcome-file>
>         </welcome-file-list>
> 
> 
> Regards
> -- 
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


Re: Issue in migration from struts2.3.35 to struts2.5.22

Posted by James Chaplin <jc...@apache.org>.
Hello Peer.

I am not sure if any of these suggestions will help or not, but you never know.

There is a blog post (http://www.programmers-code.org/2017/10/23/struts-tiles-locale-resolver-cannot-obtain-httpservletrequest/) that mentions receiving similar errors due to request.getAttribute("x") calls within the JSPs.  You can check your application's JSPs to see if you have any similar direct calls, and try what the blog suggests (replace request with requestScope), to see if it makes any difference.

There is a commented-out Tiles 1-or-2 context-param entry in the application's web.xml from your earlier mailing list post.  It probably will not make a difference, but you could try explicitly setting the Tiles 3 equivalent:

<context-param>
    <param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
</context-param>

in the application's web.xml and see if it makes any difference in the application's behaviour.

The error you are getting indicates that the StrutsTilesLocaleResolver for the Struts 2 Tiles Plugin cannot locate the ActionContext for the request.  That could mean that processing is somehow ending up at one of your JSPs without following the normal action execution path.  You might try increasing the log levels to DEBUG temporarily to see if that turns up any information that might help.

Another suggestion is that you could try temporarily changing your application's configuration to use the "defaultStack" interceptor stack (and then add any custom interceptors you need), to see if that makes any difference.  There maybe something subtle with the interceptors (or ordering) that is impacting processing, and the struts.xml from your earlier post has custom interceptor stacks, so going back to the basic defaults might help you debug further.

Regards,

James.


On 2020/11/01 11:05:43, Peer Mohammad <pe...@gmail.com> wrote: 
> I have not used Xwork, index.jsp has <tiles:inserDefinition name="cheetta.login" flush="true"/> and cheetta.login is given in struts.xml with action class.This setup is working last 7 years on struts2.3.35 .
> Note sure why its failing on upgraded version.I debugged and saw that Valustack returning null for the request.
> 
> Thanks & Regards,
> Peer M Ansari
> 
> On 2020/10/29 12:57:57, Lukasz Lenart <lu...@apache.org> wrote: 
> > czw., 29 paź 2020 o 11:24 Peer Mohammad <pe...@gmail.com> napisał(a):
> > > list of jars for Strust2.5.22
> > >
> > > struts2-core 2.5.22
> > > freemarker -2.3.30
> > > xwork-core -2.3.37
> > 
> > As I said, this is not needed, XWork was merged into Struts Core, you
> > are duplicating classes now
> > 
> > > Caused by: There is no ActionContext for current request! - [unknown location]
> > >
> > >     at org.apache.jsp.index_jsp._jspx_meth_tiles_005finsertDefinition_005f0(index_jsp.java:151)
> > 
> > You are accessing index.jsp directly by
> >         <welcome-file-list>
> >                 <welcome-file>index.jsp</welcome-file>
> >         </welcome-file-list>
> > 
> > 
> > Regards
> > -- 
> > Łukasz
> > + 48 606 323 122 http://www.lenart.org.pl/
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


Re: Issue in migration from struts2.3.35 to struts2.5.22

Posted by Lukasz Lenart <lu...@apache.org>.
niedz., 1 lis 2020 o 14:25 Peer Mohammad <pe...@gmail.com> napisał(a):
>
> I have not used Xwork, index.jsp has <tiles:inserDefinition name="cheetta.login" flush="true"/> and cheetta.login is given in struts.xml with action class.This setup is working last 7 years on struts2.3.35 .

You are not using Xwork directly but you have xwork.jar on the
classpath, and some classes can conflict - remove the jar.

Next, you are accessing index.jsp directly and not via action - that's
why you are getting the exception. You are using Struts related Tiles
listener which expects that all the Tiles definitions (in this case
"cheetta.login") will be accessed via action. So the flow supposed to
be as follow:

browser -> action -> JSP -> Tiles definition

In your case there is no action when you're accessing index.jsp. If
you don't use any of the Struts Tile listener features you can switch
to "org.apache.tiles.listener.TilesListener" as pointed in the
documentation https://struts.apache.org/plugins/tiles/#usage

And yes, for the last 7 years we have been developing and extending
Struts that's why some things have changed.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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