You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steven Yang <ke...@gmail.com> on 2013/04/24 13:52:09 UTC

interceptor init twice

I was using 2.1.8 and recently upgraded to 2.3.14.
And I realized that my interceptor got initialized twice and it didnt
happen before.

This happens when I declare a default package in struts.xml and include
other xml which have packages that extends my default package. But the
thing is no matter how many more xml I include the interceptor will only be
initialize one extra time.

the following is my sample struts.xml

 <package name="default" namespace="/" extends="struts-default">

<interceptors>
<interceptor name="baseGeneral" class="GeneralInterceptor"></interceptor>
<interceptor-stack name="biStack">
<interceptor-ref name="baseGeneral"/>
</interceptor-stack>
</interceptors>
        <default-action-ref name="index" />

        <global-results>
            <result name="error">/error.jsp</result>
        </global-results>

        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception"
result="error"/>
        </global-exception-mappings>

        <action name="index">
            <result type="redirectAction">
                <param name="actionName">HelloWorld</param>
                <param name="namespace">/example</param>
            </result>
        </action>
    </package>

    <include file="example.xml"/>

my example.xml

  <package name="example" namespace="/example" extends="default">

        <action name="HelloWorld" class="example.HelloWorld">
            <result>/example/HelloWorld.jsp</result>
        </action>
</package>

I traced the log and see the that my default package is been initialized
twice and it seems that struts knows about it but it still called init() on
my interceptor.
partial log:

