[logback-user] DBAppender fails for find jndi dataSource from TomEE

ceki ceki at qos.ch
Thu May 2 13:00:34 CEST 2013


Hello,

Can you set the debug attribute to true in <configuration> and post on
this list the status messages printed by logback? If that does not
help, can you please run the your examples in a debugger to track down
the reason for the different behaviors?

On 02.05.2013 02:40, 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.
>
>


-- 
Ceki
65% of statistics are made up on the spot


More information about the Logback-user mailing list