[logback-user] DBAppender fails for find jndi dataSource from TomEE
sgarlick
sgarlick987 at gmail.com
Thu May 2 19:19:39 CEST 2013
13:15:26,530 |-INFO in ch.qos.logback.core.db.JNDIConnectionSource at 782817d7 -
Looking up [java:comp/env/jdbc/datasource] in JNDI
is the output from above, which is the correct location.
On another note, I got it working by changing my TomEE config as follows.
server.xml
<GlobalNamingResources>
<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)))" />
</GlobalNamingResources>
context.xml
<ResourceLink name="jdbc/datasource" global="jdbc/datasource"
type="javax.sql.DataSource"/>
logback.xml
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.JNDIConnectionSource">
<jndiLocation>java:jdbc/datasource</jndiLocation>
</connectionSource>
</appender>
But as you can see here, I have to references TomEE's global resource which
doesn't feel correct. From what I can tell TomEE initializes its global
resources, initializes logging, and then registers the comp/env resources.
You'd except to be able to look up java:comp/env/jdbc/datasource with this
configuration as well, but that is not the case and the lookup fails.
--
View this message in context: http://logback.10977.n7.nabble.com/DBAppender-fails-for-find-jndi-dataSource-from-TomEE-tp12265p12280.html
Sent from the Users mailing list archive at Nabble.com.
More information about the Logback-user
mailing list