5 Replies Latest reply on Jan 4, 2006 7:36 PM by starksm64

    Accessing web service from MBean

    hlehtimaki

      Hi

      I'm trying to access a web service from an MBean, but I get javax.naming.NameNotFoundException: env not bound

      My code looks like this:

      InitialContext iniCtx = new InitialContext();
      SmsApiService service = (SmsApiService) iniCtx
       .lookup("java:comp/env/service/SmsApiService");
      SmsApiPort endpoint = service.getSmsApi50();
      


      Similar code works in a servlet as I have defined <service-ref> in web.xml. How could I make my MBean to find the service too?

      Harri