0
votes

I'm trying to run an application using a Datasource on JBOSS EAP 6.4 In the standalone.xml file my data source is well defined. When I try a :

   Context context = new InitialContext();
   NamingEnumeration<NameClassPair> list = context.list("");
   while (list.hasMore()) 
   {
      String name = list.next().getName();
      System.out.println(name);
   }

I only get TransactionManager while I'm expecting as well my data source named in the standalone.xml as jndi-name="java:jboss/datasources/OracleDS".

Why my datasource is not defined in the jndi environnement? Am I missing some configuration?

1

1 Answers

0
votes

The Context.list(Name) does not include subcontexts. In other words you cannot iterate through all the registered names using context.list(""). If you want to list the data sources you'd need to use context.list("java:jboss/datasources).

The reason you only get the /TransactionManager is because it's the only one defined under the root namespace.