• Post Reply Bookmark Topic Watch Topic
  • New Topic

Get notified when an EJB 3.x is registered within EJB container.

 
Claude Moore
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

is there a standard way to get notified when an EJB 3.x is registered within an EJB container ? I looked at lifecycle methods but they're all related to creation, passivation and similar other events...
At the moment, the only workaround I found is to use a static initializer but I feel that's more a trick than a real good idea..



I even though to inject a resource that does the same work, or to scan JNDI registry for registered EJBs objects.

Thanks for your suggestion.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2682
155
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No there is no standard way in the EJB-specifications.

Are you looking for Java_Management_Extensions kind of notifications?
 
Claude Moore
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits, thanks for your answer. No, actually I don't have in mind anything similar to JMX..I have a little number of EJB 3.x deployed in a WAR archive and I want to expose some of their methods as RESTfull web services.. I'd like to write an extension of Application class which is notified when an Ejb is installed and exposes their interfaces...



Where is populated when an EJB is deployed.

I was able to play with this approach with OSGi, using Activator... I was hoping that something similar were available even in a Java EE container, but unluckily... I was wrong.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2682
155
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I am not sure what you exactly want though.

If all EJB's are in the war, why can't you just expose them? (I know, for instance, that Jersey is bootstrapped when the Servlet container initializes. This will expose the services immediately)
 
Claude Moore
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using websphere and as far as I know it doesn't register REST annotated classes automatically on bootstrap... But I will investigate further in that direction.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!