3 Replies Latest reply on May 29, 2008 11:59 AM by mamoray

    Can't get Datasource outside container (4.2)


      Hello there! This is a very dumb question, I know. But it's friday, past 6pm, and its annoying me a lot.

      I'm running some junit tests, and I'm not being able to get the datasource from the jndi. It's deployed. My SLSBs do have access on them (through entity manager) but on the unit test it says its not bound. What's odd, is that if I look for anything else (ConnectionFactory, Queue, Topic, Remote interfaces) it locates, but no datasource at all. Here's a snippet:

      InitialContext ctx = new InitialContext();
       Queue q = (Queue)ctx.lookup("java:/queue/A"); //found
       ConnectionFactory qf = (ConnectionFactory)ctx.lookup("java:/ConnectionFactory");//found
       SomeEJB ejb = (SomeEJB)ctx.lookup("SomeEJB/remote");//found
       DataSource ds = (DataSource)ctx.lookup("java:mysqlDS");//not bound

      I've double checked the jndi name on the jmx-console and it's bound to java:mysqlDS.

      Any ideas of why I just can't find the datasource object?