Jdbc using JNDI reference fails
Status: Beta
Brought to you by:
diabolo512
jGuard v1.0.3 (this option is missing in Group dropdown)
NamingException(NameNotFoundException) "Name jdbc is not bound in this Context" occurs in constructor ConnectionFactory(Map opts)
Occurs in both authentication and authorization.
Configured JNDI string is "jdbc/something".
When replaced this line in the constructor:
Object object = (DataSource) initCtx.lookup(jndiRef);
by:
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Object object = (DataSource) envCtx.lookup(jndiRef);
it starts to work.
Logged In: YES
user_id=1798841
Originator: YES
Another way, how to make it work, is add "java:comp/env/" to JNDI string, as is adviced in JdbcAuthenticationManager JGuard XWiki - and I missed it.