You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Witold Szczerba <pl...@gmail.com> on 2013/02/16 04:26:48 UTC
Deploying may instances of same application in one TomEE under
different context paths.
Hi,
I am having hard time deploying the same application twice into same
instance under different context paths.
First thing I did was to uncomment the following lines in system.properties:
#openejb.deploymentId.format = {appId}/{ejbJarId}/{ejbName}
#openejb.jndiname.format = {deploymentId}{interfaceType.annotationName}
,so that the same EJBs from both instances no longer tries to step on each
other.
The problem is with JDBC connection pools though. The documentation:
http://tomee.apache.org/configuring-datasources.html
says to register resource id="resource1" in tomee.xml and then we can write:
@Statelesspublic class FooBean {
@Resource(name="resource1")
DataSource dataSource;}
Since there is no application specific mappings between resource ID and
JNDI names available for EJBs inside that application, I would have to
filter all the .java files in each application replacing the resource name
with proper ID - which is, of course, not an option.
I tried something else: instead of declaring the resources in tomee.xml, I
have moved it to WEB-INF/resources.xml. The result is super strange: now
both applications share the same database and it is the database declared
in the web app which was deployed the last.
Am I missing something? Am I trying to do stuff which are not supposed to
work, i.e. should I install separate TomEE instance for every instance of
my application?
Thanks,
Witold Szczerba
Re: Deploying may instances of same application in one TomEE under
different context paths.
Posted by Romain Manni-Bucau <rm...@gmail.com>.
it is possible but need to take care of some few things
FYI trunk should support a bit more separation of resources.xml
*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*
2013/2/18 Witold Szczerba <pl...@gmail.com>
> Hi,
> I am sorry, did not have time to create a demo webapps showing that the
> WEB-INF/resources.xml are global, but I saw your recent answer in another
> thread confirming this issue.
> For now I have setup separate TomEE instance for development continuous
> builds.
>
> As far as I remember, I had the same issue years ago with Glassfish. It
> seems the JEE servers just do not like being shared by many instances of
> the same application, do they?
>
> Regards,
> Witold Szczerba
> ---
> Sent from my mobile phone.
> On Feb 16, 2013 10:08 AM, "Romain Manni-Bucau" <rm...@gmail.com>
> wrote:
>
> > Please reproduce in a project this behavior and we can have a look (i
> have
> > some ideas)
> > Le 16 févr. 2013 04:27, "Witold Szczerba" <pl...@gmail.com> a
> écrit
> > :
> >
> > > Hi,
> > > I am having hard time deploying the same application twice into same
> > > instance under different context paths.
> > >
> > > First thing I did was to uncomment the following lines in
> > > system.properties:
> > >
> > > #openejb.deploymentId.format = {appId}/{ejbJarId}/{ejbName}
> > > #openejb.jndiname.format = {deploymentId}{interfaceType.annotationName}
> > >
> > > ,so that the same EJBs from both instances no longer tries to step on
> > each
> > > other.
> > >
> > > The problem is with JDBC connection pools though. The documentation:
> > > http://tomee.apache.org/configuring-datasources.html
> > > says to register resource id="resource1" in tomee.xml and then we can
> > > write:
> > >
> > > @Statelesspublic class FooBean {
> > > @Resource(name="resource1")
> > > DataSource dataSource;}
> > >
> > > Since there is no application specific mappings between resource ID and
> > > JNDI names available for EJBs inside that application, I would have to
> > > filter all the .java files in each application replacing the resource
> > name
> > > with proper ID - which is, of course, not an option.
> > >
> > > I tried something else: instead of declaring the resources in
> tomee.xml,
> > I
> > > have moved it to WEB-INF/resources.xml. The result is super strange:
> now
> > > both applications share the same database and it is the database
> declared
> > > in the web app which was deployed the last.
> > >
> > > Am I missing something? Am I trying to do stuff which are not supposed
> to
> > > work, i.e. should I install separate TomEE instance for every instance
> of
> > > my application?
> > >
> > > Thanks,
> > > Witold Szczerba
> > >
> >
>
Re: Deploying may instances of same application in one TomEE under
different context paths.
Posted by Witold Szczerba <pl...@gmail.com>.
Hi,
I am sorry, did not have time to create a demo webapps showing that the
WEB-INF/resources.xml are global, but I saw your recent answer in another
thread confirming this issue.
For now I have setup separate TomEE instance for development continuous
builds.
As far as I remember, I had the same issue years ago with Glassfish. It
seems the JEE servers just do not like being shared by many instances of
the same application, do they?
Regards,
Witold Szczerba
---
Sent from my mobile phone.
On Feb 16, 2013 10:08 AM, "Romain Manni-Bucau" <rm...@gmail.com>
wrote:
> Please reproduce in a project this behavior and we can have a look (i have
> some ideas)
> Le 16 févr. 2013 04:27, "Witold Szczerba" <pl...@gmail.com> a écrit
> :
>
> > Hi,
> > I am having hard time deploying the same application twice into same
> > instance under different context paths.
> >
> > First thing I did was to uncomment the following lines in
> > system.properties:
> >
> > #openejb.deploymentId.format = {appId}/{ejbJarId}/{ejbName}
> > #openejb.jndiname.format = {deploymentId}{interfaceType.annotationName}
> >
> > ,so that the same EJBs from both instances no longer tries to step on
> each
> > other.
> >
> > The problem is with JDBC connection pools though. The documentation:
> > http://tomee.apache.org/configuring-datasources.html
> > says to register resource id="resource1" in tomee.xml and then we can
> > write:
> >
> > @Statelesspublic class FooBean {
> > @Resource(name="resource1")
> > DataSource dataSource;}
> >
> > Since there is no application specific mappings between resource ID and
> > JNDI names available for EJBs inside that application, I would have to
> > filter all the .java files in each application replacing the resource
> name
> > with proper ID - which is, of course, not an option.
> >
> > I tried something else: instead of declaring the resources in tomee.xml,
> I
> > have moved it to WEB-INF/resources.xml. The result is super strange: now
> > both applications share the same database and it is the database declared
> > in the web app which was deployed the last.
> >
> > Am I missing something? Am I trying to do stuff which are not supposed to
> > work, i.e. should I install separate TomEE instance for every instance of
> > my application?
> >
> > Thanks,
> > Witold Szczerba
> >
>
Re: Deploying may instances of same application in one TomEE under
different context paths.
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Please reproduce in a project this behavior and we can have a look (i have
some ideas)
Le 16 févr. 2013 04:27, "Witold Szczerba" <pl...@gmail.com> a écrit :
> Hi,
> I am having hard time deploying the same application twice into same
> instance under different context paths.
>
> First thing I did was to uncomment the following lines in
> system.properties:
>
> #openejb.deploymentId.format = {appId}/{ejbJarId}/{ejbName}
> #openejb.jndiname.format = {deploymentId}{interfaceType.annotationName}
>
> ,so that the same EJBs from both instances no longer tries to step on each
> other.
>
> The problem is with JDBC connection pools though. The documentation:
> http://tomee.apache.org/configuring-datasources.html
> says to register resource id="resource1" in tomee.xml and then we can
> write:
>
> @Statelesspublic class FooBean {
> @Resource(name="resource1")
> DataSource dataSource;}
>
> Since there is no application specific mappings between resource ID and
> JNDI names available for EJBs inside that application, I would have to
> filter all the .java files in each application replacing the resource name
> with proper ID - which is, of course, not an option.
>
> I tried something else: instead of declaring the resources in tomee.xml, I
> have moved it to WEB-INF/resources.xml. The result is super strange: now
> both applications share the same database and it is the database declared
> in the web app which was deployed the last.
>
> Am I missing something? Am I trying to do stuff which are not supposed to
> work, i.e. should I install separate TomEE instance for every instance of
> my application?
>
> Thanks,
> Witold Szczerba
>