1 Reply Latest reply on Jun 11, 2012 5:15 AM by gpro

    Not working injection with Service

    lanrjtokenring

      Hi all,

      I have this problem and I cannot get rid ot it!

       

      I have a JBoss service like this:

       

       

      {code}

      @Service()

      @Local(MyServLocal.class)

      @Remote(MyServRemote.class)

      @Management(MyServRemoteManagement.class)

      @Depends("jboss.ha:service=HASingletonDeployer,type=Barrier")

      @Clustered

      public class MyService

                implements MyServLocal,MyServRemote {

       

                @Resource(mappedName="activemq/TopicConnectionFactory")

                private TopicConnectionFactory tConnFactory;

                @Resource(mappedName="topic/CTOST")

                private Topic ctostopic;

       

                public void create(){

                          if(tConnFactory!=null){

                                    System.out.println("[Start] Scheduler started");

                          } else {

                                    System.out.println("[Start] Failed");

                          }

                }

       

       

                public void start() {

                          this.create();

                }

       

      {code}

       

      Either tConnFactory and ctostopic are null. By the way I can see the resources in JNDIView and, if I call after JBoss startup a EJB injecting the same resources, references are correctly injected.

       

      Can anybode help on this? Any idea?

       

      This is with JBoss 5.1, but also with 6.

       

      Regards

        • 1. Re: Not working injection with Service
          gpro

          Hi all,

           

          I have the same problem trying to have a valid resource using:

          @Resource(mappedName="activemq/TopicConnectionFactory")

          private TopicConnectionFactory factory;

           

          I think there are some problems related to class isolation. In my tests, "factory" is null when class isolation is ON, while it works fine when isolation is disabled.

           

          Any ideas?

           

          Please help on this.

           

          Regards