users@glassfish.java.net

OSGi - _at_EJB injection of an internal _at_Singleton

From: Robert Weeks <RWeeks_at_ext-inc.com>
Date: Mon, 20 Jun 2011 09:16:33 -0700

Hello -

We are trying to have a Singleton inside of a bundle - and have a class/servlet inside that bundle reference that singleton via @EJB - but are not getting the results we are wanting/needing.

If we define a @Singleton within the bundle:

  package com.mycompany.classes;

  @Singleton
  public class MySingleton {
    ....


and within that same bundle - have another class to reference that singleton

@EJB
private MySingleton mySingleton;


Always comes up null.

We have tried to export - but not sure if we are missing something.

In manifest:

  Export-EJB: All;
  Export-EJB: om.mycompany.classes.MySingleton;

etc.

Are we missing something here?

Thanks for any information.


Robert Weeks
Lead Developer - Framework and UI
EXTENSION, INC.
Email: rweeks_at_ext-inc.com
Office: 260-797-0200 x4228
General: 877-207-3753
www.OpenTheRedBox.com

Download the FREE EXTENSION Mobile App for iPhone and iPod Touch
http://www.opentheredbox.com/iPhone_appDemo.php