You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Karen Schaper <Ka...@frontiernet.net> on 2008/01/13 17:59:57 UTC
InjectorHolder has not been assigned an injector error
Hello Again,
I am upgrading to the latest and greatest release of wicket 1.3. I made
the change to register my converters by overriding the newConverterLocator
method. In my customer converter class, in the constructor, I am calling
InjectorHolder.getInjector().inject( this ); The converter class is using
a couple of spring beans.
I am getting the following error when started tomcat.
java.lang.IllegalStateException: InjectorHolder has not been assigned an
injector. Use InjectorHolder.setInjector() to assign an injector. In most
cases this should be done once inside SpringWebApplication subclass's init()
method.
In the my Application class, (which is extends AuthenticatedWebApplication)
@Override
protected void init()
{
super.init();
addComponentInstantiationListener( new SpringComponentInjector(
this );
.
..
I tried calling the InjectorHolder.setInjector to assign an injector but
still get the error. Again the only change I made that caused the error was
using the new way to register converters and of course upgrading my wicket.
My converter needs to call InjectorHolder.getInjector().inject( this ).
I'm guessing that the call to newConverterLocater happens before Spring
injection.
Any ideas on how to fix this?
Thanks
Karen
(Wicket Newbie)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: InjectorHolder has not been assigned an injector error
Posted by Eelco Hillenius <ee...@gmail.com>.
> > Could you please open a JIRA issue for this? We should probably create
> > the converterLocator and possibly the session store lazily instead of
> > in Application#internalInit.
>
> Sure.
Thanks. I looked into it
(https://issues.apache.org/jira/browse/WICKET-1279) and came to the
conclusion that it is probably not worth fixing, since it is an
uncommon case, and there are workarounds for it. A nicer workaround
then doing it in newConverterLocator is maybe to override internalInit
(ignore the docs for once), create the SpringComponentInjector at the
start of that method, and then call super.internalInit.
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: InjectorHolder has not been assigned an injector error
Posted by Karen Schaper <Ka...@frontiernet.net>.
> > Tried putting "addComponentInstantiationListener( new
> > SpringComponentInjector(this );"
> >
> > into the constructor of Application which extends
> > AuthentationWebApplication... but I now get the following error.
> >
> > java.lang.IllegalStateException: servletContext is not set yet.
> Any code in
> > your Application object that uses the wicket filter instance
> should be put
> > in the init() method instead of your constructor
>
> That sucks. How about - big hack - doing it in your
> newConverterLocater method, just before you create the locator? That
> should definitively work, though it's a bit nasty :-)
Yes that worked. Now I'm onto other upgrading issues :)
>
> Could you please open a JIRA issue for this? We should probably create
> the converterLocator and possibly the session store lazily instead of
> in Application#internalInit.
Sure.
>
> Cheers,
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: InjectorHolder has not been assigned an injector error
Posted by Eelco Hillenius <ee...@gmail.com>.
> Tried putting "addComponentInstantiationListener( new
> SpringComponentInjector(this );"
>
> into the constructor of Application which extends
> AuthentationWebApplication... but I now get the following error.
>
> java.lang.IllegalStateException: servletContext is not set yet. Any code in
> your Application object that uses the wicket filter instance should be put
> in the init() method instead of your constructor
That sucks. How about - big hack - doing it in your
newConverterLocater method, just before you create the locator? That
should definitively work, though it's a bit nasty :-)
Could you please open a JIRA issue for this? We should probably create
the converterLocator and possibly the session store lazily instead of
in Application#internalInit.
Cheers,
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
RE: InjectorHolder has not been assigned an injector error
Posted by Karen Schaper <Ka...@frontiernet.net>.
> -----Original Message-----
> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> Sent: Sunday, January 13, 2008 12:11 PM
> To: users@wicket.apache.org
> Subject: Re: InjectorHolder has not been assigned an injector error
>
>
> > I'm guessing that the call to newConverterLocater happens before Spring
> > injection.
>
> Yeah. Too bad, maybe in hind sight it would have been better to create
> it lazily.
>
> > Any ideas on how to fix this?
>
> I think just creating the SpringComponentInjector in your webapp's
> constructor instead of in the init method should do the trick.
Tried putting "addComponentInstantiationListener( new
SpringComponentInjector(this );"
into the constructor of Application which extends
AuthentationWebApplication... but I now get the following error.
java.lang.IllegalStateException: servletContext is not set yet. Any code in
your Application object that uses the wicket filter instance should be put
in the init() method instead of your constructor
Thanks for the suggestion anyhow.
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: InjectorHolder has not been assigned an injector error
Posted by Eelco Hillenius <ee...@gmail.com>.
> I'm guessing that the call to newConverterLocater happens before Spring
> injection.
Yeah. Too bad, maybe in hind sight it would have been better to create
it lazily.
> Any ideas on how to fix this?
I think just creating the SpringComponentInjector in your webapp's
constructor instead of in the init method should do the trick.
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org