You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Lazar Kirchev <la...@gmail.com> on 2012/04/06 17:26:43 UTC

A resource deployed with an application does not get cleared from naming during undeploy

Hello,

I deploy an application with a data source, described in a resources.xml.
It gets deployed correctly and works fine, but during undeploy the data
source does not get removed from naming. If the application is deployed for
a second time, a NameAlreadyBoundException is thrown. Is this an expected
behavior?

Regards,
Lazar

Re: A resource deployed with an application does not get cleared from naming during undeploy

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

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4539327.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by lazarkirchev <la...@gmail.com>.
OK, I am now using a service-jar.xml and resources.xml, both local in the app
archive, so I have a custom service provider, which is local for the
application. 

When the application is deployed and the service-jar.xml is parsed, the new
service provider is added to ServiceUtil, and through its static methods is
available also to other applications, if they know the provider id. Is this
the expected behavior?

Also, when the resource described in the resources.xml is handled - which is
at deploy time - an object for it is created and bound in the container
context. I guess you meant to achieve lazy resource creation by making the
custom service provider create and return an object factory, which to be
bound in the container context, instead of creating and binding the real
resource object?

Finally, there is no way to avoid the binding in the container (global)
context, is this correct?

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4573755.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
using a custom service provider you can
1) easily create your resource lazily
2) easily manage only some application (identified by the classloader for
instance) even if it is still deployed at container level

well the service provider hook is a really powerful way to do what you want.

- Romain


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

> I thought that the custom service providers behave like the built in
> providers - I mean that the factory pointed by the custom provider will be
> used to create a resource object on app deploy and this object will be
> bound
> in the container context and will have container-wide visibility. Is this
> correct? If yes, how proxies can change this behavior?
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4573130.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by lazarkirchev <la...@gmail.com>.
I thought that the custom service providers behave like the built in
providers - I mean that the factory pointed by the custom provider will be
used to create a resource object on app deploy and this object will be bound
in the container context and will have container-wide visibility. Is this
correct? If yes, how proxies can change this behavior?

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4573130.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i don't know about the release date since we currently vote for the 1.0.0
which will not contain it, i hope in one or 2 mounths.

for the feature you talk about you can do it using proxies if you use a
custom service provider (there are some examples on our example page).

- Romain


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

> OK, and when is it expected to be the next release of OpenEJB, which will
> contain this feature?
>
> In relation to this feature - do you think it would be useful to add a
> mechanism, in addition to the current one in resources.xml, which creates a
> RefAddress for a resource, containing also the factory class as a property,
> and being local for the application, which defines it? Something similar to
> Tomcat's context.xml - it only defines the RefAddress, local for the app,
> and does not create the actual resource object from the start, but then the
> resource factory creates it when the resource reference is looked up.
>
> Lazar
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4571068.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by lazarkirchev <la...@gmail.com>.
OK, and when is it expected to be the next release of OpenEJB, which will
contain this feature?

In relation to this feature - do you think it would be useful to add a
mechanism, in addition to the current one in resources.xml, which creates a
RefAddress for a resource, containing also the factory class as a property,
and being local for the application, which defines it? Something similar to
Tomcat's context.xml - it only defines the RefAddress, local for the app,
and does not create the actual resource object from the start, but then the
resource factory creates it when the resource reference is looked up.

Lazar

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4571068.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i think the snapshot is not deployed yet.

- Romain


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

> Thanks! This is already submitted and available in OpenEJB repository?
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4567910.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by lazarkirchev <la...@gmail.com>.
Thanks! This is already submitted and available in OpenEJB repository?

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4567910.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
on trunk the removal works even if the resource is still global (there is a
property ApplicationWide to prevent the removing i think.

- Romain


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

> If the resources deployed with the resources.xml are made local for the
> application and not available container-wide, it would be much easier to
> get
> removed upon undeploy. Is this possible?
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4567114.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by lazarkirchev <la...@gmail.com>.
If the resources deployed with the resources.xml are made local for the
application and not available container-wide, it would be much easier to get
removed upon undeploy. Is this possible? 

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4567114.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i'm currently implementing it ;)

well, sharing resources accross applications can be a nightmare but
sometimes it is what you want. To manage such a case we'll have to find a
configuration trick. Probably a system property or property to prevent the
undeployment.

- Romain


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

> OK, thanks a lot!
> But since the resource deployed through the resources.xml is intended to be
> container-wide available (and not only locally for an application), then is
> it possible that undeploying the resource with the app will break other
> application which also uses it (if there is such app)? Or such a scenario
> is
> unacceptable? Probably that is the reason why currently undeploying the
> resource with the app is not implemented?
>
> Lazar
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564799.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by lazarkirchev <la...@gmail.com>.
OK, thanks a lot! 
But since the resource deployed through the resources.xml is intended to be
container-wide available (and not only locally for an application), then is
it possible that undeploying the resource with the app will break other
application which also uses it (if there is such app)? Or such a scenario is
unacceptable? Probably that is the reason why currently undeploying the
resource with the app is not implemented?

Lazar

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564799.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

resources.xml or openejb.xml or tomee.xml does the same thing. The
difference is the moment when it is done and the classloader used.

- Romain


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

> Hi, one more detail here - what is actually the intention of resources.xml?
> Does it make the container create the actual physical resources for the
> resources described in the xml? Or, does it make the container create
> references in the application for the resources specified in the xml file?
>
> Lazar
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564680.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by lazarkirchev <la...@gmail.com>.
Hi, one more detail here - what is actually the intention of resources.xml?
Does it make the container create the actual physical resources for the
resources described in the xml? Or, does it make the container create
references in the application for the resources specified in the xml file? 

Lazar

--
View this message in context: http://openejb.979440.n4.nabble.com/A-resource-deployed-with-an-application-does-not-get-cleared-from-naming-during-undeploy-tp4537630p4564680.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: A resource deployed with an application does not get cleared from naming during undeploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

I have to check but resources are not undeployed with apps so the behavior
is normal (but i agree we should probably enhance it).

- Romain

Le 6 avr. 2012 17:27, "Lazar Kirchev" <la...@gmail.com> a écrit :

> Hello,
>
> I deploy an application with a data source, described in a resources.xml.
> It gets deployed correctly and works fine, but during undeploy the data
> source does not get removed from naming. If the application is deployed for
> a second time, a NameAlreadyBoundException is thrown. Is this an expected
> behavior?
>
> Regards,
> Lazar
>