You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Kirchev, Lazar" <l....@sap.com> on 2012/04/06 16:13:17 UTC

NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Hello,

I am writing in a relation to a problem with deploy of two applications using JPA from EJB. They use identical (same id) custom DataSources, which are specified in the resources.xml files.

When the second application is deployed a NameAlreadyBoundException is thrown because the DataSource was already bound from the first application deployment. The binding is done in Assembler.createResource(), line 1540, and the resource is bound in the container jndi context, under openejb/Resource/<data_source_id>.

Is this a problem with custom DataSources, or I make the configuration of the custom DataSources in a wrong way?

Lazar

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
No because often app id are used in applications for injection names. So
doing it automatically can create issues which are a bit weird to debug.

- Romain


2012/4/11 lazarkirchev <la...@gmail.com>

> Just a minor detail - here you mean that the app id should be added in the
> description of the resource in the resources.xml? There is no transparent
> way to make OpenEJB do that?
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/NameAlreadyBoundException-when-deploying-two-applications-using-one-and-the-same-custom-DataSource-tp4537489p4548218.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by lazarkirchev <la...@gmail.com>.
Just a minor detail - here you mean that the app id should be added in the
description of the resource in the resources.xml? There is no transparent
way to make OpenEJB do that?

--
View this message in context: http://openejb.979440.n4.nabble.com/NameAlreadyBoundException-when-deploying-two-applications-using-one-and-the-same-custom-DataSource-tp4537489p4548218.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by lazarkirchev <la...@gmail.com>.
Thanks!

--
View this message in context: http://openejb.979440.n4.nabble.com/NameAlreadyBoundException-when-deploying-two-applications-using-one-and-the-same-custom-DataSource-tp4537489p4539323.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
No but a good practise can be to put an app id in the resource name.

For instance <app>/jdbc/ds

- Romain

Le 6 avr. 2012 17:34, "lazarkirchev" <la...@gmail.com> a écrit :

> Thanks. But still, since the other applications will be able to lookup the
> resource, is there a way to specify a resource visible only for the
> application which specifies it?
>
> Lazar
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/NameAlreadyBoundException-when-deploying-two-applications-using-one-and-the-same-custom-DataSource-tp4537489p4537655.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by lazarkirchev <la...@gmail.com>.
Thanks. But still, since the other applications will be able to lookup the
resource, is there a way to specify a resource visible only for the
application which specifies it?

Lazar

--
View this message in context: http://openejb.979440.n4.nabble.com/NameAlreadyBoundException-when-deploying-two-applications-using-one-and-the-same-custom-DataSource-tp4537489p4537655.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Yes it is. But it is created with the classloader containing it so you can
define resources where classes are only in a webapp for instance.

- Romain

- Romain

Le 6 avr. 2012 17:20, "lazarkirchev" <la...@gmail.com> a écrit :

> Then the resources specified in the resources.xml are global for all
> deployed
> applications? Is this the case?
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/NameAlreadyBoundException-when-deploying-two-applications-using-one-and-the-same-custom-DataSource-tp4537489p4537614.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by lazarkirchev <la...@gmail.com>.
Then the resources specified in the resources.xml are global for all deployed
applications? Is this the case?

--
View this message in context: http://openejb.979440.n4.nabble.com/NameAlreadyBoundException-when-deploying-two-applications-using-one-and-the-same-custom-DataSource-tp4537489p4537614.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: NameAlreadyBoundException when deploying two applications using one and the same custom DataSource

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Each resource id should be unique, even in resources.xml. It is just an
easier way to deploy regarding classloading for instance.

- Romain

Le 6 avr. 2012 16:22, "Kirchev, Lazar" <l....@sap.com> a écrit :

> Hello,
>
> I am writing in a relation to a problem with deploy of two applications
> using JPA from EJB. They use identical (same id) custom DataSources, which
> are specified in the resources.xml files.
>
> When the second application is deployed a NameAlreadyBoundException is
> thrown because the DataSource was already bound from the first application
> deployment. The binding is done in Assembler.createResource(), line 1540,
> and the resource is bound in the container jndi context, under
> openejb/Resource/<data_source_id>.
>
> Is this a problem with custom DataSources, or I make the configuration of
> the custom DataSources in a wrong way?
>
> Lazar
>