tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Uhlir <>
Subject Re: 2 web apps - 1 ejb - 2 db?
Date Wed, 01 Apr 2009 22:43:09 GMT
David Blevins wrote:
> On Apr 1, 2009, at 1:24 PM, Martin Uhlir wrote:
>> assume, I have two (very similar) web applications (let's call them A 
>> and B) which uses EJB as backend. The question is, how I can achieve, 
>> that the application A stores its data to a database SchemaA, while 
>> the application B stores its data to database SchemaB, while both 
>> applications use the same EJB module (storing the data from A and B 
>> is done via the EJB)? I want to avoid running (developing) two EJB 
>> modules with the same functionality.
>> So is it somehow possible to achieve this just with some kind of 
>> configuration or is there any other way how to solve this?
>> Note that the web applications will run on one server, while the EJB 
>> on a different one.
> Hi Martin,
> No way to do this as far as I know.  Even assuming you did something 
> very low level like wrapped the factory that creates the DataSources 
> so that the DataSource you create depends on some kind of thread state 
> which you set on in coming requests from webapp A or B, it still would 
> quickly fall apart due to things like connection pooling.
> Is there some kind of overhead to deploying the application twice that 
> you'd like to avoid?  Note with the right descriptors you wouldn't 
> need to modify the code at all.  Might be some features we can add 
> there to eliminate any concerns.
> -David

Hello David,

thank you for quick reply. Well, first my thought was, that it could 
save resources on the server, because I expect to have even more these 
similar web applications, so it seemed a bit pointless to me to have 10 
times exactly the same EJB module deployed on the server.
Well, now arise a question, is it possible to deploy the same EJB module 
(the same classes, same packages) 2 times, 3 times, ..., 10 times onto 
one server? Won't the server be "confused" to have more the same classes 
deployed on it? How can then the client applications A, B, C etc. 
differentiate which particular EJB module (with the suitable 
configuration files to access the proper db) they want to work with?


View raw message