3 Replies Latest reply on Oct 12, 2011 9:06 AM by nbhatia

    @Inject not working

    nbhatia

      I am porting a working Java EE 6 application from GlassFish 3.1 to JBoss AS 7.0.2. I am noticing that one of my dependencies is not being injected, resulting in a NullPointerException. Here's the class which has the dependency:

       

      @WebService(targetNamespace = "http://archfirst.org/bfexch/marketdataservice.wsdl", serviceName = "MarketDataService")

      public class MarketDataWebService {

       

          @WebMethod(operationName = "GetMarketPrices", action = "GetMarketPrices")

          @WebResult(name = "MarketPrice")

          public List<MarketPrice> getMarketPrices() {

              return marketDataService.getMarketPrices();

          }

       

          @Inject

          private MarketDataService marketDataService;

      }

       

      Here's the injected class, it's a simple POJO:

       

      public class MarketDataService {

          @Inject private MarketDataRepository marketDataRepository;

          ...

      }

       

      What could be the problem here? As far as I can tell, I am doing everything necessary for the container to see the inject class, e.g. I have a beans.xml file in the bean's jar file.

       

      Thanks.

      Naresh