2 Replies Latest reply on Mar 30, 2012 3:15 AM by Bob Kung

    How to lookup datasource from MDB at runtime

    Bob Kung Newbie

      Hello all,

       

      I facing a problem in my project and google a lot, yet no luck. Please help!!

       

      We have several datasource defined in AS 7, they all binded to java:jboss/datasource/xxx. And  I deployed a MDB which need to lookup datasource at runtime.

       

      The MDBContext has injected to my MDB, and it provides a lookup method for me to lookup the instance we need dynamically.

       

      However, I only got an IllegalArgumentException said the jndi doesn't belong to java:app, java:module, java:comp or java:global namespace. Moreover, only valid jndi name for datasources have to start with java:/ or java:jboss/.

       

      From developer guide, under java:jboss should be accessed  from the entire jboss. So is this a bug? and does any workaround to resolve this problem.

       

       

      Many thanks!