[logback-user] DBAppender fails for find jndi dataSource from TomEE
sgarlick
sgarlick987 at gmail.com
Thu May 2 04:12:53 CEST 2013
I've gone ahead and updated to logback 1.0.12 and slf4j / jcl-over-slf4j 1.75
and the problem continues.
Here's the full stack trace produced at startup as well
21:50:21,702 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
Naming appender as [DB]
21:50:21,715 |-INFO in ch.qos.logback.core.db.JNDIConnectionSource at 47f0bdcb
- Looking up [java:comp/env/jdbc/datasource] in JNDI
21:50:21,716 |-ERROR in ch.qos.logback.core.db.JNDIConnectionSource at 47f0bdcb
- Error while getting data source javax.naming.NameNotFoundException: Name
[comp/env/jdbc/datasource] is not bound in this Context. Unable to find
[comp].
at javax.naming.NameNotFoundException: Name [comp/env/jdbc/datasource] is
not bound in this Context. Unable to find [comp].
at at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
at at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
at at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
at at javax.naming.InitialContext.lookup(InitialContext.java:411)
at at
ch.qos.logback.core.db.JNDIConnectionSource.lookupDataSource(JNDIConnectionSource.java:100)
at at
ch.qos.logback.core.db.JNDIConnectionSource.getConnection(JNDIConnectionSource.java:58)
at at
ch.qos.logback.core.db.ConnectionSourceBase.discoverConnectionProperties(ConnectionSourceBase.java:48)
at at
ch.qos.logback.core.db.JNDIConnectionSource.start(JNDIConnectionSource.java:50)
at at
ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
at at
ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
at at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
at at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at
ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at at
ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at at
org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at at
org.jboss.logging.Slf4jLoggerProvider.getLogger(Slf4jLoggerProvider.java:33)
at at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:37)
at at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:32)
at at org.jboss.logging.Logger.getLogger(Logger.java:2163)
at at org.jboss.logging.Logger.getMessageLogger(Logger.java:2259)
at at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
at at
org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:28)
at at
org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<clinit>(ValidatorFactoryImpl.java:51)
at at
org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45)
at at
org.apache.bval.jsr303.ConfigurationImpl.doPrivBuildValidatorFactory(ConfigurationImpl.java:252)
at at
org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:131)
at at
org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:129)
at at
org.apache.bval.jsr303.ConfigurationImpl.run(ConfigurationImpl.java:337)
at at
org.apache.bval.jsr303.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:244)
at at
org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:76)
at at
org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:46)
at at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:658)
at at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:560)
at at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1133)
at at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1038)
at at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:124)
at at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at at java.lang.Thread.run(Thread.java:722)
21:50:21,719 |-WARN in ch.qos.logback.core.db.JNDIConnectionSource at 47f0bdcb
- Could not discover the dialect to use. java.sql.SQLException:
NamingException while looking up DataSource: Name [comp/env/jdbc/datasource]
is not bound in this Context. Unable to find [comp].
at java.sql.SQLException: NamingException while looking up DataSource: Name
[comp/env/jdbc/datasource] is not bound in this Context. Unable to find
[comp].
at at
ch.qos.logback.core.db.JNDIConnectionSource.getConnection(JNDIConnectionSource.java:66)
at at
ch.qos.logback.core.db.ConnectionSourceBase.discoverConnectionProperties(ConnectionSourceBase.java:48)
at at
ch.qos.logback.core.db.JNDIConnectionSource.start(JNDIConnectionSource.java:50)
at at
ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
at at
ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
at at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
at at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at
ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at at
ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at at
org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at at
org.jboss.logging.Slf4jLoggerProvider.getLogger(Slf4jLoggerProvider.java:33)
at at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:37)
at at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:32)
at at org.jboss.logging.Logger.getLogger(Logger.java:2163)
at at org.jboss.logging.Logger.getMessageLogger(Logger.java:2259)
at at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
at at
org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:28)
at at
org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<clinit>(ValidatorFactoryImpl.java:51)
at at
org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45)
at at
org.apache.bval.jsr303.ConfigurationImpl.doPrivBuildValidatorFactory(ConfigurationImpl.java:252)
at at
org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:131)
at at
org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:129)
at at
org.apache.bval.jsr303.ConfigurationImpl.run(ConfigurationImpl.java:337)
at at
org.apache.bval.jsr303.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:244)
at at
org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:76)
at at
org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:46)
at at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:658)
at at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:560)
at at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1133)
at at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1038)
at at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:124)
at at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at at java.lang.Thread.run(Thread.java:722)
21:50:21,726 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 17:14 -
RuntimeException in Action for tag [appender]
java.lang.IllegalStateException: DBAppender cannot function if the JDBC
driver does not support getGeneratedKeys method *and* without a specific SQL
dialect
at java.lang.IllegalStateException: DBAppender cannot function if the JDBC
driver does not support getGeneratedKeys method *and* without a specific SQL
dialect
at at ch.qos.logback.core.db.DBAppenderBase.start(DBAppenderBase.java:62)
at at ch.qos.logback.classic.db.DBAppender.start(DBAppender.java:92)
at at
ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
at at
ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
at at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
at at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at
ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at at
ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at at
org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at at
org.jboss.logging.Slf4jLoggerProvider.getLogger(Slf4jLoggerProvider.java:33)
at at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:37)
at at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:32)
at at org.jboss.logging.Logger.getLogger(Logger.java:2163)
at at org.jboss.logging.Logger.getMessageLogger(Logger.java:2259)
at at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
at at
org.hibernate.validator.internal.util.logging.LoggerFactory.make(LoggerFactory.java:28)
at at
org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<clinit>(ValidatorFactoryImpl.java:51)
at at
org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45)
at at
org.apache.bval.jsr303.ConfigurationImpl.doPrivBuildValidatorFactory(ConfigurationImpl.java:252)
at at
org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:131)
at at
org.apache.bval.jsr303.util.SecureActions$5.run(SecureActions.java:129)
at at
org.apache.bval.jsr303.ConfigurationImpl.run(ConfigurationImpl.java:337)
at at
org.apache.bval.jsr303.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:244)
at at
org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:76)
at at
org.apache.openejb.assembler.classic.ValidatorBuilder.buildFactory(ValidatorBuilder.java:46)
at at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:658)
at at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:560)
at at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1133)
at at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1038)
at at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:124)
at at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at at java.lang.Thread.run(Thread.java:722)
sgarlick wrote
> Hi, I've been having some issues setting up the DBAppender using a jndi
> DataSource supplied by TomEE. The datasource works fine in the
> application,
> but logback errors out when setting up its DBAppender with the same jndi
> location.
>
> Specifically JNDIConnectionSource.lookupDataSource throws a
> NamingException, which does the
> same lookup as my application code, but only the application code finds
> the
> datasource successfully.
>
> TomEE version 1.5.2
> Logback classic 1.0.9
>
> I've configured a DBAppender in logback.xml as so
>
>
> <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
>
> <connectionSource class="ch.qos.logback.core.db.JNDIConnectionSource">
>
> <jndiLocation>
> java:comp/env/jdbc/datasource
> </jndiLocation>
>
> </connectionSource>
>
> </appender>
> in web.xml
>
>
> <resource-ref>
>
> <res-ref-name>
> jdbc/datasource
> </res-ref-name>
>
> <res-type>
> javax.sql.DataSource
> </res-type>
>
> <res-auth>
> Container
> </res-auth>
>
> </resource-ref>
> in tomee context.xml
>
>
> <Resource name="jdbc/datasource" auth="Container"
> type="javax.sql.DataSource"
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> maxActive="100" maxIdle="30" maxWait="10000"
> username="user"
> password="secret"
> driverClassName="oracle.jdbc.driver.OracleDriver"
> url="jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL
> = TCP) (HOST =
> localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME
> =
> SERVICE)))" />
> and my application dataSource bean successfully finds the dataSource
>
> Context ctx = new InitialContext();
> return (DataSource) ctx.lookup("java:comp/env/jdbc/datasource");
>
> Please let me know if anymore information is needed.
--
View this message in context: http://logback.10977.n7.nabble.com/DBAppender-fails-for-find-jndi-dataSource-from-TomEE-tp12265p12266.html
Sent from the Users mailing list archive at Nabble.com.
More information about the Logback-user
mailing list