0
@Singleton
public class DummySentenceManager implements SentenceManager {

binds to

[java:global/appname/mypkg.DummySentenceManager, java:global/appname/mypkg.DummySentenceManager!mypkg.SentenceManager]

I would like it to bind to:

[java:global/appname/mypkg.SentenceManager]

without resorting to:

@Singleton(name="mypkg.SentenceManager")
public class DummySentenceManager implements SentenceManager {

Thanks!

Alexandre
  • 5,035
  • 7
  • 29
  • 36

1 Answers1

1

Why would you like it to bind like that? The EJB must be unique within the module name anyway, so there's no reason to qualify the name with a package. Also, the whole point of java:global bindings is that they aren't customizable in this way: they follow a strict and predictable pattern.

(For what it's worth, . is not a valid name for an ejb-name when specified in XML, per the XSD. I wouldn't be surprised if you hit problems in EJB implementations due to this.)

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
  • If I don't do that, how do I do a JNDI lookup for any EJB that implements the SentenceManager interface? – Alexandre Nov 10 '12 at 10:54
  • There is no standard mechanism for looking up EJBs by interface only. If you define an `@EJB(name="java:app/ejb/mypkg.ServiceManager", beanInterface=mypkg.ServiceManager.class)` somewhere in your application, then you could use `new InitialContext().lookup("java:app/ejb/mypkg.ServiceManager")`. – Brett Kail Nov 10 '12 at 16:12