Okay, but I still don't understand the reason of doing this stuff :)I've
already created the Application bean, and implemented
ApplicationContextAware.
Then the setApplicationContext method gets called, so I created
ApplictionContext variable in that class and set it it that method.
But if I try to access it in another bundle via Application.get(), it is
still "null".
But even if it wasn't, I think that the DAO bean, declared in other bundle
(database-bundle) would not be there.

Just to make it clear - we've got three bundles. The database bundle has
everything needed to operate with DB. It creates DAO beans and makes OSGi
sevices from them. Then, there is an Application bundle. And the last bundle
is Panel bundle, which is loaded into the App bundle via an extension point.
I need to access the DAO in the Panel bundle, and there comes the problem
mentioned above.

That's why I do not understand why should I change the Application bundle
(except the Panel complaining about Application not being in Spring Extender
thread).

Thanks for your help :)

On Mon, Jun 22, 2009 at 11:38 PM, James Carman <jcar...@carmanconsulting.com
> wrote:

> Sorry, that's IWebApplicationFactory, not IWicketApplicationFactory.
> Long day.
>
> On Mon, Jun 22, 2009 at 5:05 PM, James
> Carman<jcar...@carmanconsulting.com> wrote:
> > You will probably need to make your application class a singleton
> > (with a getInstance() method and stuff) and specify that in the spring
> > configuration:
> >
> > <bean id="wicketApplication"
> > class="com.myco.myapp.MyWicketApplication"
> > factory-method="getInstance" />
> >
> > Also, you will probably need to implement your own
> > IWicketApplicationFactory to return the singleton instance since you
> > won't have access to the Spring ApplicationContext to lookup your
> > "application" object.
> >
> > On Mon, Jun 22, 2009 at 3:57 PM, Igor Vaynberg<igor.vaynb...@gmail.com>
> wrote:
> >> you have to create wicketapplication instance as a spring bean in
> >> order for setapplicationcontext to be called.
> >>
> >> -igor
> >>
> >> On Mon, Jun 22, 2009 at 12:47 PM, Daniel Dominik
> >> Holúbek<dankodo...@gmail.com> wrote:
> >>> I tried implementing the ApplicationContextAware interface, it looked
> like a
> >>> good idea, but the "setApplicationContext" method is never called.
> >>>
> >>> On Mon, Jun 22, 2009 at 8:25 PM, Daniel Dominik Holúbek <
> >>> dankodo...@gmail.com> wrote:
> >>>
> >>>> For now, only in eclipse. But when it goes to production (or further
> >>>> testing) it will run in equinox bridge.
> >>>>
> >>>>
> >>>> On Mon, Jun 22, 2009 at 5:14 PM, James Carman <
> >>>> jcar...@carmanconsulting.com> wrote:
> >>>>
> >>>>> That's what I'd try, perhaps.  How are you starting this application?
> >>>>> Only in eclipse?
> >>>>>
> >>>>> On Mon, Jun 22, 2009 at 11:09 AM, Daniel Dominik
> >>>>> Holúbek<dankodo...@gmail.com> wrote:
> >>>>> > Well, I don't know :)I
> >>>>> >
> >>>>> > On Mon, Jun 22, 2009 at 12:32 PM, James Carman <
> >>>>> jcar...@carmanconsulting.com
> >>>>> >> wrote:
> >>>>> >
> >>>>> >> Can you have your Application object created as a Spring bean and
> make
> >>>>> >> it context "aware" and let the container inject the context into
> it?
> >>>>> >>
> >>>>> >> On Mon, Jun 22, 2009 at 2:02 AM, Daniel Dominik
> >>>>> >> Holúbek<dankodo...@gmail.com> wrote:
> >>>>> >> > But as far as I understand this, Spring DM is built upon the
> idea
> >>>>> that I
> >>>>> >> > can't build ApplicationContext, as it is built by Spring DM
> Extender.
> >>>>> Am
> >>>>> >> I
> >>>>> >> > right?
> >>>>> >> >
> >>>>> >> > On Mon, Jun 22, 2009 at 12:37 AM, James Carman <
> >>>>> >> jcar...@carmanconsulting.com
> >>>>> >> >> wrote:
> >>>>> >> >
> >>>>> >> >> Try using the other SpringComponentInjector constructor (the
> one
> >>>>> that
> >>>>> >> >> takes an ApplicationContext object).  Construct your
> >>>>> >> >> ApplicationContext however you want.
> >>>>> >> >>
> >>>>> >> >> On Sun, Jun 21, 2009 at 2:09 PM, Daniel Dominik Holúbek
> >>>>> >> >> <dankodo...@gmail.com> wrote:
> >>>>> >> >> >
> >>>>> >> >> > Well, no.I'll explain:
> >>>>> >> >> > It's an OSGi app running in equinox-bridge. In my bundles
> there is
> >>>>> no
> >>>>> >> >> > web.xml, and that's why I can't configure
> ContextLoaderListener.
> >>>>> >> >> > And because of this, when i add @SpringBean into my code,
> then add
> >>>>> >> >> > "addComponentInstantiationListener(new
> >>>>> SpringComponentInjector(this))"
> >>>>> >> >> into
> >>>>> >> >> > WebApplication's init method and then run the application,
> the
> >>>>> only
> >>>>> >> thing
> >>>>> >> >> I
> >>>>> >> >> > get is this exception:  java.lang.IllegalStateException: No
> >>>>> >> >> > WebApplicationContext found: no ContextLoaderListener
> registered?
> >>>>> >> >> >
> >>>>> >> >> > But if there is a way how to set up that listener, I would be
> >>>>> happy :)
> >>>>> >> >> >
> >>>>> >> >> >
> >>>>> >> >> > On Sun, Jun 21, 2009 at 7:28 PM, James Carman
> >>>>> >> >> > <jcar...@carmanconsulting.com>wrote:
> >>>>> >> >> >
> >>>>> >> >> > > You can't use @SpringBean?
> >>>>> >> >> > >
> >>>>> >> >> > > On Sun, Jun 21, 2009 at 11:03 AM, Daniel Dominik
> >>>>> >> >> > > Holúbek<dankodo...@gmail.com> wrote:
> >>>>> >> >> > > > Hello everyone :)So, I solved the Spring DM problems
> >>>>> >> successfully...
> >>>>> >> >> but
> >>>>> >> >> > > > there is still one problem left, and this time I am
> absolutely
> >>>>> >> sure
> >>>>> >> >> that
> >>>>> >> >> > > > it's a Wicket related problem :)
> >>>>> >> >> > > >
> >>>>> >> >> > > > I want to inject my "userDao" bean into Panel class. To
> do
> >>>>> that, I
> >>>>> >> >> nead
> >>>>> >> >> > > to
> >>>>> >> >> > > > create a bean from that Panel class - like this:
> >>>>> >> >> > > >
> >>>>> >> >> > > >
> >>>>> >> >> > > > <bean name="consumer"
> >>>>> >> >> class="sk.ziwhat.megaweb.loginpanels.prvy.lPanel"
> >>>>> >> >> > > > init-method="init">
> >>>>> >> >> > > >
> >>>>> >> >> > > > <property name="userDao" ref="userDao" />
> >>>>> >> >> > > >
> >>>>> >> >> > > > </bean>
> >>>>> >> >> > > > But when I try this, I get an exception:
> >>>>> >> >> > > >
> >>>>> >> >> > > > Caused by: org.apache.wicket.WicketRuntimeException:
> There is
> >>>>> no
> >>>>> >> >> > > application
> >>>>> >> >> > > > attached to current thread SpringOsgiExtenderThread-4
> >>>>> >> >> > > > This happens when Spring is trying to instantiate the
> Panel
> >>>>> class.
> >>>>> >> >> > > >
> >>>>> >> >> > > > I tried this with ordinary class and everything worked
> fine.
> >>>>> The
> >>>>> >> idea
> >>>>> >> >> was
> >>>>> >> >> > > > that I will instantiate a normal class, and then I will
> access
> >>>>> it
> >>>>> >> >> from
> >>>>> >> >> > > the
> >>>>> >> >> > > > Panel class, but when I do:
> >>>>> >> >> > > >
> >>>>> >> >> > > > ServiceConsumer sc = new ServiceConsumer();
> >>>>> >> >> > > >
> >>>>> >> >> > > > and then access userDao, I'll get a NullPointerException
> of
> >>>>> >> course.
> >>>>> >> >> > > >
> >>>>> >> >> > > > So has anybody done this before? I think I need your help
> :)
> >>>>> >> >> > > >
> >>>>> >> >> > > > Thanks a lot!
> >>>>> >> >> > > >
> >>>>> >> >> > > > On Tue, Jun 16, 2009 at 2:01 AM, djo mos <
> >>>>> djo.mli...@gmail.com>
> >>>>> >> >> wrote:
> >>>>> >> >> > > >
> >>>>> >> >> > > >> Hi,
> >>>>> >> >> > > >>
> >>>>> >> >> > > >> On Mon, Jun 15, 2009 at 9:28 PM, Daniel Dominik Holúbek
> <
> >>>>> >> >> > > >> dankodo...@gmail.com> wrote:
> >>>>> >> >> > > >>
> >>>>> >> >> > > >> > Well, may be, but won't they send me back to this
> >>>>> mailinglist?
> >>>>> >> >> :)To be
> >>>>> >> >> > > >> > honest, I have only a little problem with Spring DM
> itself
> >>>>> >> (there
> >>>>> >> >> are
> >>>>> >> >> > > >> > couple
> >>>>> >> >> > > >> > of tutorials out there), I was only curious about
> whether
> >>>>> >> somebody
> >>>>> >> >> has
> >>>>> >> >> > > >> > successfully tried this.
> >>>>> >> >> > > >> > For example, now it seems that the dependency is not
> being
> >>>>> >> >> injected in
> >>>>> >> >> > > my
> >>>>> >> >> > > >> > code. And I can't do that via @SpringBean, because
> that
> >>>>> needs
> >>>>> >> to
> >>>>> >> >> be
> >>>>> >> >> > > set
> >>>>> >> >> > > >> in
> >>>>> >> >> > > >> > web.xml, and I have no web.xml in my OSGi bundle.
> >>>>> >> >> > > >>
> >>>>> >> >> > > >>
> >>>>> >> >> > > >> Actually with Spring DM you do have web.xml in web
> bundles,
> >>>>> as
> >>>>> >> >> described
> >>>>> >> >> > > in
> >>>>> >> >> > > >> their reference documentation.
> >>>>> >> >> > > >> I'v been able to use Wicket with Spring DM without
> problems.
> >>>>> No
> >>>>> >> >> > > Hibernate
> >>>>> >> >> > > >> though : it really wasn't designed for a strictly
> controlled
> >>>>> >> >> environment
> >>>>> >> >> > > >> such as OSGi.
> >>>>> >> >> > > >>
> >>>>> >> >> > > >> So, I guess that your problem (not getting IoC to work)
> is
> >>>>> not
> >>>>> >> >> Wicket
> >>>>> >> >> > > >> related but Spring DM related.
> >>>>> >> >> > > >>
> >>>>> >> >> > > >> Cheers
> >>>>> >> >> > > >>
> >>>>> >> >> > > >> >
> >>>>> >> >> > > >> >
> >>>>> >> >> > > >> > But yes, there is a chance that the problem has
> nothing to
> >>>>> do
> >>>>> >> with
> >>>>> >> >> > > Wicket
> >>>>> >> >> > > >> > itself.
> >>>>> >> >> > > >> >
> >>>>> >> >> > > >> > On Mon, Jun 15, 2009 at 4:38 PM, Igor Vaynberg <
> >>>>> >> >> > > igor.vaynb...@gmail.com
> >>>>> >> >> > > >> > >wrote:
> >>>>> >> >> > > >> >
> >>>>> >> >> > > >> > > isnt this a question for the spring dmserver forum?
> >>>>> >> >> > > >> > >
> >>>>> >> >> > > >> > > -igor
> >>>>> >> >> > > >> > >
> >>>>> >> >> > > >> > > On Mon, Jun 15, 2009 at 3:49 AM, Daniel Dominik
> >>>>> >> >> > > >> > > Holúbek<dankodo...@gmail.com> wrote:
> >>>>> >> >> > > >> > > > Hello,has anybody here successfully used Spring DM
> with
> >>>>> >> >> Hibernate
> >>>>> >> >> > > >> (the
> >>>>> >> >> > > >> > > OSGi
> >>>>> >> >> > > >> > > > way) in Wicket?
> >>>>> >> >> > > >> > > > I am totally hopeless about this...
> >>>>> >> >> > > >> > > >
> >>>>> >> >> > > >> > > > The goal is to create modular app with this
> features:
> >>>>> >> >> > > >> > > > - every module (bundle) has its own
> applicationContext
> >>>>> and
> >>>>> >> DAO
> >>>>> >> >> > > >> classes.
> >>>>> >> >> > > >> > > > - i.e. if I have a module which loads blogs, I
> want to
> >>>>> >> include
> >>>>> >> >> the
> >>>>> >> >> > > >> Blog
> >>>>> >> >> > > >> > > > entity with corresponding DAO in the bundle and
> nowhere
> >>>>> >> else.
> >>>>> >> >> > > >> > > >
> >>>>> >> >> > > >> > > > Thanks in advance.
> >>>>> >> >> > > >> > > >
> >>>>> >> >> > > >> > > > --
> >>>>> >> >> > > >> > > > -danoh-
> >>>>> >> >> > > >> > > >
> >>>>> >> >> > > >> > >
> >>>>> >> >> > > >> > >
> >>>>> >> >> > >
> >>>>> >>
> ---------------------------------------------------------------------
> >>>>> >> >> > > >> > > To unsubscribe, e-mail:
> >>>>> users-unsubscr...@wicket.apache.org
> >>>>> >> >> > > >> > > For additional commands, e-mail:
> >>>>> >> users-h...@wicket.apache.org
> >>>>> >> >> > > >> > >
> >>>>> >> >> > > >> > >
> >>>>> >> >> > > >> >
> >>>>> >> >> > > >> >
> >>>>> >> >> > > >> > --
> >>>>> >> >> > > >> > -danoh-
> >>>>> >> >> > > >> >
> >>>>> >> >> > > >>
> >>>>> >> >> > > >
> >>>>> >> >> > > >
> >>>>> >> >> > > >
> >>>>> >> >> > > > --
> >>>>> >> >> > > > -danoh-
> >>>>> >> >> > > >
> >>>>> >> >> > >
> >>>>> >> >> > >
> >>>>> >>
> ---------------------------------------------------------------------
> >>>>> >> >> > > To unsubscribe, e-mail:
> users-unsubscr...@wicket.apache.org
> >>>>> >> >> > > For additional commands, e-mail:
> users-h...@wicket.apache.org
> >>>>> >> >> > >
> >>>>> >> >> > >
> >>>>> >> >> >
> >>>>> >> >> >
> >>>>> >> >> > --
> >>>>> >> >> > -danoh-
> >>>>> >> >>
> >>>>> >> >>
> >>>>> ---------------------------------------------------------------------
> >>>>> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>>> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>>> >> >>
> >>>>> >> >>
> >>>>> >> >
> >>>>> >> >
> >>>>> >> > --
> >>>>> >> > -danoh-
> >>>>> >> >
> >>>>> >>
> >>>>> >>
> ---------------------------------------------------------------------
> >>>>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>>> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>>> >>
> >>>>> >>
> >>>>> >
> >>>>> >
> >>>>> > --
> >>>>> > -danoh-
> >>>>> >
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> -danoh-
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> -danoh-
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
-danoh-

Reply via email to