ah ok, this can't work this way... in bundlaA only the spring files in bundleA count; if you define the autowiring things in bundleA-spring-file it will work; BUT bundleA-spring-files have no idea of bundleb-spring-files... I hope it is clear what I'm pointing at... Typically you don't want to do a new XXX in bundleA but rather import a service from bundleB
@thread: no it isn't you also have to remove the In-Reply-To: field in the header; simply hitting reply and changing the subject does not really create a new thread :) kind regards, andreas On Tue, Feb 15, 2011 at 05:41:33PM +0100, Marco Firrincieli wrote: > Here it comes: > > (I’ve tried to simplify here... hope it works) > > Here’s my karaf list command output (notice all I need is in an Active state). > > [51] [Active] [] [] [75] my.legacy.something.just-a-jar (1.0.0.SNAPSHOT) > [105] [Active] [] [] [70] some.domain.beans (1.0.0.SNAPSHOT) > [142] [Active] [] [] [70] bundleB (1.0.0.SNAPSHOT) > [142] [Active] [] [] [70] bundleA (1.0.0.SNAPSHOT) > > at some point in bundleA i have: > > package my.package.bundleA > > import some.class.in.bundleB.BundleBClass; > > public class MyClass { > void doStuff() { > new BundleBClass().sayHello(); > } > } > > > Whereas in bundleB > > package some.class.in.bundleB; > > public class BundleBClass { > > @Autowired > private Sayer sayer; > > void sayHello() { > this.sayer.say("hello"); > } > } > > And of course bundleB exports its BundleBClass > > > I’ve got a wonderful nullpointer in sayHello method because "sayer" is null. > The autowired doesn’t seem to work. > > > > > Ps: @Andreas, is this not a new thread? > > > > > > > > > > > > > > From: j...@nanthrax.net [mailto:j...@nanthrax.net] > Sent: martedì 15 febbraio 2011 17:21 > To: user@karaf.apache.org; Marco Firrincieli > Subject: Re: spring injected bean cannot be found > > Do you use blueprint for that or pure OSGi services ? > Could we have the spring file and the complete stack trace ? > > Regards > JB > ________________________________________ > From: Marco Firrincieli <marco.firrinci...@lbigroup.it> > Date: Tue, 15 Feb 2011 17:20:41 +0100 > To: user@karaf.apache.org<user@karaf.apache.org> > ReplyTo: user@karaf.apache.org > Subject: spring injected bean cannot be found > > One of my bundles (call it bundleA) instantiate a new Stuff() and this Stuff > is another bundle (bundleB) (already up and running) and has a Spring > autowired bean. > > Result: nullpointerexception the (supposedly) injected bean. > > Any idea? Should add something in bundleB’s manifest? > > > Can’t find much googling about this. > > Thanks > > -m
pgpYeTiMynuk7.pgp
Description: PGP signature