3 Replies Latest reply on Apr 13, 2010 3:29 PM by Pete Muir

    JMS resource producer methods

    Joshua Portway Newbie

      Another question….
      I’ve tried to use the JMS resource injection example code in the “JMS Endpoints” section of the Weld reference manual, but it’s not working for me, and I’m not sure I fully understand how it’s supposed to work…

      The main problems I’m getting seem to be with the lifecycle of the JMS resources produced. The session object gets closed before the messageProducer is requested, resulting in an exception. The class containing the producer methods themselves seems to get instantiated multiple times (I’m assuming it’s instantiated once every time a producer method is called, and then thrown away again) - this doesn’t seem right.

      I made a separate class with the JMS resource producer methods more or less copied from the Weld manual. This seemed what the manual is suggesting, but I’ve also tried copying the producer methods directly into the (Singleton) EJB that uses them, and I get the same issues.

      Is there something I’m not understanding about how to use this code? Should the producer method class be annotated with a scope for instance? Or is this maybe a bug relating to the fact that I’m injecting into a singleton EJB?