
Hello Diego, [1]
using tomcat5.5, username/password can't be specified when trying to use a JNDI-shared DataSource when using pooled data sources the user and password version of getConnection method can't be used. I don't know if this is tomcat-specific behaviour.
this is indeed an iteresting question; do we have anybody here with a better knowledge of J2EE?
... in ... ch.qos.logback.core.db.JNDIConnectionSource: Maybe some sort of "if jndi then don't use user/pass" testing could be done for better error reporting
I guess if the answer to prev. question is positive this could be a worthy idea [2]
Added to that, the JNDI name used in the "jndiLocation" must be prepended by "java:comp/env", as this is the standard context for java objects and the JNDIConnectionSource does not prepend the searched values with it.
Looks like a nice idea to me. Will not be backwards compatible but logback is not version 1 yet. I suggest that you create a Jira item for this /and maybe attach a patch/ [3]
Another thing I got problems with was slf4j's jcl-over-slf4j-1.5.2.jar. logback ... initialized too early when using jcl-over-slf4j, before tomcat makes the JNDI resources available to the web application
ch.qos.logback.core.db.JNDIConnectionSource@67c1a6 - Error while getting data source javax.naming.NameNotFoundException: javax.naming.NameNotFoundException: 'comp' can't be found in this context at org.apache.naming.NamingContext.lookup(NamingContext.java:770) ... org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155) org.apache.commons.logging.LogFactory.getLog(LogFactory.java:704) org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:381) ... org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
Looks pretty weird to me. Diego what folder is jcl-over-slf4j-1.5.2.jar in? Do you have another copy in shared tomcat libraries? Or together with tomcat own jars? Cheers, Anton Tagunov logback user