2013-04-24 11:57:58,504 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Using default implementation of FileManager
provided under name [system]: DefaultFileManager
2013-04-24 11:57:58,505 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
namespace:/ parents:[{PackageConfig Name:struts-default namespace:
parents:[]}]}
GeneralInterceptor.init()
2013-04-24 11:57:58,509 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig
index () - action -
file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
2013-04-24 11:57:58,510 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:example
namespace:/example parents:[{PackageConfig Name:default namespace:/
parents:[{PackageConfig Name:struts-default namespace: parents:[]}]}]}
2013-04-24 11:57:58,513 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example'
package:{ActionConfig HelloWorld (example.HelloWorld) - action -
file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62}
2013-04-24 11:57:58,514 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded /example/Login_* in 'example'
package:{ActionConfig Login_* (example.Login.{1}()) - action -
file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67}
2013-04-24 11:57:58,514 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded /example/* in 'example'
package:{ActionConfig * (example.ExampleSupport) - action -
file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57}
2013-04-24 11:57:58,515 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
namespace:/ parents:[{PackageConfig Name:struts-default namespace:
parents:[]}]}
GeneralInterceptor.init()
2013-04-24 11:57:58,516 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig
index () - action -
file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
2013-04-24 11:57:58,516 DEBUG
com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
(Slf4jLogger.java:69) - The package name 'default' is already been loaded
by the same location and could be removed: package -
file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68


as you can see struts knows that "default" has been loaded before however
my interceptor still prints out init message.

If I remove the include or move the "default" package declaration out to
another file and use include to include it in struts.xml the problem goes
away.

Is this behavior correct? or I am using something in the wrong way?

Thanks

Re: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
finally got time to test it and it works wonder
thanks


On Fri, May 17, 2013 at 4:09 PM, Steven Yang <ke...@gmail.com> wrote:

> Thanks will do asap
>
>
> On Fri, May 17, 2013 at 2:39 PM, Lukasz Lenart <lu...@apache.org>wrote:
>
>> Committed, please check with the latest snapshot.
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>>
>> 2013/5/17 Steven Yang <ke...@gmail.com>:
>> > Wow that's fast
>> >
>> > here it is
>> > https://issues.apache.org/jira/browse/WW-4067
>> >
>> > thanks
>> >
>> >
>> > On Fri, May 17, 2013 at 3:42 AM, Lukasz Lenart <lukaszlenart@apache.org
>> >wrote:
>> >
>> >> Fix is ready, I just need a JIRA task :-)
>> >>
>> >> 2013/5/16 Lukasz Lenart <lu...@apache.org>:
>> >> > I have been looking into that and I am sure that's the problem, could
>> >> > you register an issue with JIRA?
>> >> >
>> >> >
>> >> > Thanks in advance
>> >> > --
>> >> > Łukasz
>> >> > + 48 606 323 122 http://www.lenart.org.pl/
>> >> >
>> >> > 2013/5/16 Lukasz Lenart <lu...@apache.org>:
>> >> >> Maybe your problem is related to:
>> >> >>
>> >> >> https://issues.apache.org/jira/browse/WW-3870
>> >> >>
>> >> >>
>> >> >> Regards
>> >> >> --
>> >> >> Łukasz
>> >> >> + 48 606 323 122 http://www.lenart.org.pl/
>> >> >>
>> >> >>
>> >> >> 2013/5/9 Steven Yang <ke...@gmail.com>:
>> >> >>> thanks good to know i am not being forgotten :)
>> >> >>>
>> >> >>>
>> >> >>> On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <
>> >> lukaszlenart@apache.org>wrote:
>> >> >>>
>> >> >>>> It's on my ToDo list ;-)
>> >> >>>>
>> >> >>>> 2013/5/9 Steven Yang <ke...@gmail.com>:
>> >> >>>> > Hi just wondering is anyone as any insight on this? Or do I
>> need to
>> >> >>>> provide
>> >> >>>> > more information?
>> >> >>>> >
>> >> >>>> > thanks
>> >> >>>> >
>> >> >>>> >
>> >> >>>> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <
>> kenshin520@gmail.com>
>> >> >>>> wrote:
>> >> >>>> >
>> >> >>>> >> same behavior for devMode=true and false
>> >> >>>> >>
>> >> >>>> >> i am not sure what you mean, shouldnt init only be called
>> during
>> >> >>>> >> initialization?
>> >> >>>> >> or do you want to confirm that when I run my app after
>> >> initialization,
>> >> >>>> the
>> >> >>>> >> init method wont be called again?
>> >> >>>> >> so far the observation is that this only happen during
>> >> initialization
>> >> >>>> and
>> >> >>>> >> before I access any of my actions, and no more init called
>> after
>> >> that
>> >> >>>> >>
>> >> >>>> >>
>> >> >>>> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <
>> >> lukaszlenart@apache.org
>> >> >>>> >wrote:
>> >> >>>> >>
>> >> >>>> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
>> >> >>>> >>> > with version 2.3.12, same behavior.
>> >> >>>> >>>
>> >> >>>> >>> Is this happen only during initialisation? in devMode?
>> >> >>>> >>>
>> >> >>>> >>>
>> >> >>>> >>> 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
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

Re: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
Thanks will do asap


On Fri, May 17, 2013 at 2:39 PM, Lukasz Lenart <lu...@apache.org>wrote:

> Committed, please check with the latest snapshot.
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
>
> 2013/5/17 Steven Yang <ke...@gmail.com>:
> > Wow that's fast
> >
> > here it is
> > https://issues.apache.org/jira/browse/WW-4067
> >
> > thanks
> >
> >
> > On Fri, May 17, 2013 at 3:42 AM, Lukasz Lenart <lukaszlenart@apache.org
> >wrote:
> >
> >> Fix is ready, I just need a JIRA task :-)
> >>
> >> 2013/5/16 Lukasz Lenart <lu...@apache.org>:
> >> > I have been looking into that and I am sure that's the problem, could
> >> > you register an issue with JIRA?
> >> >
> >> >
> >> > Thanks in advance
> >> > --
> >> > Łukasz
> >> > + 48 606 323 122 http://www.lenart.org.pl/
> >> >
> >> > 2013/5/16 Lukasz Lenart <lu...@apache.org>:
> >> >> Maybe your problem is related to:
> >> >>
> >> >> https://issues.apache.org/jira/browse/WW-3870
> >> >>
> >> >>
> >> >> Regards
> >> >> --
> >> >> Łukasz
> >> >> + 48 606 323 122 http://www.lenart.org.pl/
> >> >>
> >> >>
> >> >> 2013/5/9 Steven Yang <ke...@gmail.com>:
> >> >>> thanks good to know i am not being forgotten :)
> >> >>>
> >> >>>
> >> >>> On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <
> >> lukaszlenart@apache.org>wrote:
> >> >>>
> >> >>>> It's on my ToDo list ;-)
> >> >>>>
> >> >>>> 2013/5/9 Steven Yang <ke...@gmail.com>:
> >> >>>> > Hi just wondering is anyone as any insight on this? Or do I need
> to
> >> >>>> provide
> >> >>>> > more information?
> >> >>>> >
> >> >>>> > thanks
> >> >>>> >
> >> >>>> >
> >> >>>> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <
> kenshin520@gmail.com>
> >> >>>> wrote:
> >> >>>> >
> >> >>>> >> same behavior for devMode=true and false
> >> >>>> >>
> >> >>>> >> i am not sure what you mean, shouldnt init only be called during
> >> >>>> >> initialization?
> >> >>>> >> or do you want to confirm that when I run my app after
> >> initialization,
> >> >>>> the
> >> >>>> >> init method wont be called again?
> >> >>>> >> so far the observation is that this only happen during
> >> initialization
> >> >>>> and
> >> >>>> >> before I access any of my actions, and no more init called after
> >> that
> >> >>>> >>
> >> >>>> >>
> >> >>>> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <
> >> lukaszlenart@apache.org
> >> >>>> >wrote:
> >> >>>> >>
> >> >>>> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
> >> >>>> >>> > with version 2.3.12, same behavior.
> >> >>>> >>>
> >> >>>> >>> Is this happen only during initialisation? in devMode?
> >> >>>> >>>
> >> >>>> >>>
> >> >>>> >>> 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
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: interceptor init twice

Posted by Lukasz Lenart <lu...@apache.org>.
Committed, please check with the latest snapshot.


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


2013/5/17 Steven Yang <ke...@gmail.com>:
> Wow that's fast
>
> here it is
> https://issues.apache.org/jira/browse/WW-4067
>
> thanks
>
>
> On Fri, May 17, 2013 at 3:42 AM, Lukasz Lenart <lu...@apache.org>wrote:
>
>> Fix is ready, I just need a JIRA task :-)
>>
>> 2013/5/16 Lukasz Lenart <lu...@apache.org>:
>> > I have been looking into that and I am sure that's the problem, could
>> > you register an issue with JIRA?
>> >
>> >
>> > Thanks in advance
>> > --
>> > Łukasz
>> > + 48 606 323 122 http://www.lenart.org.pl/
>> >
>> > 2013/5/16 Lukasz Lenart <lu...@apache.org>:
>> >> Maybe your problem is related to:
>> >>
>> >> https://issues.apache.org/jira/browse/WW-3870
>> >>
>> >>
>> >> Regards
>> >> --
>> >> Łukasz
>> >> + 48 606 323 122 http://www.lenart.org.pl/
>> >>
>> >>
>> >> 2013/5/9 Steven Yang <ke...@gmail.com>:
>> >>> thanks good to know i am not being forgotten :)
>> >>>
>> >>>
>> >>> On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <
>> lukaszlenart@apache.org>wrote:
>> >>>
>> >>>> It's on my ToDo list ;-)
>> >>>>
>> >>>> 2013/5/9 Steven Yang <ke...@gmail.com>:
>> >>>> > Hi just wondering is anyone as any insight on this? Or do I need to
>> >>>> provide
>> >>>> > more information?
>> >>>> >
>> >>>> > thanks
>> >>>> >
>> >>>> >
>> >>>> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com>
>> >>>> wrote:
>> >>>> >
>> >>>> >> same behavior for devMode=true and false
>> >>>> >>
>> >>>> >> i am not sure what you mean, shouldnt init only be called during
>> >>>> >> initialization?
>> >>>> >> or do you want to confirm that when I run my app after
>> initialization,
>> >>>> the
>> >>>> >> init method wont be called again?
>> >>>> >> so far the observation is that this only happen during
>> initialization
>> >>>> and
>> >>>> >> before I access any of my actions, and no more init called after
>> that
>> >>>> >>
>> >>>> >>
>> >>>> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <
>> lukaszlenart@apache.org
>> >>>> >wrote:
>> >>>> >>
>> >>>> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
>> >>>> >>> > with version 2.3.12, same behavior.
>> >>>> >>>
>> >>>> >>> Is this happen only during initialisation? in devMode?
>> >>>> >>>
>> >>>> >>>
>> >>>> >>> 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
>>
>>

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


Re: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
Wow that's fast

here it is
https://issues.apache.org/jira/browse/WW-4067

thanks


On Fri, May 17, 2013 at 3:42 AM, Lukasz Lenart <lu...@apache.org>wrote:

> Fix is ready, I just need a JIRA task :-)
>
> 2013/5/16 Lukasz Lenart <lu...@apache.org>:
> > I have been looking into that and I am sure that's the problem, could
> > you register an issue with JIRA?
> >
> >
> > Thanks in advance
> > --
> > Łukasz
> > + 48 606 323 122 http://www.lenart.org.pl/
> >
> > 2013/5/16 Lukasz Lenart <lu...@apache.org>:
> >> Maybe your problem is related to:
> >>
> >> https://issues.apache.org/jira/browse/WW-3870
> >>
> >>
> >> Regards
> >> --
> >> Łukasz
> >> + 48 606 323 122 http://www.lenart.org.pl/
> >>
> >>
> >> 2013/5/9 Steven Yang <ke...@gmail.com>:
> >>> thanks good to know i am not being forgotten :)
> >>>
> >>>
> >>> On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <
> lukaszlenart@apache.org>wrote:
> >>>
> >>>> It's on my ToDo list ;-)
> >>>>
> >>>> 2013/5/9 Steven Yang <ke...@gmail.com>:
> >>>> > Hi just wondering is anyone as any insight on this? Or do I need to
> >>>> provide
> >>>> > more information?
> >>>> >
> >>>> > thanks
> >>>> >
> >>>> >
> >>>> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com>
> >>>> wrote:
> >>>> >
> >>>> >> same behavior for devMode=true and false
> >>>> >>
> >>>> >> i am not sure what you mean, shouldnt init only be called during
> >>>> >> initialization?
> >>>> >> or do you want to confirm that when I run my app after
> initialization,
> >>>> the
> >>>> >> init method wont be called again?
> >>>> >> so far the observation is that this only happen during
> initialization
> >>>> and
> >>>> >> before I access any of my actions, and no more init called after
> that
> >>>> >>
> >>>> >>
> >>>> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <
> lukaszlenart@apache.org
> >>>> >wrote:
> >>>> >>
> >>>> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
> >>>> >>> > with version 2.3.12, same behavior.
> >>>> >>>
> >>>> >>> Is this happen only during initialisation? in devMode?
> >>>> >>>
> >>>> >>>
> >>>> >>> 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: interceptor init twice

Posted by Lukasz Lenart <lu...@apache.org>.
Fix is ready, I just need a JIRA task :-)

2013/5/16 Lukasz Lenart <lu...@apache.org>:
> I have been looking into that and I am sure that's the problem, could
> you register an issue with JIRA?
>
>
> Thanks in advance
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> 2013/5/16 Lukasz Lenart <lu...@apache.org>:
>> Maybe your problem is related to:
>>
>> https://issues.apache.org/jira/browse/WW-3870
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>>
>> 2013/5/9 Steven Yang <ke...@gmail.com>:
>>> thanks good to know i am not being forgotten :)
>>>
>>>
>>> On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <lu...@apache.org>wrote:
>>>
>>>> It's on my ToDo list ;-)
>>>>
>>>> 2013/5/9 Steven Yang <ke...@gmail.com>:
>>>> > Hi just wondering is anyone as any insight on this? Or do I need to
>>>> provide
>>>> > more information?
>>>> >
>>>> > thanks
>>>> >
>>>> >
>>>> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com>
>>>> wrote:
>>>> >
>>>> >> same behavior for devMode=true and false
>>>> >>
>>>> >> i am not sure what you mean, shouldnt init only be called during
>>>> >> initialization?
>>>> >> or do you want to confirm that when I run my app after initialization,
>>>> the
>>>> >> init method wont be called again?
>>>> >> so far the observation is that this only happen during initialization
>>>> and
>>>> >> before I access any of my actions, and no more init called after that
>>>> >>
>>>> >>
>>>> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <lukaszlenart@apache.org
>>>> >wrote:
>>>> >>
>>>> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
>>>> >>> > with version 2.3.12, same behavior.
>>>> >>>
>>>> >>> Is this happen only during initialisation? in devMode?
>>>> >>>
>>>> >>>
>>>> >>> 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: interceptor init twice

Posted by Lukasz Lenart <lu...@apache.org>.
I have been looking into that and I am sure that's the problem, could
you register an issue with JIRA?


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

2013/5/16 Lukasz Lenart <lu...@apache.org>:
> Maybe your problem is related to:
>
> https://issues.apache.org/jira/browse/WW-3870
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
>
> 2013/5/9 Steven Yang <ke...@gmail.com>:
>> thanks good to know i am not being forgotten :)
>>
>>
>> On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <lu...@apache.org>wrote:
>>
>>> It's on my ToDo list ;-)
>>>
>>> 2013/5/9 Steven Yang <ke...@gmail.com>:
>>> > Hi just wondering is anyone as any insight on this? Or do I need to
>>> provide
>>> > more information?
>>> >
>>> > thanks
>>> >
>>> >
>>> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com>
>>> wrote:
>>> >
>>> >> same behavior for devMode=true and false
>>> >>
>>> >> i am not sure what you mean, shouldnt init only be called during
>>> >> initialization?
>>> >> or do you want to confirm that when I run my app after initialization,
>>> the
>>> >> init method wont be called again?
>>> >> so far the observation is that this only happen during initialization
>>> and
>>> >> before I access any of my actions, and no more init called after that
>>> >>
>>> >>
>>> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <lukaszlenart@apache.org
>>> >wrote:
>>> >>
>>> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
>>> >>> > with version 2.3.12, same behavior.
>>> >>>
>>> >>> Is this happen only during initialisation? in devMode?
>>> >>>
>>> >>>
>>> >>> 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: interceptor init twice

Posted by Lukasz Lenart <lu...@apache.org>.
Maybe your problem is related to:

https://issues.apache.org/jira/browse/WW-3870


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


2013/5/9 Steven Yang <ke...@gmail.com>:
> thanks good to know i am not being forgotten :)
>
>
> On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <lu...@apache.org>wrote:
>
>> It's on my ToDo list ;-)
>>
>> 2013/5/9 Steven Yang <ke...@gmail.com>:
>> > Hi just wondering is anyone as any insight on this? Or do I need to
>> provide
>> > more information?
>> >
>> > thanks
>> >
>> >
>> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com>
>> wrote:
>> >
>> >> same behavior for devMode=true and false
>> >>
>> >> i am not sure what you mean, shouldnt init only be called during
>> >> initialization?
>> >> or do you want to confirm that when I run my app after initialization,
>> the
>> >> init method wont be called again?
>> >> so far the observation is that this only happen during initialization
>> and
>> >> before I access any of my actions, and no more init called after that
>> >>
>> >>
>> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <lukaszlenart@apache.org
>> >wrote:
>> >>
>> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
>> >>> > with version 2.3.12, same behavior.
>> >>>
>> >>> Is this happen only during initialisation? in devMode?
>> >>>
>> >>>
>> >>> 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: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
thanks good to know i am not being forgotten :)


On Thu, May 9, 2013 at 12:51 PM, Lukasz Lenart <lu...@apache.org>wrote:

> It's on my ToDo list ;-)
>
> 2013/5/9 Steven Yang <ke...@gmail.com>:
> > Hi just wondering is anyone as any insight on this? Or do I need to
> provide
> > more information?
> >
> > thanks
> >
> >
> > On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com>
> wrote:
> >
> >> same behavior for devMode=true and false
> >>
> >> i am not sure what you mean, shouldnt init only be called during
> >> initialization?
> >> or do you want to confirm that when I run my app after initialization,
> the
> >> init method wont be called again?
> >> so far the observation is that this only happen during initialization
> and
> >> before I access any of my actions, and no more init called after that
> >>
> >>
> >> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <lukaszlenart@apache.org
> >wrote:
> >>
> >>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
> >>> > with version 2.3.12, same behavior.
> >>>
> >>> Is this happen only during initialisation? in devMode?
> >>>
> >>>
> >>> 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: interceptor init twice

Posted by Lukasz Lenart <lu...@apache.org>.
It's on my ToDo list ;-)

2013/5/9 Steven Yang <ke...@gmail.com>:
> Hi just wondering is anyone as any insight on this? Or do I need to provide
> more information?
>
> thanks
>
>
> On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com> wrote:
>
>> same behavior for devMode=true and false
>>
>> i am not sure what you mean, shouldnt init only be called during
>> initialization?
>> or do you want to confirm that when I run my app after initialization, the
>> init method wont be called again?
>> so far the observation is that this only happen during initialization and
>> before I access any of my actions, and no more init called after that
>>
>>
>> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <lu...@apache.org>wrote:
>>
>>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
>>> > with version 2.3.12, same behavior.
>>>
>>> Is this happen only during initialisation? in devMode?
>>>
>>>
>>> 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: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
Hi just wondering is anyone as any insight on this? Or do I need to provide
more information?

thanks


On Fri, Apr 26, 2013 at 3:37 PM, Steven Yang <ke...@gmail.com> wrote:

> same behavior for devMode=true and false
>
> i am not sure what you mean, shouldnt init only be called during
> initialization?
> or do you want to confirm that when I run my app after initialization, the
> init method wont be called again?
> so far the observation is that this only happen during initialization and
> before I access any of my actions, and no more init called after that
>
>
> On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <lu...@apache.org>wrote:
>
>> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
>> > with version 2.3.12, same behavior.
>>
>> Is this happen only during initialisation? in devMode?
>>
>>
>> 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
>>
>>
>

Re: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
same behavior for devMode=true and false

i am not sure what you mean, shouldnt init only be called during
initialization?
or do you want to confirm that when I run my app after initialization, the
init method wont be called again?
so far the observation is that this only happen during initialization and
before I access any of my actions, and no more init called after that


On Fri, Apr 26, 2013 at 2:35 PM, Lukasz Lenart <lu...@apache.org>wrote:

> 2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
> > with version 2.3.12, same behavior.
>
> Is this happen only during initialisation? in devMode?
>
>
> 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
>
>

Re: interceptor init twice

Posted by Lukasz Lenart <lu...@apache.org>.
2013/4/25 Felipe Lorenz <fe...@idealogic.com.br>:
> with version 2.3.12, same behavior.

Is this happen only during initialisation? in devMode?


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


Re: interceptor init twice

Posted by Felipe Lorenz <fe...@idealogic.com.br>.
with version 2.3.12, same behavior.

Felipe Lorenz
www.idealogic.com.br

Em 25/04/2013, às 01:50, Lukasz Lenart escreveu:

> 2013/4/25 Steven Yang <ke...@gmail.com>:
>> And sorry this behavior started on 2.3.7 and 2.3.4.1 does not have this
>> behavior
> 
> I would said, it isn't expected behavior ;-)
> 
> 
> 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
> 


Re: interceptor init twice

Posted by Lukasz Lenart <lu...@apache.org>.
2013/4/25 Steven Yang <ke...@gmail.com>:
> And sorry this behavior started on 2.3.7 and 2.3.4.1 does not have this
> behavior

I would said, it isn't expected behavior ;-)


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


Re: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
@Maurizio sorry in the sample app I do not using Spring. I am using Spring
in my projects, sorry for the confusion

And sorry this behavior started on 2.3.7 and 2.3.4.1 does not have this
behavior


On Thu, Apr 25, 2013 at 9:13 AM, Steven Yang <ke...@gmail.com> wrote:

> @Maurizio I am indeed using Spring, I will try without Spring.
> @Dave what i mean by "include" is that I use the <include file=""/> tag
>
> I do understand that Interceptor is singleton-ish. And I do understand if
> I defined the same interceptor in two different stacks there should be two
> different instances.
> However the case is that I only have one interceptor stack and two
> packages that shares the same stack but the init() is still being called
> twice. Also I have not declared any other "default" package anywhere in any
> xml, you are seeing all the packages that I have declared which are
> "default" and "example" and yet struts complains that I have declared
> "default" twice.
> If I have two different packages the interceptor should be instantiated
> two times then if I add another package the interceptor should be
> instantiated three times right? but it only gets instantiated two times max.
>
> The clarify the sample I created is a very simple app created from the
> blank war, I only added the bare minimum to reproduce the problem, to be
> exact init() wasn't called twice when I was using 2.1.8, if I recall
> correctly this behavior started on 2.3.8.
> So I want to confirm that this behavior is expected.
>
> Thanks
>
>
> On Wed, Apr 24, 2013 at 9:46 PM, Maurizio Cucchiara <mcucchiara@apache.org
> > wrote:
>
>> Yep, it makes sense definitely, otherwise there would not be way to share
>> a
>> single instance with different params.
>> Il giorno 24/apr/2013 15:31, "Dave Newton" <da...@gmail.com> ha
>> scritto:
>>
>> > Definitely singleton-ish, although i thought there was an
>> > instance-per-package--I thought I had packages with the same interceptor
>> > configured in different ways, but I can't check at the moment.
>> >
>> > Dave
>> >
>> >
>> >
>> > On Wed, Apr 24, 2013 at 9:28 AM, Maurizio Cucchiara
>> > <mc...@apache.org>wrote:
>> >
>> > > @Dave, I also could be wrong, but I remember that interceptors are
>> > > singletone (maybe there is a single instance per package).
>> > > @Steven looks like you're using Spring, if yes, could you check if you
>> > > experience the same behavior w/o it?
>> > > Il giorno 24/apr/2013 14:04, "Dave Newton" <da...@gmail.com> ha
>> > > scritto:
>> > >
>> > > > I'm not sure I understand what you mean regarding using the
>> "include"
>> > > > element (i.e., precisely what you're doing) but I thought that each
>> > > package
>> > > > would have its own set of interceptors, meaning there would be two
>> > > > instances, hence init would be called twice.
>> > > >
>> > > > This would be trivial to determine by checking to see if it's the
>> same
>> > > > instance.
>> > > >
>> > > > I could be misremembering.
>> > > >
>> > > > Dave
>> > > >
>> > > >
>> > > >
>> > > > On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang <ke...@gmail.com>
>> > > wrote:
>> > > >
>> > > > > I was using 2.1.8 and recently upgraded to 2.3.14.
>> > > > > And I realized that my interceptor got initialized twice and it
>> didnt
>> > > > > happen before.
>> > > > >
>> > > > > This happens when I declare a default package in struts.xml and
>> > include
>> > > > > other xml which have packages that extends my default package. But
>> > the
>> > > > > thing is no matter how many more xml I include the interceptor
>> will
>> > > only
>> > > > be
>> > > > > initialize one extra time.
>> > > > >
>> > > > > the following is my sample struts.xml
>> > > > >
>> > > > >  <package name="default" namespace="/" extends="struts-default">
>> > > > >
>> > > > > <interceptors>
>> > > > > <interceptor name="baseGeneral"
>> > > class="GeneralInterceptor"></interceptor>
>> > > > > <interceptor-stack name="biStack">
>> > > > > <interceptor-ref name="baseGeneral"/>
>> > > > > </interceptor-stack>
>> > > > > </interceptors>
>> > > > >         <default-action-ref name="index" />
>> > > > >
>> > > > >         <global-results>
>> > > > >             <result name="error">/error.jsp</result>
>> > > > >         </global-results>
>> > > > >
>> > > > >         <global-exception-mappings>
>> > > > >             <exception-mapping exception="java.lang.Exception"
>> > > > > result="error"/>
>> > > > >         </global-exception-mappings>
>> > > > >
>> > > > >         <action name="index">
>> > > > >             <result type="redirectAction">
>> > > > >                 <param name="actionName">HelloWorld</param>
>> > > > >                 <param name="namespace">/example</param>
>> > > > >             </result>
>> > > > >         </action>
>> > > > >     </package>
>> > > > >
>> > > > >     <include file="example.xml"/>
>> > > > >
>> > > > > my example.xml
>> > > > >
>> > > > >   <package name="example" namespace="/example" extends="default">
>> > > > >
>> > > > >         <action name="HelloWorld" class="example.HelloWorld">
>> > > > >             <result>/example/HelloWorld.jsp</result>
>> > > > >         </action>
>> > > > > </package>
>> > > > >
>> > > > > I traced the log and see the that my default package is been
>> > > initialized
>> > > > > twice and it seems that struts knows about it but it still called
>> > > init()
>> > > > on
>> > > > > my interceptor.
>> > > > > partial log:
>> > > > >
>> > > > > 2013-04-24 11:57:58,504 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Using default implementation of
>> FileManager
>> > > > > provided under name [system]: DefaultFileManager
>> > > > > 2013-04-24 11:57:58,505 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig
>> Name:default
>> > > > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
>> > > > > parents:[]}]}
>> > > > > GeneralInterceptor.init()
>> > > > > 2013-04-24 11:57:58,509 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded //index in 'default'
>> > > package:{ActionConfig
>> > > > > index () - action -
>> > > > >
>> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
>> > > > > 2013-04-24 11:57:58,510 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig
>> Name:example
>> > > > > namespace:/example parents:[{PackageConfig Name:default
>> namespace:/
>> > > > > parents:[{PackageConfig Name:struts-default namespace:
>> > parents:[]}]}]}
>> > > > > 2013-04-24 11:57:58,513 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example'
>> > > > > package:{ActionConfig HelloWorld (example.HelloWorld) - action -
>> > > > >
>> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62}
>> > > > > 2013-04-24 11:57:58,514 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded /example/Login_* in 'example'
>> > > > > package:{ActionConfig Login_* (example.Login.{1}()) - action -
>> > > > >
>> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67}
>> > > > > 2013-04-24 11:57:58,514 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded /example/* in 'example'
>> > > > > package:{ActionConfig * (example.ExampleSupport) - action -
>> > > > >
>> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57}
>> > > > > 2013-04-24 11:57:58,515 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig
>> Name:default
>> > > > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
>> > > > > parents:[]}]}
>> > > > > GeneralInterceptor.init()
>> > > > > 2013-04-24 11:57:58,516 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - Loaded //index in 'default'
>> > > package:{ActionConfig
>> > > > > index () - action -
>> > > > >
>> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
>> > > > > 2013-04-24 11:57:58,516 DEBUG
>> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
>> > > > > (Slf4jLogger.java:69) - The package name 'default' is already been
>> > > loaded
>> > > > > by the same location and could be removed: package -
>> > > > >
>> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68
>> > > > >
>> > > > >
>> > > > > as you can see struts knows that "default" has been loaded before
>> > > however
>> > > > > my interceptor still prints out init message.
>> > > > >
>> > > > > If I remove the include or move the "default" package declaration
>> out
>> > > to
>> > > > > another file and use include to include it in struts.xml the
>> problem
>> > > goes
>> > > > > away.
>> > > > >
>> > > > > Is this behavior correct? or I am using something in the wrong
>> way?
>> > > > >
>> > > > > Thanks
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > e: davelnewton@gmail.com
>> > > > m: 908-380-8699
>> > > > s: davelnewton_skype
>> > > > t: @dave_newton <https://twitter.com/dave_newton>
>> > > > b: Bucky Bits <http://buckybits.blogspot.com/>
>> > > > g: davelnewton <https://github.com/davelnewton>
>> > > > so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > e: davelnewton@gmail.com
>> > m: 908-380-8699
>> > s: davelnewton_skype
>> > t: @dave_newton <https://twitter.com/dave_newton>
>> > b: Bucky Bits <http://buckybits.blogspot.com/>
>> > g: davelnewton <https://github.com/davelnewton>
>> > so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
>> >
>>
>
>

Re: interceptor init twice

Posted by Steven Yang <ke...@gmail.com>.
@Maurizio I am indeed using Spring, I will try without Spring.
@Dave what i mean by "include" is that I use the <include file=""/> tag

I do understand that Interceptor is singleton-ish. And I do understand if I
defined the same interceptor in two different stacks there should be two
different instances.
However the case is that I only have one interceptor stack and two packages
that shares the same stack but the init() is still being called twice. Also
I have not declared any other "default" package anywhere in any xml, you
are seeing all the packages that I have declared which are "default" and
"example" and yet struts complains that I have declared "default" twice.
If I have two different packages the interceptor should be instantiated two
times then if I add another package the interceptor should be instantiated
three times right? but it only gets instantiated two times max.

The clarify the sample I created is a very simple app created from the
blank war, I only added the bare minimum to reproduce the problem, to be
exact init() wasn't called twice when I was using 2.1.8, if I recall
correctly this behavior started on 2.3.8.
So I want to confirm that this behavior is expected.

Thanks


On Wed, Apr 24, 2013 at 9:46 PM, Maurizio Cucchiara
<mc...@apache.org>wrote:

> Yep, it makes sense definitely, otherwise there would not be way to share a
> single instance with different params.
> Il giorno 24/apr/2013 15:31, "Dave Newton" <da...@gmail.com> ha
> scritto:
>
> > Definitely singleton-ish, although i thought there was an
> > instance-per-package--I thought I had packages with the same interceptor
> > configured in different ways, but I can't check at the moment.
> >
> > Dave
> >
> >
> >
> > On Wed, Apr 24, 2013 at 9:28 AM, Maurizio Cucchiara
> > <mc...@apache.org>wrote:
> >
> > > @Dave, I also could be wrong, but I remember that interceptors are
> > > singletone (maybe there is a single instance per package).
> > > @Steven looks like you're using Spring, if yes, could you check if you
> > > experience the same behavior w/o it?
> > > Il giorno 24/apr/2013 14:04, "Dave Newton" <da...@gmail.com> ha
> > > scritto:
> > >
> > > > I'm not sure I understand what you mean regarding using the "include"
> > > > element (i.e., precisely what you're doing) but I thought that each
> > > package
> > > > would have its own set of interceptors, meaning there would be two
> > > > instances, hence init would be called twice.
> > > >
> > > > This would be trivial to determine by checking to see if it's the
> same
> > > > instance.
> > > >
> > > > I could be misremembering.
> > > >
> > > > Dave
> > > >
> > > >
> > > >
> > > > On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang <ke...@gmail.com>
> > > wrote:
> > > >
> > > > > I was using 2.1.8 and recently upgraded to 2.3.14.
> > > > > And I realized that my interceptor got initialized twice and it
> didnt
> > > > > happen before.
> > > > >
> > > > > This happens when I declare a default package in struts.xml and
> > include
> > > > > other xml which have packages that extends my default package. But
> > the
> > > > > thing is no matter how many more xml I include the interceptor will
> > > only
> > > > be
> > > > > initialize one extra time.
> > > > >
> > > > > the following is my sample struts.xml
> > > > >
> > > > >  <package name="default" namespace="/" extends="struts-default">
> > > > >
> > > > > <interceptors>
> > > > > <interceptor name="baseGeneral"
> > > class="GeneralInterceptor"></interceptor>
> > > > > <interceptor-stack name="biStack">
> > > > > <interceptor-ref name="baseGeneral"/>
> > > > > </interceptor-stack>
> > > > > </interceptors>
> > > > >         <default-action-ref name="index" />
> > > > >
> > > > >         <global-results>
> > > > >             <result name="error">/error.jsp</result>
> > > > >         </global-results>
> > > > >
> > > > >         <global-exception-mappings>
> > > > >             <exception-mapping exception="java.lang.Exception"
> > > > > result="error"/>
> > > > >         </global-exception-mappings>
> > > > >
> > > > >         <action name="index">
> > > > >             <result type="redirectAction">
> > > > >                 <param name="actionName">HelloWorld</param>
> > > > >                 <param name="namespace">/example</param>
> > > > >             </result>
> > > > >         </action>
> > > > >     </package>
> > > > >
> > > > >     <include file="example.xml"/>
> > > > >
> > > > > my example.xml
> > > > >
> > > > >   <package name="example" namespace="/example" extends="default">
> > > > >
> > > > >         <action name="HelloWorld" class="example.HelloWorld">
> > > > >             <result>/example/HelloWorld.jsp</result>
> > > > >         </action>
> > > > > </package>
> > > > >
> > > > > I traced the log and see the that my default package is been
> > > initialized
> > > > > twice and it seems that struts knows about it but it still called
> > > init()
> > > > on
> > > > > my interceptor.
> > > > > partial log:
> > > > >
> > > > > 2013-04-24 11:57:58,504 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Using default implementation of FileManager
> > > > > provided under name [system]: DefaultFileManager
> > > > > 2013-04-24 11:57:58,505 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig
> Name:default
> > > > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > > > > parents:[]}]}
> > > > > GeneralInterceptor.init()
> > > > > 2013-04-24 11:57:58,509 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded //index in 'default'
> > > package:{ActionConfig
> > > > > index () - action -
> > > > >
> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > > > > 2013-04-24 11:57:58,510 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig
> Name:example
> > > > > namespace:/example parents:[{PackageConfig Name:default namespace:/
> > > > > parents:[{PackageConfig Name:struts-default namespace:
> > parents:[]}]}]}
> > > > > 2013-04-24 11:57:58,513 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example'
> > > > > package:{ActionConfig HelloWorld (example.HelloWorld) - action -
> > > > >
> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62}
> > > > > 2013-04-24 11:57:58,514 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded /example/Login_* in 'example'
> > > > > package:{ActionConfig Login_* (example.Login.{1}()) - action -
> > > > >
> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67}
> > > > > 2013-04-24 11:57:58,514 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded /example/* in 'example'
> > > > > package:{ActionConfig * (example.ExampleSupport) - action -
> > > > >
> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57}
> > > > > 2013-04-24 11:57:58,515 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig
> Name:default
> > > > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > > > > parents:[]}]}
> > > > > GeneralInterceptor.init()
> > > > > 2013-04-24 11:57:58,516 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - Loaded //index in 'default'
> > > package:{ActionConfig
> > > > > index () - action -
> > > > >
> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > > > > 2013-04-24 11:57:58,516 DEBUG
> > > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > > (Slf4jLogger.java:69) - The package name 'default' is already been
> > > loaded
> > > > > by the same location and could be removed: package -
> > > > > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68
> > > > >
> > > > >
> > > > > as you can see struts knows that "default" has been loaded before
> > > however
> > > > > my interceptor still prints out init message.
> > > > >
> > > > > If I remove the include or move the "default" package declaration
> out
> > > to
> > > > > another file and use include to include it in struts.xml the
> problem
> > > goes
> > > > > away.
> > > > >
> > > > > Is this behavior correct? or I am using something in the wrong way?
> > > > >
> > > > > Thanks
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > e: davelnewton@gmail.com
> > > > m: 908-380-8699
> > > > s: davelnewton_skype
> > > > t: @dave_newton <https://twitter.com/dave_newton>
> > > > b: Bucky Bits <http://buckybits.blogspot.com/>
> > > > g: davelnewton <https://github.com/davelnewton>
> > > > so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
> > > >
> > >
> >
> >
> >
> > --
> > e: davelnewton@gmail.com
> > m: 908-380-8699
> > s: davelnewton_skype
> > t: @dave_newton <https://twitter.com/dave_newton>
> > b: Bucky Bits <http://buckybits.blogspot.com/>
> > g: davelnewton <https://github.com/davelnewton>
> > so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
> >
>

Re: interceptor init twice

Posted by Maurizio Cucchiara <mc...@apache.org>.
Yep, it makes sense definitely, otherwise there would not be way to share a
single instance with different params.
Il giorno 24/apr/2013 15:31, "Dave Newton" <da...@gmail.com> ha
scritto:

> Definitely singleton-ish, although i thought there was an
> instance-per-package--I thought I had packages with the same interceptor
> configured in different ways, but I can't check at the moment.
>
> Dave
>
>
>
> On Wed, Apr 24, 2013 at 9:28 AM, Maurizio Cucchiara
> <mc...@apache.org>wrote:
>
> > @Dave, I also could be wrong, but I remember that interceptors are
> > singletone (maybe there is a single instance per package).
> > @Steven looks like you're using Spring, if yes, could you check if you
> > experience the same behavior w/o it?
> > Il giorno 24/apr/2013 14:04, "Dave Newton" <da...@gmail.com> ha
> > scritto:
> >
> > > I'm not sure I understand what you mean regarding using the "include"
> > > element (i.e., precisely what you're doing) but I thought that each
> > package
> > > would have its own set of interceptors, meaning there would be two
> > > instances, hence init would be called twice.
> > >
> > > This would be trivial to determine by checking to see if it's the same
> > > instance.
> > >
> > > I could be misremembering.
> > >
> > > Dave
> > >
> > >
> > >
> > > On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang <ke...@gmail.com>
> > wrote:
> > >
> > > > I was using 2.1.8 and recently upgraded to 2.3.14.
> > > > And I realized that my interceptor got initialized twice and it didnt
> > > > happen before.
> > > >
> > > > This happens when I declare a default package in struts.xml and
> include
> > > > other xml which have packages that extends my default package. But
> the
> > > > thing is no matter how many more xml I include the interceptor will
> > only
> > > be
> > > > initialize one extra time.
> > > >
> > > > the following is my sample struts.xml
> > > >
> > > >  <package name="default" namespace="/" extends="struts-default">
> > > >
> > > > <interceptors>
> > > > <interceptor name="baseGeneral"
> > class="GeneralInterceptor"></interceptor>
> > > > <interceptor-stack name="biStack">
> > > > <interceptor-ref name="baseGeneral"/>
> > > > </interceptor-stack>
> > > > </interceptors>
> > > >         <default-action-ref name="index" />
> > > >
> > > >         <global-results>
> > > >             <result name="error">/error.jsp</result>
> > > >         </global-results>
> > > >
> > > >         <global-exception-mappings>
> > > >             <exception-mapping exception="java.lang.Exception"
> > > > result="error"/>
> > > >         </global-exception-mappings>
> > > >
> > > >         <action name="index">
> > > >             <result type="redirectAction">
> > > >                 <param name="actionName">HelloWorld</param>
> > > >                 <param name="namespace">/example</param>
> > > >             </result>
> > > >         </action>
> > > >     </package>
> > > >
> > > >     <include file="example.xml"/>
> > > >
> > > > my example.xml
> > > >
> > > >   <package name="example" namespace="/example" extends="default">
> > > >
> > > >         <action name="HelloWorld" class="example.HelloWorld">
> > > >             <result>/example/HelloWorld.jsp</result>
> > > >         </action>
> > > > </package>
> > > >
> > > > I traced the log and see the that my default package is been
> > initialized
> > > > twice and it seems that struts knows about it but it still called
> > init()
> > > on
> > > > my interceptor.
> > > > partial log:
> > > >
> > > > 2013-04-24 11:57:58,504 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Using default implementation of FileManager
> > > > provided under name [system]: DefaultFileManager
> > > > 2013-04-24 11:57:58,505 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> > > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > > > parents:[]}]}
> > > > GeneralInterceptor.init()
> > > > 2013-04-24 11:57:58,509 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded //index in 'default'
> > package:{ActionConfig
> > > > index () - action -
> > > > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > > > 2013-04-24 11:57:58,510 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:example
> > > > namespace:/example parents:[{PackageConfig Name:default namespace:/
> > > > parents:[{PackageConfig Name:struts-default namespace:
> parents:[]}]}]}
> > > > 2013-04-24 11:57:58,513 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example'
> > > > package:{ActionConfig HelloWorld (example.HelloWorld) - action -
> > > > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62}
> > > > 2013-04-24 11:57:58,514 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded /example/Login_* in 'example'
> > > > package:{ActionConfig Login_* (example.Login.{1}()) - action -
> > > > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67}
> > > > 2013-04-24 11:57:58,514 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded /example/* in 'example'
> > > > package:{ActionConfig * (example.ExampleSupport) - action -
> > > > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57}
> > > > 2013-04-24 11:57:58,515 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> > > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > > > parents:[]}]}
> > > > GeneralInterceptor.init()
> > > > 2013-04-24 11:57:58,516 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - Loaded //index in 'default'
> > package:{ActionConfig
> > > > index () - action -
> > > > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > > > 2013-04-24 11:57:58,516 DEBUG
> > > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > > (Slf4jLogger.java:69) - The package name 'default' is already been
> > loaded
> > > > by the same location and could be removed: package -
> > > > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68
> > > >
> > > >
> > > > as you can see struts knows that "default" has been loaded before
> > however
> > > > my interceptor still prints out init message.
> > > >
> > > > If I remove the include or move the "default" package declaration out
> > to
> > > > another file and use include to include it in struts.xml the problem
> > goes
> > > > away.
> > > >
> > > > Is this behavior correct? or I am using something in the wrong way?
> > > >
> > > > Thanks
> > > >
> > >
> > >
> > >
> > > --
> > > e: davelnewton@gmail.com
> > > m: 908-380-8699
> > > s: davelnewton_skype
> > > t: @dave_newton <https://twitter.com/dave_newton>
> > > b: Bucky Bits <http://buckybits.blogspot.com/>
> > > g: davelnewton <https://github.com/davelnewton>
> > > so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
> > >
> >
>
>
>
> --
> e: davelnewton@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton <https://twitter.com/dave_newton>
> b: Bucky Bits <http://buckybits.blogspot.com/>
> g: davelnewton <https://github.com/davelnewton>
> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
>

Re: interceptor init twice

Posted by Dave Newton <da...@gmail.com>.
Definitely singleton-ish, although i thought there was an
instance-per-package--I thought I had packages with the same interceptor
configured in different ways, but I can't check at the moment.

Dave



On Wed, Apr 24, 2013 at 9:28 AM, Maurizio Cucchiara
<mc...@apache.org>wrote:

> @Dave, I also could be wrong, but I remember that interceptors are
> singletone (maybe there is a single instance per package).
> @Steven looks like you're using Spring, if yes, could you check if you
> experience the same behavior w/o it?
> Il giorno 24/apr/2013 14:04, "Dave Newton" <da...@gmail.com> ha
> scritto:
>
> > I'm not sure I understand what you mean regarding using the "include"
> > element (i.e., precisely what you're doing) but I thought that each
> package
> > would have its own set of interceptors, meaning there would be two
> > instances, hence init would be called twice.
> >
> > This would be trivial to determine by checking to see if it's the same
> > instance.
> >
> > I could be misremembering.
> >
> > Dave
> >
> >
> >
> > On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang <ke...@gmail.com>
> wrote:
> >
> > > I was using 2.1.8 and recently upgraded to 2.3.14.
> > > And I realized that my interceptor got initialized twice and it didnt
> > > happen before.
> > >
> > > This happens when I declare a default package in struts.xml and include
> > > other xml which have packages that extends my default package. But the
> > > thing is no matter how many more xml I include the interceptor will
> only
> > be
> > > initialize one extra time.
> > >
> > > the following is my sample struts.xml
> > >
> > >  <package name="default" namespace="/" extends="struts-default">
> > >
> > > <interceptors>
> > > <interceptor name="baseGeneral"
> class="GeneralInterceptor"></interceptor>
> > > <interceptor-stack name="biStack">
> > > <interceptor-ref name="baseGeneral"/>
> > > </interceptor-stack>
> > > </interceptors>
> > >         <default-action-ref name="index" />
> > >
> > >         <global-results>
> > >             <result name="error">/error.jsp</result>
> > >         </global-results>
> > >
> > >         <global-exception-mappings>
> > >             <exception-mapping exception="java.lang.Exception"
> > > result="error"/>
> > >         </global-exception-mappings>
> > >
> > >         <action name="index">
> > >             <result type="redirectAction">
> > >                 <param name="actionName">HelloWorld</param>
> > >                 <param name="namespace">/example</param>
> > >             </result>
> > >         </action>
> > >     </package>
> > >
> > >     <include file="example.xml"/>
> > >
> > > my example.xml
> > >
> > >   <package name="example" namespace="/example" extends="default">
> > >
> > >         <action name="HelloWorld" class="example.HelloWorld">
> > >             <result>/example/HelloWorld.jsp</result>
> > >         </action>
> > > </package>
> > >
> > > I traced the log and see the that my default package is been
> initialized
> > > twice and it seems that struts knows about it but it still called
> init()
> > on
> > > my interceptor.
> > > partial log:
> > >
> > > 2013-04-24 11:57:58,504 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Using default implementation of FileManager
> > > provided under name [system]: DefaultFileManager
> > > 2013-04-24 11:57:58,505 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > > parents:[]}]}
> > > GeneralInterceptor.init()
> > > 2013-04-24 11:57:58,509 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded //index in 'default'
> package:{ActionConfig
> > > index () - action -
> > > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > > 2013-04-24 11:57:58,510 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:example
> > > namespace:/example parents:[{PackageConfig Name:default namespace:/
> > > parents:[{PackageConfig Name:struts-default namespace: parents:[]}]}]}
> > > 2013-04-24 11:57:58,513 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example'
> > > package:{ActionConfig HelloWorld (example.HelloWorld) - action -
> > > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62}
> > > 2013-04-24 11:57:58,514 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded /example/Login_* in 'example'
> > > package:{ActionConfig Login_* (example.Login.{1}()) - action -
> > > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67}
> > > 2013-04-24 11:57:58,514 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded /example/* in 'example'
> > > package:{ActionConfig * (example.ExampleSupport) - action -
> > > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57}
> > > 2013-04-24 11:57:58,515 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> > > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > > parents:[]}]}
> > > GeneralInterceptor.init()
> > > 2013-04-24 11:57:58,516 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - Loaded //index in 'default'
> package:{ActionConfig
> > > index () - action -
> > > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > > 2013-04-24 11:57:58,516 DEBUG
> > > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > > (Slf4jLogger.java:69) - The package name 'default' is already been
> loaded
> > > by the same location and could be removed: package -
> > > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68
> > >
> > >
> > > as you can see struts knows that "default" has been loaded before
> however
> > > my interceptor still prints out init message.
> > >
> > > If I remove the include or move the "default" package declaration out
> to
> > > another file and use include to include it in struts.xml the problem
> goes
> > > away.
> > >
> > > Is this behavior correct? or I am using something in the wrong way?
> > >
> > > Thanks
> > >
> >
> >
> >
> > --
> > e: davelnewton@gmail.com
> > m: 908-380-8699
> > s: davelnewton_skype
> > t: @dave_newton <https://twitter.com/dave_newton>
> > b: Bucky Bits <http://buckybits.blogspot.com/>
> > g: davelnewton <https://github.com/davelnewton>
> > so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
> >
>



-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>

Re: interceptor init twice

Posted by Maurizio Cucchiara <mc...@apache.org>.
@Dave, I also could be wrong, but I remember that interceptors are
singletone (maybe there is a single instance per package).
@Steven looks like you're using Spring, if yes, could you check if you
experience the same behavior w/o it?
Il giorno 24/apr/2013 14:04, "Dave Newton" <da...@gmail.com> ha
scritto:

> I'm not sure I understand what you mean regarding using the "include"
> element (i.e., precisely what you're doing) but I thought that each package
> would have its own set of interceptors, meaning there would be two
> instances, hence init would be called twice.
>
> This would be trivial to determine by checking to see if it's the same
> instance.
>
> I could be misremembering.
>
> Dave
>
>
>
> On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang <ke...@gmail.com> wrote:
>
> > I was using 2.1.8 and recently upgraded to 2.3.14.
> > And I realized that my interceptor got initialized twice and it didnt
> > happen before.
> >
> > This happens when I declare a default package in struts.xml and include
> > other xml which have packages that extends my default package. But the
> > thing is no matter how many more xml I include the interceptor will only
> be
> > initialize one extra time.
> >
> > the following is my sample struts.xml
> >
> >  <package name="default" namespace="/" extends="struts-default">
> >
> > <interceptors>
> > <interceptor name="baseGeneral" class="GeneralInterceptor"></interceptor>
> > <interceptor-stack name="biStack">
> > <interceptor-ref name="baseGeneral"/>
> > </interceptor-stack>
> > </interceptors>
> >         <default-action-ref name="index" />
> >
> >         <global-results>
> >             <result name="error">/error.jsp</result>
> >         </global-results>
> >
> >         <global-exception-mappings>
> >             <exception-mapping exception="java.lang.Exception"
> > result="error"/>
> >         </global-exception-mappings>
> >
> >         <action name="index">
> >             <result type="redirectAction">
> >                 <param name="actionName">HelloWorld</param>
> >                 <param name="namespace">/example</param>
> >             </result>
> >         </action>
> >     </package>
> >
> >     <include file="example.xml"/>
> >
> > my example.xml
> >
> >   <package name="example" namespace="/example" extends="default">
> >
> >         <action name="HelloWorld" class="example.HelloWorld">
> >             <result>/example/HelloWorld.jsp</result>
> >         </action>
> > </package>
> >
> > I traced the log and see the that my default package is been initialized
> > twice and it seems that struts knows about it but it still called init()
> on
> > my interceptor.
> > partial log:
> >
> > 2013-04-24 11:57:58,504 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Using default implementation of FileManager
> > provided under name [system]: DefaultFileManager
> > 2013-04-24 11:57:58,505 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > parents:[]}]}
> > GeneralInterceptor.init()
> > 2013-04-24 11:57:58,509 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig
> > index () - action -
> > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > 2013-04-24 11:57:58,510 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:example
> > namespace:/example parents:[{PackageConfig Name:default namespace:/
> > parents:[{PackageConfig Name:struts-default namespace: parents:[]}]}]}
> > 2013-04-24 11:57:58,513 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example'
> > package:{ActionConfig HelloWorld (example.HelloWorld) - action -
> > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62}
> > 2013-04-24 11:57:58,514 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded /example/Login_* in 'example'
> > package:{ActionConfig Login_* (example.Login.{1}()) - action -
> > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67}
> > 2013-04-24 11:57:58,514 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded /example/* in 'example'
> > package:{ActionConfig * (example.ExampleSupport) - action -
> > file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57}
> > 2013-04-24 11:57:58,515 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> > namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> > parents:[]}]}
> > GeneralInterceptor.init()
> > 2013-04-24 11:57:58,516 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig
> > index () - action -
> > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> > 2013-04-24 11:57:58,516 DEBUG
> > com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> > (Slf4jLogger.java:69) - The package name 'default' is already been loaded
> > by the same location and could be removed: package -
> > file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68
> >
> >
> > as you can see struts knows that "default" has been loaded before however
> > my interceptor still prints out init message.
> >
> > If I remove the include or move the "default" package declaration out to
> > another file and use include to include it in struts.xml the problem goes
> > away.
> >
> > Is this behavior correct? or I am using something in the wrong way?
> >
> > Thanks
> >
>
>
>
> --
> e: davelnewton@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton <https://twitter.com/dave_newton>
> b: Bucky Bits <http://buckybits.blogspot.com/>
> g: davelnewton <https://github.com/davelnewton>
> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
>

Re: interceptor init twice

Posted by Dave Newton <da...@gmail.com>.
I'm not sure I understand what you mean regarding using the "include"
element (i.e., precisely what you're doing) but I thought that each package
would have its own set of interceptors, meaning there would be two
instances, hence init would be called twice.

This would be trivial to determine by checking to see if it's the same
instance.

I could be misremembering.

Dave



On Wed, Apr 24, 2013 at 7:52 AM, Steven Yang <ke...@gmail.com> wrote:

> I was using 2.1.8 and recently upgraded to 2.3.14.
> And I realized that my interceptor got initialized twice and it didnt
> happen before.
>
> This happens when I declare a default package in struts.xml and include
> other xml which have packages that extends my default package. But the
> thing is no matter how many more xml I include the interceptor will only be
> initialize one extra time.
>
> the following is my sample struts.xml
>
>  <package name="default" namespace="/" extends="struts-default">
>
> <interceptors>
> <interceptor name="baseGeneral" class="GeneralInterceptor"></interceptor>
> <interceptor-stack name="biStack">
> <interceptor-ref name="baseGeneral"/>
> </interceptor-stack>
> </interceptors>
>         <default-action-ref name="index" />
>
>         <global-results>
>             <result name="error">/error.jsp</result>
>         </global-results>
>
>         <global-exception-mappings>
>             <exception-mapping exception="java.lang.Exception"
> result="error"/>
>         </global-exception-mappings>
>
>         <action name="index">
>             <result type="redirectAction">
>                 <param name="actionName">HelloWorld</param>
>                 <param name="namespace">/example</param>
>             </result>
>         </action>
>     </package>
>
>     <include file="example.xml"/>
>
> my example.xml
>
>   <package name="example" namespace="/example" extends="default">
>
>         <action name="HelloWorld" class="example.HelloWorld">
>             <result>/example/HelloWorld.jsp</result>
>         </action>
> </package>
>
> I traced the log and see the that my default package is been initialized
> twice and it seems that struts knows about it but it still called init() on
> my interceptor.
> partial log:
>
> 2013-04-24 11:57:58,504 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Using default implementation of FileManager
> provided under name [system]: DefaultFileManager
> 2013-04-24 11:57:58,505 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> parents:[]}]}
> GeneralInterceptor.init()
> 2013-04-24 11:57:58,509 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig
> index () - action -
> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> 2013-04-24 11:57:58,510 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:example
> namespace:/example parents:[{PackageConfig Name:default namespace:/
> parents:[{PackageConfig Name:struts-default namespace: parents:[]}]}]}
> 2013-04-24 11:57:58,513 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded /example/HelloWorld in 'example'
> package:{ActionConfig HelloWorld (example.HelloWorld) - action -
> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:10:62}
> 2013-04-24 11:57:58,514 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded /example/Login_* in 'example'
> package:{ActionConfig Login_* (example.Login.{1}()) - action -
> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:14:67}
> 2013-04-24 11:57:58,514 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded /example/* in 'example'
> package:{ActionConfig * (example.ExampleSupport) - action -
> file:/D:/workspace_tsb/struts2-blank/build/classes/example.xml:19:57}
> 2013-04-24 11:57:58,515 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded [BUILDER] {PackageConfig Name:default
> namespace:/ parents:[{PackageConfig Name:struts-default namespace:
> parents:[]}]}
> GeneralInterceptor.init()
> 2013-04-24 11:57:58,516 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - Loaded //index in 'default' package:{ActionConfig
> index () - action -
> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:30:30}
> 2013-04-24 11:57:58,516 DEBUG
> com.opensymphony.xwork2.util.logging.slf4j.Slf4jLogger
> (Slf4jLogger.java:69) - The package name 'default' is already been loaded
> by the same location and could be removed: package -
> file:/D:/workspace_tsb/struts2-blank/build/classes/struts.xml:11:68
>
>
> as you can see struts knows that "default" has been loaded before however
> my interceptor still prints out init message.
>
> If I remove the include or move the "default" package declaration out to
> another file and use include to include it in struts.xml the problem goes
> away.
>
> Is this behavior correct? or I am using something in the wrong way?
>
> Thanks
>



-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>