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?


p


> The application uses log4j for logging. Before both web applications
> were deployed under the same context name. The side effect was that both
> applications logged to the same file. When I renamed web application on
> the janko virtual host, the log4j issue was solved. Looks like the same
> log4j class instance was used for applications with the same context
> name.
> 
>  
> 
> I do not use global resources in server.xml. Resources are defined in
> application context file only. Based on documentation resource elements
> defined in context is private to that context only.
> 
>  
> 
> Thank you in advance for any help,
> 
> Jan
> 
> 


-- 

[key:62590808]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to