I'm having some trouble implementing a remote EJB pattern using a database backend. Ideally, I'd like to be able to manage the Remote EJB URLs using a table in my database.
The table would have a key entry and then a URL entry. Ideally, when JNDI went to lookup the resource, it would use this database table to resolve the reference.
I have heard of people doing this in the past but have never actually attempted to implement it myself. I'm a little confused as the best route to take.
Do I need LDAP or some other server? Is it possible to do this inherintley within the JBoss JNDI libraries? Is it some combination or another solution all togeather?
If JNDI is using a database to look up resources, how does it resolve the reference to the database itself?
Thank you for your help,
The JNDI api requires the URL to be passed in to the lookup() method, so I don't see how JBoss or any other implementation could provide built in database support, or any other type of key/value resolution.
But more important is to mention what a bad idea this is. Performance-wise, you slow things down with a database call. Architecture-wise, you create a new DB table that has no meaning within the DB tier. Why not store your key/value list in the application tier as a resource bundle?
Thank you for your suggestions. The idea here was that I could use the database table to look up the URLs of each EJB's primary server.
While using the database does slow down the initial creation, this only happens once per-service-per-server, as the EJB references are cached and only destroyed after timeout.
Using the DB layer to facilitate the lookup also would mean that I would be able to tweak the behavior of the app on the fly without altering any of my distributions. This would be useful for performance and redudancy reasons.
I'm not at all married to this idea, but am leaning towards it. I've basically just rolled my own lookup method that goes to the database, pulls the URL and returns a Properties file to the context.
Isn't this basically what an LDAP solution would do?
It seems to be working ok but am interested to know what you think.