Thanks, I did get a response on stack overflow...

http://stackoverflow.com/questions/12683224/struts2-i18ninterceptor-no-longer-working-with-executeandwaitinterceptor

... more specifically in the struts2 documentation...

Important: Because the action will be running in a seperate thread,
you can't use ActionContext because it is a ThreadLocal. This means if
you need to access, for example, session data, you need to implement
SessionAware rather than calling ActionContext.getSession().

... I think you and Alexandr are correct. Since there is no
ActionContext, tiles not called.

I found a different way to get the locale, so I'm actually OK with
this for the time being. But if anyone has a solution, I'm all ears.


On 10/3/12, Nicolas Le Bas <[email protected]> wrote:
> Hi,
>
> According to the stack trace you provide, Tiles is not even called... can't
> help you there. Perhaps try the struts users list?
>
> Ryan Beckes <[email protected]> wrote:
>
>>Hello,
>>
>>I'm using the struts2 tiles plugin (v2.2.3) and I'm having a problem
>>using the I18nInterceptor with the ExecuteAndWaitInterceptor.
>>Essentially when I add the execAndWait interceptor (see xml below) for
>>some reason the localization no longer works and when I try to get
>>localized text (e.g. TextProviderSupport.hasKey) I get a
>>NullPointerException (see error) that I narrowed down to this code in
>>LocalizedTextUtil...
>>
>>    358:public static String findText(Class aClass, String aTextName,
>>Locale locale, String defaultMessage, Object[] args) {
>>    359:    ValueStack valueStack =
>> ActionContext.getContext().getValueStack();
>>    360:    return findText(aClass, aTextName, locale, defaultMessage,
>>args, valueStack);
>>    361:
>>    362:}
>>
>>... I'm assuming my valuestack is null for some reason, but I cannot
>>figure out why. Any ideas?
>>
>>Thanks,
>>Ryan
>>
>>java.lang.NullPointerException
>>  at
>> com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:359)
>>  at
>> com.opensymphony.xwork2.TextProviderSupport.hasKey(TextProviderSupport.java:98)
>>  at com.opensymphony.xwork2.ActionSupport.hasKey(ActionSupport.java:96)
>>  at com.test.plus.PlusSupport.getCurrentLocale(PlusSupport.java:213)
>>  at
>> com.test.plus.import.Test.action.TestAction.testMethod(TestAction.java:801)
>>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>  at java.lang.reflect.Method.invoke(Unknown Source)
>>  at
>> com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
>>  at
>> com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
>>  at
>> org.apache.struts2.interceptor.BackgroundProcess$1.run(BackgroundProcess.java:57)
>>  at java.lang.Thread.run(Unknown Source)
>>
>>
>>        <action name="Test/m/testMethod" method="testMethod"
>>class="com.test.plus.import.Test.action.TestAction">
>>            <result
>>type="tiles">/WEB-INF/jsp/import/Test/testMethod.jsp</result>
>>            <result name="success"
>>type="tiles">/WEB-INF/jsp/import/Test/testMethod.jsp</result>
>>            <result name="input"
>>type="tiles">/WEB-INF/jsp/import/Test/testMethod.jsp</result>
>>            <result name="error"
>>type="tiles">/WEB-INF/jsp/import/Test/testMethod.jsp</result>
>>            <result name="wait"
>>type="tiles">/WEB-INF/jsp/import/execAndWait.jsp</result>
>>            <interceptor-ref name="plusStack"/>
>>            <interceptor-ref name="defaultStack"/>
>>            <interceptor-ref name="execAndWait">
>>              <param name="excludeMethods">input,back,cancel</param>
>>            </interceptor-ref>
>>        </action>
>>
>>
>>--

Reply via email to