tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neale Rudd" <ne...@metawerx.net>
Subject Re: Findings from moving a Tomcat 7.0.26 app to TomEE beta 1.0.0 plus
Date Wed, 07 Mar 2012 07:30:18 GMT
Hi Romain,

> 3. if your database if not correct, can't be created or is not found a
> default one (the one you found in default openejb conf) will be used.
> Normally we read context.xml in <your-webapp>/META-INF/context.xml. If you
> manage to reproduce it in a simple test please create a jira here
> https://issues.apache.org/jira/browse/TOMEE

Figured this one out with a bit of JNDI browsing.  The customer had a 
resource ref in web.xml which had the same name as the resource in 
context.xml.

  <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/JNDINAME</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

This over-rode the context.xml resource, so that now only this one existed 
in java:comp/env/jdbc (it gets added to the tree after the context.xml one).

In this case, TomEE looks in openejb.xml for it and will match it if found 
by name, or if not found, as you describe above, it uses the first database 
found (making it the default).

One weird thing I found though was that restarting the application did not 
remove the resource-ref from JNDI.  It appears the JNDI directory is not 
cleaned up on application destroy.  This can be demonstrated by adding a 
resource-ref, reloading, changing the res-ref-name, reloading, then looking 
at java:comp/env/jdbc - you'll see multiple entries in there.   They vanish 
after the VM is restarted of course.

Best Regards,
Neale Rudd
Metawerx Pty Ltd
http://www.metawerx.net


Mime
View raw message