Aren't interceptors also created by the struts object factory?
 On Jul 18, 2013 12:28 PM, "David Greene" <da...@securelink.com> wrote:

> And, now retracting my retraction - @Autowired DOES work for Actions (via
> no setter), I was just in a JEE Filter, not an Interceptor which obviously
> doesn't have Spring access for @Autowired.
>
>
> On Thu, Jul 18, 2013 at 11:19 AM, David Greene <da...@securelink.com>
> wrote:
>
> > I very well may do that.  Thanks for the info.
> >
> > And one correction to my assertion above - @Autowired does not do
> > anything.  I had switched it to a Service Locator Context.getBean() a
> while
> > back while debugging and hadn't changed it back.
> >
> >
> > On Thu, Jul 18, 2013 at 11:13 AM, Paul Benedict <pbened...@apache.org
> >wrote:
> >
> >> I too was surprised that I don't have to specify what to inject. In
> fact,
> >> I
> >> didn't like it but came to live with it. I would prefer that only things
> >> with @Inject be annotated, but Struts 2 was created well before CDI and
> >> JEE
> >> 6 annotations. I think perhaps the mythical Struts 3 can tidy things up.
> >> But if you got little incremental improvements for the 2.x line, by all
> >> means, suggest what could be improved upon. :-)
> >>
> >>
> >> On Thu, Jul 18, 2013 at 11:08 AM, David Greene <da...@securelink.com>
> >> wrote:
> >>
> >> > Ah, there you have it.
> >> >
> >> > Still though, that seems like a bug (or at least something that needs
> >> to be
> >> > defensively coded around for the struts2-spring plugin).
> >> > ActionContext.setFieldErrors(Map<String,String>) is injected with some
> >> > random Map<String,String> from the Spring context when autowire by
> type
> >> is
> >> > selected.  I'd imagine no one can use struts2-spring integration where
> >> > autowire by type is selected.
> >> >
> >> > Interestingly enough, I do not have setters for my @Autowired
> annotated
> >> > Services.  I'm guessing the autowire method uses both annotations and
> >> > setters (if available) ??
> >> >
> >> > Is this JIRA worthy or is this just a RTFM user error thing?
> >> >
> >> >
> >> >
> >> > On Thu, Jul 18, 2013 at 11:02 AM, Paul Benedict <pbened...@apache.org
> >> > >wrote:
> >> >
> >> > > You don't need @Autowired and @Inject in your Action with the Spring
> >> > > plugin. It will call any setter based on type (or name).
> >> > >
> >> > >
> >> > > On Thu, Jul 18, 2013 at 10:58 AM, David Greene <
> da...@securelink.com>
> >> > > wrote:
> >> > >
> >> > > > I think I see the "what" now, but no idea on the why:
> >> > > >
> >> > > > 20:59:47,536 INFO  [rss.web.filter.SignOnFilter]
> >> (http--0.0.0.0-8443-2)
> >> > > > Redirecting to signon: /signon.action?redirectUri=index.action
> >> > > > 20:59:47,735 DEBUG
> >> > > >
> >> [org.springframework.beans.factory.support.DefaultListableBeanFactory]
> >> > > > (http--0.0.0.0-8443-2) Returning cached instance of singleton bean
> >> > > > 'userPropertyService'
> >> > > > 20:59:47,736 DEBUG
> >> > > >
> >> [org.springframework.beans.factory.support.DefaultListableBeanFactory]
> >> > > > (http--0.0.0.0-8443-2) Returning cached instance of singleton bean
> >> > > > 'vendorRepApprovalService'
> >> > > > 20:59:47,806 DEBUG
> >> > > >
> >> [org.springframework.beans.factory.support.DefaultListableBeanFactory]
> >> > > > (http--0.0.0.0-8443-2) Returning cached instance of singleton bean
> >> > > >
> >> > > >
> >> > >
> >> >
> >>
> 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry'
> >> > > > 20:59:47,807 DEBUG
> >> > > >
> >> [org.springframework.beans.factory.support.DefaultListableBeanFactory]
> >> > > > (http--0.0.0.0-8443-2) Autowiring by type from bean name
> >> > > > 'rss.web.webwork.action.mx.signon.SignOnAction' via property
> >> > > 'fieldErrors'
> >> > > > to bean named
> >> > > >
> >> > > >
> >> > >
> >> >
> >>
> 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry'
> >> > > > 20:59:47,808 DEBUG
> >> > > >
> >> [org.springframework.beans.factory.support.DefaultListableBeanFactory]
> >> > > > (http--0.0.0.0-8443-2) Returning cached instance of singleton bean
> >> > > > 'servletContext'
> >> > > > 20:59:47,808 DEBUG
> >> > > >
> >> [org.springframework.beans.factory.support.DefaultListableBeanFactory]
> >> > > > (http--0.0.0.0-8443-2) Autowiring by type from bean name
> >> > > > 'rss.web.webwork.action.mx.signon.SignOnAction' via property
> >> > > > 'servletContext' to bean named 'servletContext'
> >> > > > 20:59:47,892 DEBUG
> >> > > >
> >> [org.springframework.beans.factory.support.DefaultListableBeanFactory]
> >> > > > (http--0.0.0.0-8443-2) Autowiring by type from bean name
> >> > > > 'rss.web.webwork.action.mx.signon.SignOnAction' via property
> >> > > > 'servletRequest' to bean named 'com.sun.proxy.$Proxy43@4c7adb7'
> >> > > >
> >> > > > Spring is injecting servletContext, servletRequest, fieldErrors to
> >> the
> >> > > > Action.  Does the struts2-spring plugin just inject via setters by
> >> type
> >> > > for
> >> > > > all setters where a type may match from the spring context?  If I
> >> > switch
> >> > > to
> >> > > > "name" instead of "type" will that inject anything that's the same
> >> name
> >> > > > regardless of @Autowired or @javax.inject.Inject  ??
> >> > > >
> >> > > >
> >> > > > On Thu, Jul 18, 2013 at 10:45 AM, David Greene <
> >> da...@securelink.com>
> >> > > > wrote:
> >> > > >
> >> > > > > I had already tried that (breakpointing input()) - it's never
> >> > executed.
> >> > > > >
> >> > > > > I just added my freshly created debug interceptor and set a
> >> > breakpoint
> >> > > > > there, but yet again - no love.
> >> > > > >
> >> > > > > I'm setting a breakpoint in ValidationInterceptor.doIntercept()
> >>  line
> >> > > > 265:
> >> > > > >
> >> > > > > After inspecting the ActionInvocation, there is indeed 1 error,
> >> and
> >> > it
> >> > > > is:
> >> > > > >
> >> > > > > Action.validation.fieldErrors (size 1)
> >> > > > >
> >> > > > > [0]    LinkedHashMap$Entry
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> "org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry
> >> > > > > => ImportStack: []"
> >> > > > >
> >> > > > > **boggle**
> >> > > > >
> >> > > > > No clue here, google isn't much help.  Any ideas?
> >> > > > >
> >> > > > > Again, thanks for so much help guys.
> >> > > > >
> >> > > > >
> >> > > > > On Thu, Jul 18, 2013 at 10:18 AM, Dave Newton <
> >> davelnew...@gmail.com
> >> > > > >wrote:
> >> > > > >
> >> > > > >> Oh, right, could just override `input()`.
> >> > > > >>
> >> > > > >> I forget about stuff like that since I just get my action stuff
> >> > dumped
> >> > > > out
> >> > > > >> :)
> >> > > > >>
> >> > > > >> Dave
> >> > > > >>
> >> > > > >>
> >> > > > >> On Thu, Jul 18, 2013 at 11:11 AM, Paul Benedict <
> >> > pbened...@apache.org
> >> > > > >> >wrote:
> >> > > > >>
> >> > > > >> > Yes, Dave's proposal is easier and faster. When validation
> >> fails,
> >> > > you
> >> > > > >> > should have one or several errors/messages. So dump those out
> >> or
> >> > > > >> breakpoint
> >> > > > >> > in your input() to inspect them.
> >> > > > >> >
> >> > > > >> >
> >> > > > >> > On Thu, Jul 18, 2013 at 10:09 AM, Dave Newton <
> >> > > davelnew...@gmail.com>
> >> > > > >> > wrote:
> >> > > > >> >
> >> > > > >> > > * Is there any validation set up on the action?
> >> > > > >> > > * Are there any parameters being set on the action?
> >> > > > >> > >
> >> > > > >> > > The easiest/quickest might just be to check the action's
> >> > > > >> errors/messages
> >> > > > >> > > lists. As part of a debugging interceptor chain I had a
> small
> >> > > > >> interceptor
> >> > > > >> > > that just dumped those to the log file after every
> >> request--made
> >> > > > >> looking
> >> > > > >> > > for stuff like this trivial.
> >> > > > >> > >
> >> > > > >> > > Dave
> >> > > > >> > >
> >> > > > >> > >
> >> > > > >> > > On Thu, Jul 18, 2013 at 10:59 AM, David Greene <
> >> > > > da...@securelink.com>
> >> > > > >> > > wrote:
> >> > > > >> > >
> >> > > > >> > > > How would I figure out what is failing validation (and
> more
> >> > > > >> > importantly)
> >> > > > >> > > > why?  I have logging set to DEBUG, but nothing is jumping
> >> out
> >> > > as a
> >> > > > >> > > > Validation Error.
> >> > > > >> > > >
> >> > > > >> > > >
> >> > > > >> > > > On Thu, Jul 18, 2013 at 9:57 AM, Dave Newton <
> >> > > > davelnew...@gmail.com
> >> > > > >> >
> >> > > > >> > > > wrote:
> >> > > > >> > > >
> >> > > > >> > > > > It's a validation or type conversion error.
> >> > > > >> > > > >
> >> > > > >> > > > >
> >> > > > >> > > > > On Thu, Jul 18, 2013 at 10:44 AM, David Greene <
> >> > > > >> da...@securelink.com
> >> > > > >> > >
> >> > > > >> > > > > wrote:
> >> > > > >> > > > >
> >> > > > >> > > > > > Wishful thinking...
> >> > > > >> > > > > >
> >> > > > >> > > > > > <constant name="struts.objectFactory"
> >> > > > >> > > > > >
> >> > value="org.apache.struts2.spring.StrutsSpringObjectFactory"
> >> > > />
> >> > > > >> > > > > >
> >> > > > >> > > > > > to
> >> > > > >> > > > > >
> >> > > > >> > > > > > <constant name="struts.objectFactory" value="spring"
> />
> >> > > > >> > > > > >
> >> > > > >> > > > > > made no change.  I couldn't find any other
> differences
> >> in
> >> > > the
> >> > > > >> docs.
> >> > > > >> > > >  I'll
> >> > > > >> > > > > > look at the tutorial next, but I'm not setting up a
> >> brand
> >> > > new
> >> > > > >> > > project -
> >> > > > >> > > > > I'm
> >> > > > >> > > > > > integrating Spring into an existing (and fully
> >> functional)
> >> > > > >> Struts2
> >> > > > >> > > > > > application so I can verify that my only changes
> >> (through
> >> > > SVN
> >> > > > >> diff)
> >> > > > >> > > are
> >> > > > >> > > > > the
> >> > > > >> > > > > > ones mentioned in the struts2-plugin + adding
> >> @Autowired
> >> > to
> >> > > my
> >> > > > >> > > Actions
> >> > > > >> > > > > for
> >> > > > >> > > > > > Singleton access.
> >> > > > >> > > > > >
> >> > > > >> > > > > > Further, I can change:
> >> > > > >> > > > > >
> >> > > > >> > > > > > <struts>
> >> > > > >> > > > > >     ...
> >> > > > >> > > > > >     <constant name="struts.objectFactory"
> >> value="spring"
> >> > />
> >> > > > >> > > > > >     <constant
> >> name="struts.objectFactory.spring.autoWire"
> >> > > > >> > > value="type"
> >> > > > >> > > > />
> >> > > > >> > > > > >     ...
> >> > > > >> > > > > > </struts>
> >> > > > >> > > > > >
> >> > > > >> > > > > > to
> >> > > > >> > > > > >
> >> > > > >> > > > > > <struts>
> >> > > > >> > > > > >    ...
> >> > > > >> > > > > > </struts>
> >> > > > >> > > > > >
> >> > > > >> > > > > > and remove @Autowired with "old school"
> >> > > Object.getInstance();
> >> > > > >> on my
> >> > > > >> > > > > Actions
> >> > > > >> > > > > > and everything returns to normal.
> >> > > > >> > > > > >
> >> > > > >> > > > > > I'm reviewing the stacktrace and everything indicates
> >> that
> >> > > > >> there's
> >> > > > >> > no
> >> > > > >> > > > > > "INPUT" result (which is true); however, I don't know
> >> > where
> >> > > or
> >> > > > >> how
> >> > > > >> > > it's
> >> > > > >> > > > > > deciding to do INPUT instead of SUCCESS.  Does anyone
> >> know
> >> > > > what
> >> > > > >> > class
> >> > > > >> > > > > that
> >> > > > >> > > > > > might be?
> >> > > > >> > > > > >
> >> > > > >> > > > > > -David
> >> > > > >> > > > > >
> >> > > > >> > > > > >
> >> > > > >> > > > > >
> >> > > > >> > > > > > On Thu, Jul 18, 2013 at 6:54 AM, David Greene <
> >> > > > >> > da...@securelink.com>
> >> > > > >> > > > > > wrote:
> >> > > > >> > > > > >
> >> > > > >> > > > > > > Just the things noted in this document:
> >> > > > >> > > > > > >
> >> > > > >> > > > > > >
> >> > > > >> http://struts.apache.org/release/2.0.x/docs/spring-plugin.html
> >> > > > >> > > > > > >
> >> > > > >> > > > > > > and you know what, that's the evil of google, I
> just
> >> > > noticed
> >> > > > >> > (while
> >> > > > >> > > > > > > googling from home) that this is the appropriate
> doc:
> >> > > > >> > > > > > >
> >> > > > >> > > > > > >
> >> > > > >> http://struts.apache.org/release/2.3.x/docs/spring-plugin.html
> >> > > > >> > > > > > >
> >> > > > >> > > > > > > I'm assuming this is my problem - I'll let you know
> >> > later
> >> > > > >> today.
> >> > > > >> > > > > > >
> >> > > > >> > > > > > >
> >> > > > >> > > > > > > On Thu, Jul 18, 2013 at 12:38 AM, Lukasz Lenart <
> >> > > > >> > > > > lukaszlen...@apache.org
> >> > > > >> > > > > > >wrote:
> >> > > > >> > > > > > >
> >> > > > >> > > > > > >> 2013/7/18 David Greene <da...@securelink.com>:
> >> > > > >> > > > > > >> > Unfortunately, I don't really have much more
> >> > > information
> >> > > > >> to go
> >> > > > >> > > on.
> >> > > > >> > > > > >  What
> >> > > > >> > > > > > >> > other information might be helpful to debug
> this?
> >> > > > >> > > > > > >> >
> >> > > > >> > > > > > >> > note: this is Struts 2.3.15 and Spring 3.2.3
> >> > > > >> > > > > > >> >
> >> > > > >> > > > > > >> > Prior to adding Struts2-Spring plugin & Spring,
> >> the
> >> > > > Actions
> >> > > > >> > were
> >> > > > >> > > > all
> >> > > > >> > > > > > >> happy.
> >> > > > >> > > > > > >>
> >> > > > >> > > > > > >> Have you changed anything in the configuration?
> >> > > > >> > > > > > >>
> >> > > > >> > > > > > >>
> >> > > > >> > > > > > >> Regards
> >> > > > >> > > > > > >> --
> >> > > > >> > > > > > >> Ɓukasz
> >> > > > >> > > > > > >> + 48 606 323 122 http://www.lenart.org.pl/
> >> > > > >> > > > > > >>
> >> > > > >> > > > > > >>
> >> > > > >> > > >
> >> > > > >>
> >> > ---------------------------------------------------------------------
> >> > > > >> > > > > > >> To unsubscribe, e-mail:
> >> > > user-unsubscr...@struts.apache.org
> >> > > > >> > > > > > >> For additional commands, e-mail:
> >> > > > user-h...@struts.apache.org
> >> > > > >> > > > > > >>
> >> > > > >> > > > > > >>
> >> > > > >> > > > > > >
> >> > > > >> > > > > > >
> >> > > > >> > > > > > > --
> >> > > > >> > > > > > >
> >> > ----------------------------------------------------------
> >> > > > >> > > > > > > *David Greene*
> >> > > > >> > > > > > > *SecureLink, Inc.*
> >> > > > >> > > > > > > Secure networks for remote support
> >> > > > >> > > > > > >
> >> > ----------------------------------------------------------
> >> > > > >> > > > > > > (512) 630-2285 (m)
> >> > > > >> > > > > > > (512) 637-8744 (o)
> >> > > > >> > > > > > >
> >> > ----------------------------------------------------------
> >> > > > >> > > > > > > da...@securelink.com
> >> > > > >> > > > > > >
> >> > > > >> > > > > >
> >> > > > >> > > > > >
> >> > > > >> > > > > >
> >> > > > >> > > > > > --
> >> > > > >> > > > > >
> >> ----------------------------------------------------------
> >> > > > >> > > > > > *David Greene*
> >> > > > >> > > > > > *SecureLink, Inc.*
> >> > > > >> > > > > > Secure networks for remote support
> >> > > > >> > > > > >
> >> ----------------------------------------------------------
> >> > > > >> > > > > > (512) 630-2285 (m)
> >> > > > >> > > > > > (512) 637-8744 (o)
> >> > > > >> > > > > >
> >> ----------------------------------------------------------
> >> > > > >> > > > > > da...@securelink.com
> >> > > > >> > > > > >
> >> > > > >> > > > >
> >> > > > >> > > > >
> >> > > > >> > > > >
> >> > > > >> > > > > --
> >> > > > >> > > > > e: davelnew...@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>
> >> > > > >> > > > >
> >> > > > >> > > >
> >> > > > >> > > >
> >> > > > >> > > >
> >> > > > >> > > > --
> >> > > > >> > > >
> ----------------------------------------------------------
> >> > > > >> > > > *David Greene*
> >> > > > >> > > > *SecureLink, Inc.*
> >> > > > >> > > > Secure networks for remote support
> >> > > > >> > > >
> ----------------------------------------------------------
> >> > > > >> > > > (512) 630-2285 (m)
> >> > > > >> > > > (512) 637-8744 (o)
> >> > > > >> > > >
> ----------------------------------------------------------
> >> > > > >> > > > da...@securelink.com
> >> > > > >> > > >
> >> > > > >> > >
> >> > > > >> > >
> >> > > > >> > >
> >> > > > >> > > --
> >> > > > >> > > e: davelnew...@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>
> >> > > > >> > >
> >> > > > >> >
> >> > > > >> >
> >> > > > >> >
> >> > > > >> > --
> >> > > > >> > Cheers,
> >> > > > >> > Paul
> >> > > > >> >
> >> > > > >>
> >> > > > >>
> >> > > > >>
> >> > > > >> --
> >> > > > >> e: davelnew...@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>
> >> > > > >>
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > --
> >> > > > > ----------------------------------------------------------
> >> > > > > *David Greene*
> >> > > > > *SecureLink, Inc.*
> >> > > > > Secure networks for remote support
> >> > > > > ----------------------------------------------------------
> >> > > > > (512) 630-2285 (m)
> >> > > > > (512) 637-8744 (o)
> >> > > > > ----------------------------------------------------------
> >> > > > > da...@securelink.com
> >> > > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > > ----------------------------------------------------------
> >> > > > *David Greene*
> >> > > > *SecureLink, Inc.*
> >> > > > Secure networks for remote support
> >> > > > ----------------------------------------------------------
> >> > > > (512) 630-2285 (m)
> >> > > > (512) 637-8744 (o)
> >> > > > ----------------------------------------------------------
> >> > > > da...@securelink.com
> >> > > >
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > Cheers,
> >> > > Paul
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > ----------------------------------------------------------
> >> > *David Greene*
> >> > *SecureLink, Inc.*
> >> > Secure networks for remote support
> >> > ----------------------------------------------------------
> >> > (512) 630-2285 (m)
> >> > (512) 637-8744 (o)
> >> > ----------------------------------------------------------
> >> > da...@securelink.com
> >> >
> >>
> >>
> >>
> >> --
> >> Cheers,
> >> Paul
> >>
> >
> >
> >
> > --
> > ----------------------------------------------------------
> > *David Greene*
> > *SecureLink, Inc.*
> > Secure networks for remote support
> > ----------------------------------------------------------
> > (512) 630-2285 (m)
> > (512) 637-8744 (o)
> > ----------------------------------------------------------
> > da...@securelink.com
> >
>
>
>
> --
> ----------------------------------------------------------
> *David Greene*
> *SecureLink, Inc.*
> Secure networks for remote support
> ----------------------------------------------------------
> (512) 630-2285 (m)
> (512) 637-8744 (o)
> ----------------------------------------------------------
> da...@securelink.com
>

Reply via email to