Skip to main content

CDI inside OSGI (glassfish v3.1)

4 replies [Last post]
Anonymous

Hello guys,

Does the CDI works as expected inside bundles deployed on OSGI?

I've tried couple of simple examples and couldn't get it to inject the
dependencies.

Example (WAB):

Simple POJO with @SessionScoped annotation.
One Servlet with @WebServlet annotation and with a property @Inject to get
the described POJO (NullPointer when try to access it).

Thanks in advance.

-------------------------------
Paulo Reis
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Roger Kitain

Hello CasMeiron ,

Yes, it should.
Can you post the source and archive for the sample?

-roger

On 7/26/10 8:33 AM, CasMeiron wrote:
> Hello guys,
>
> Does the CDI works as expected inside bundles deployed on OSGI?
>
> I've tried couple of simple examples and couldn't get it to inject the
> dependencies.
>
> Example (WAB):
>
> Simple POJO with @SessionScoped annotation.
> One Servlet with @WebServlet annotation and with a property @Inject to
> get the described POJO (NullPointer when try to access it).
>
> Thanks in advance.
>
> -------------------------------
> Paulo Reis
>

--
roger.kitain...
https://twitter.com/rogerk09
http://www.java.net/blogs/rogerk

[att1.html]

CasMeiron

Hi Roger,

I've attached the test.

If you run it on glassfish v3.1 you gonna get NullPointerException at line
25:

Pojo pojo = pojoInstance.get();

Thanks in advance.

-------------------------------
Paulo Reis

On Mon, Jul 26, 2010 at 12:16 PM, Roger Kitain wrote:

> the
[att1.html]
[simple-cdi-osgi-test.rar]
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Sivakumar Thyagarajan

On Monday 26 July 2010 09:24 PM, CasMeiron wrote:
> Hi Roger,
>
> I've attached the test.
>
> If you run it on glassfish v3.1 you gonna get NullPointerException at
> line 25:
>
> Pojo pojo = pojoInstance.get();

The archive is missing a beans.xml. Does adding a beans.xml help?

Thanks
--Siva.
>
>
> Thanks in advance.
>
> -------------------------------
> Paulo Reis
>
>
> On Mon, Jul 26, 2010 at 12:16 PM, Roger Kitain > > wrote:
>
> the

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

CasMeiron

Hi,

Yeah, it did the trick, it was missing the empty beans.xml.

Thanks Sivakumar.

-------------------------------
Paulo Reis

On Tue, Jul 27, 2010 at 8:14 AM, Sivakumar Thyagarajan <
Sivakumar.Thyagarajan@sun.com> wrote:

> On Monday 26 July 2010 09:24 PM, CasMeiron wrote:
>
>> Hi Roger,
>>
>> I've attached the test.
>>
>> If you run it on glassfish v3.1 you gonna get NullPointerException at
>> line 25:
>>
>> Pojo pojo = pojoInstance.get();
>>
>
> The archive is missing a beans.xml. Does adding a beans.xml help?
>
> Thanks
> --Siva.
>
>>
>>
>> Thanks in advance.
>>
>> -------------------------------
>> Paulo Reis
>>
>>
>> On Mon, Jul 26, 2010 at 12:16 PM, Roger Kitain >> > wrote:
>>
>> the
>>
>
[att1.html]