1 Reply Latest reply on Dec 8, 2010 8:52 AM by mmulligan03

    Can't inject application scope component into webservice

    mmulligan03 Newbie

      On the start of my application, I instantiate a new object that is stored in the application scope.  This object handles encryption for the application and generates a random key when ever the application is restarted.
      The start of my encryption class:

      public class Encryption {
              private final String ALGORITHM = "AES";
              private byte[] keyValue; 
              private Encryption ssoEncryption;
              public Encryption(){
                      try {
                      } catch (Exception e) {
              public void createInstance(){
                     setSsoEncryption(new Encryption());

      I have a web service that is running and accepting requests.

      Here is the start of that:

      @WebService(serviceName = "MetawareLoginService", endpointInterface = "com.company.webservice.login.MetawareLoginServiceManager")
              style = SOAPBinding.Style.DOCUMENT,
              use = SOAPBinding.Use.LITERAL,
              parameterStyle = SOAPBinding.ParameterStyle.WRAPPED
      public class MetawareLoginService extends Service{
              private final static URL METAWARELOGINSERVICE_WSDL_LOCATION;
              private Encryption ssoEncryption;

      but when i try to access ssoEncryption it is always null. 
      I've also tried:

      ssoEncryption = (Encryption)Component.getInstance("ssoEncryption");

      but that returns with:
      javax.ejb.EJBException: java.lang.IllegalStateException: No application context active

      Any Ideas how to get my ssoEncryption object into my web service?