I'm using a Payara application server on which I have defined a connection pool in order to lookup after it in my application. The ping made from application server to database works.
In my domain.xml database resource is configured as follows:
<jdbc-resource pool-name="MasterPool" jndi-name="jdbc/master"></jdbc-resource>
<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.ClientDataSource40" name="MasterPool" res-type="javax.sql.DataSource">
...
</jdbc-connection-pool>
The setup of Context is made on servlet init method.
public void init() throws ServletException {
Context env = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
try {
env = new InitialContext(ht);
pool = (DataSource) env.lookup("master");
System.out.println("Data source found");
}
catch(NamingException ne) {
throw new ServletException(ne);
}
}
Can you give some insight about the message:
javax.servlet.ServletException: javax.naming.NameNotFoundException: master
I've tried to make the lookup after jdbc/master and java:/comp/env/jdbc/master
Regards,