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: [email protected] [mailto:[email protected]]
Sent: martedì 15 febbraio 2011 17:21
To: [email protected]; 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 <[email protected]>
Date: Tue, 15 Feb 2011 17:20:41 +0100
To: [email protected]<[email protected]>
ReplyTo: [email protected]
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