On 23/10/2012 21:54, Christopher Schultz wrote:
> Pid,
> 
> On 10/23/12 3:00 PM, Pid wrote:
>> On 23/10/2012 16:55, Jan Kostelansky wrote:
>>> I am using Tomcat 6.0.18 deployed as web service on Windows XP
>>> SP3.
>>>
>>>
>>>
>>> I created additional Host element in conf/server.xml, so I have
>>> two virtual hosts: localhost (default) and janko
>>>
>>> <Host name="janko"    appBase="itsapps">
>>>
>>> <!-- Access log processes all example.
>>>
>>> Documentation at: /docs/config/valve.html
>>>
>>> -->
>>>
>>> <Valve className="org.apache.catalina.valves.AccessLogValve" 
>>> directory="logs"
>>>
>>> prefix="its_access_log." suffix=".txt" pattern="common" 
>>> resolveHosts="false"/>
>>>
>>> </Host>
>>>
>>>
>>>
>>> I deployed the same web applications in both hosts. The first
>>> web application is main, the other one is hypersonic database as
>>> storage for the web application. The main web application defines
>>> access to hypersonic database as resource.
>>>
>>> Then localhost web application points to hypersonic listening on
>>> port 9002
>>>
>>> <Resource
>>>
>>> name="jdbc/profile"
>>>
>>> auth="Container"
>>>
>>> uniqueResourceName="jdbc/profile"
>>>
>>> type="com.atomikos.jdbc.nonxa.NonXADataSourceBean"
>>>
>>> factory="org.apache.naming.factory.BeanFactory"
>>>
>>> connectionTimeout="30"
>>>
>>> poolSize="3"
>>>
>>> user="sa"
>>>
>>> password=""
>>>
>>> driverClassName="org.hsqldb.jdbcDriver"
>>>
>>> url="jdbc:hsqldb:hsql://localhost:9002"
>>>
>>> />
>>>
>>> Then janko web application points to hypersonic listening on port
>>> 9003
>>>
>>> <Resource
>>>
>>> name="jdbc/profile"
>>>
>>> auth="Container"
>>>
>>> uniqueResourceName="jdbc/profile"
>>>
>>> type="com.atomikos.jdbc.nonxa.NonXADataSourceBean"
>>>
>>> factory="org.apache.naming.factory.BeanFactory"
>>>
>>> connectionTimeout="30"
>>>
>>> poolSize="3"
>>>
>>> user="sa"
>>>
>>> password=""
>>>
>>> driverClassName="org.hsqldb.jdbcDriver"
>>>
>>> url="jdbc:hsqldb:hsql://janko:9003"
>>>
>>> />
>>>
>>> The deployment descriptors are defined in conf/Catalina/localhost
>>> and conf/Catalina/janko folders. docBase points outside of
>>> tomcat_home.
>>>
>>>
>>>
>>> However when accessing both web applications only one data source
>>> is used by both web applications depending which one is used
>>> first. It looks to me that JNDI name jdbc/profile is shared
>>> across web applications.
> 
>> That's because you can't give the same JNDI name to two different
>> DBs. What about trying to use two different names for the
>> resources?
> 
> I thought locally-defined JNDI resources were essentially private to a
> particular webapp. Is that not the case? I suppose not, since a JNDI
> DataSource will outlive the webapp that caused it to be created, and a
> newly-deployed webapp can inherit the old one, so... I guess I
> shouldn't have been surprised.

I can't find docs to support my position, but I'm (was?) sure it's the
case.  Obscure bug, deliberate design or one of us has the wrong end of
(possibly the wrong) stick?

Interesting.  Might put that on the backlog to have a sniff around the code.


p

> Jan, you ought to be able to change the name of the JNDI name and then
> use <resource-link> to map it over to what your webapp expects.
> 
> I noticed that you are using the "uniqueResourceName" attribute in
> <Resource>... what is that?
> 
> Thanks,
> -chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

-- 

[key:62590808]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to