You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Andreas Pieber <an...@gmail.com> on 2011/02/15 17:19:22 UTC

Re: spring injected bean cannot be found

Hey Marco,

1) please feel free to start a new thread for a new question :)

2) I'm sure that there has to be a notation in the log. I'm not exactly sure
what you're doing here but I assume the following:

bundleA

imports InterfaceX;

// this thing get autoinjected
private InterfaceX x;

bundleB

public class ImplX implements InterfaceX {...

The problem is that the maven-bundle-plugin only scans your imports, not your
spring files --> he could not find ImplX (required by spring to instanciate the
class) --> You have to add the import manually in your pom files.

kind regards,
andreas

On Tue, Feb 15, 2011 at 05:20:41PM +0100, Marco Firrincieli wrote:
>    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

Re: spring injected bean cannot be found

Posted by Guillaume Nodet <gn...@gmail.com>.
On Tue, Feb 15, 2011 at 17:19, Andreas Pieber <an...@gmail.com> wrote:
> Hey Marco,
>
> 1) please feel free to start a new thread for a new question :)
>
> 2) I'm sure that there has to be a notation in the log. I'm not exactly sure
> what you're doing here but I assume the following:
>
> bundleA
>
> imports InterfaceX;
>
> // this thing get autoinjected
> private InterfaceX x;
>
> bundleB
>
> public class ImplX implements InterfaceX {...
>
> The problem is that the maven-bundle-plugin only scans your imports, not your
> spring files --> he could not find ImplX (required by spring to instanciate the
> class) --> You have to add the import manually in your pom files.

Recent maven bundle plugins do actually scan the spring / blueprint files.
Though it can only detect direct references and namespaces won't work.

>
> kind regards,
> andreas
>
> On Tue, Feb 15, 2011 at 05:20:41PM +0100, Marco Firrincieli wrote:
>>    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
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com