• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Container injecting JMS resources to EJB dependencies

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When using EJB (3.1), container should manage amongst others the JMS resources. Bean developer either configures @Resource annotations to the bean, or resource-refs into ejb-jar.xml.

questions:

1. What if the @Resource annotations are not in the EJB itself, but in some utility class, injected into EJB using CDI (or even deeper in injection path EJB <- util1 <- ... <- util n)? For example my EJB:




does this work, and is it standard and portable? (it does work on Glassfish v3) Is this defined in the specs somewhere?

2. What's the behavior if bean developer does not use @Resource-annotations or resource-refs, and instead tries to access JMS straight from code (tries to look up connectionFactory directly from JNDI, for example)? What does specification say (is result "undefined"), and if its undefined, what happens in practise?
 
author & internet detective
Posts: 42163
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Janne,
I believe injection doesn't work for POJOs in EJB 3.1. It definitely isn't portable in EJB 3.

Looking up the JMS resources from the JNDI is perfectly fine. Since an EJB calls the POJO it is operating under the app server's context.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic