[logback-user] jndi db access in tomcat5.5

Anton Tagunov anton.tagunov at umail.ru
Tue Jul 15 12:41:26 CEST 2008


Hi Diego,


Diego> prepended by "java:comp/env", as this is the standard context for java 
Diego> objects and the JNDIConnectionSource does not prepend the searched values with it.

Anton> Looks like a nice idea to me.
Anton> Will not be backwards compatible but logback is not version 1 yet.

Diego> In my company we have our own DataSourceLocator class that abstracts the 
Diego> JNDI lookup and automagically prepends all searched keys with 
Diego> "java:comp/env" but this is obviously custom behaviour.

Diego> There are two options here: document the need for the prefix in the 
Diego> manual or add the prefix to all keys in the JNDIConnectionSource class. 
Diego> I'd suggest the former option as the best one

Could you please create a Jira item for this?
Don't worry, if it's deemed a bad idea the
item shall be simply closed as 'WONT FIX'.

Diego> Another thing I got problems with was slf4j's jcl-over-slf4j-1.5.2.jar. 
Diego> logback ... initialized too early when using jcl-over-slf4j, before tomcat 
Diego> makes the JNDI resources available to the web application

Diego> ch.qos.logback.core.db.JNDIConnectionSource at 67c1a6 - Error while getting 
Diego> data source javax.naming.NameNotFoundException:
Diego> javax.naming.NameNotFoundException: 'comp' can't be found in this context
Diego>         at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
Diego> ...
Diego> org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
Diego> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:704)
Diego> org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:381)
Diego> ...
Diego> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)

Anton> Looks pretty weird to me. Diego what folder is jcl-over-slf4j-1.5.2.jar in?
Anton> Do you have another copy in shared tomcat libraries? Or together with tomcat own jars?

Diego> I tested including jcl-over-slf4j in both the webapp WEB-INF/lib dir and 
Diego> in global tomcat common/lib. Got the same error both times.

Diego, could you please try this WITHOUT jcl-over-slf4j in common/lib?
99.99% probability that it's the root of the problem.

Cheers,
Anton



More information about the Logback-user mailing list