You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Evangelina <ev...@gmail.com> on 2011/11/08 20:28:05 UTC

Problem migrating from 2.3.1 to 2.5.0

Hi, 

I'm having a few issues trying to migrate CXF from 2.3.1 version to 2.5.0.
The main issue is with the Client that I'm creating using the
ClientProxyFactoryBean. 

I'm creating my client like this:

ClientProxy.getClient(cpf.create())

where cpf is the instance of ClientProxyFactoryBean, and then in my
application I use the client that I get from that invocation. 

After migrating to 2.5.0 I'm running into NullPointerException because the
client is being destroyed when the method finalize is called on the
ClientProxy instance. I haven't had this issue before, because in 2.3.1 the
method finalize is not implemented in the ClientProxy class. 

Is this a bug or working as expected? And if so, is there any way the client
can outlive the clientProxy? since that instance is created inside the
getClient static method, I cannot get hold of it. 

Thanks in advance for the help, 
Eva

--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp4975395p4975395.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Problem migrating from 2.3.1 to 2.5.0

Posted by Evangelina <ev...@gmail.com>.
Thanks Dan for clarifying it, I will avoid using the ClientProxy then if what
I need is to get the Client.

Thanks again, 
Eva

--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp4975395p4985186.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Problem migrating from 2.3.1 to 2.5.0

Posted by Daniel Kulp <dk...@apache.org>.
On Friday, November 11, 2011 10:20:41 AM Evangelina wrote:
> Hi Dan,
> 
> Thanks for the answer, I was getting the client from the proxy and setting
> it in a new object to use later, and kept loosing it because of the
> ClientProxy's finalize. Maybe this should be documented somewhere, I used it
> this way in version 2.3.1 without a problem.

Which was actually a bug.   This ended up causing locked resources and such.


> 
> You say that if I want the client I should use the ClientFactoryBean instead
> of the ClientProxyFactoryBean.. but what's the difference between them?
> Don't they have a different purpose?
> 

Fundamentally, a proxy in CXF is just a wrapper around a Client.   However, 
the Clients can be used for other things.   For example, a Dispatch object 
uses a client.   JAX-RS uses a Client.   Etc....    The ClientFactoryBean is 
what is used to create the client.  (and the ClientProxyFactoryBean creates 
and uses a ClientFactoryBean internally for that purpose).    The 
ClientProxyFactoryBean then handles wrapping that client object with the 
Proxy.    If you don't need or plan to use the proxy, just create the Client.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: Problem migrating from 2.3.1 to 2.5.0

Posted by Evangelina <ev...@gmail.com>.
Hi Dan, 

Thanks for the answer, I was getting the client from the proxy and setting
it in a new object to use later, and kept loosing it because of the
ClientProxy's finalize. Maybe this should be documented somewhere, I used it
this way in version 2.3.1 without a problem. 

You say that if I want the client I should use the ClientFactoryBean instead
of the ClientProxyFactoryBean.. but what's the difference between them?
Don't they have a different purpose?

Thanks in advance, 
EVa

--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp4975395p4985162.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Problem migrating from 2.3.1 to 2.5.0

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday, November 08, 2011 6:48:45 PM Evangelina wrote:
> Well yes, the thing is that I'm still using the client instance when the
> ClientProxy is gc, which destroys the state of client.

That Client object is definitely tied to the lifecycle of the proxy.   That is 
per design.     If you are only interested in the Client object, you should 
likely use the JaxWsClientFactoryBean (or ClientFactoryBean) and not the 
factories that create the proxy.

Dan


> 
> 
> On Tue, Nov 8, 2011 at 11:30 PM, Jeff Wang-2 [via CXF] <
> 
> ml-node+s547215n4976473h9@n5.nabble.com> wrote:
> > This should be expected, right?  The client represents an active
> > connection (the conduit.) Shouldn't you be calling
> > ClientProxy.getClient(...) again when you need a new client?
> > 
> > Jeff
> > 
> > On Tue, Nov 8, 2011 at 11:28 AM, Evangelina <[hidden
> > email]<http://user/SendEmail.jtp?type=node&node=4976473&i=0>>> 
> > wrote:
> > > Hi,
> > > 
> > > I'm having a few issues trying to migrate CXF from 2.3.1 version to
> > 
> > 2.5.0.
> > 
> > > The main issue is with the Client that I'm creating using the
> > > ClientProxyFactoryBean.
> > > 
> > > I'm creating my client like this:
> > > 
> > > ClientProxy.getClient(cpf.create())
> > > 
> > > where cpf is the instance of ClientProxyFactoryBean, and then in my
> > > application I use the client that I get from that invocation.
> > > 
> > > After migrating to 2.5.0 I'm running into NullPointerException
> > > because
> > 
> > the
> > 
> > > client is being destroyed when the method finalize is called on the
> > > ClientProxy instance. I haven't had this issue before, because in
> > > 2.3.1
> > 
> > the
> > 
> > > method finalize is not implemented in the ClientProxy class.
> > > 
> > > Is this a bug or working as expected? And if so, is there any way
> > > the
> > 
> > client
> > 
> > > can outlive the clientProxy? since that instance is created inside
> > > the
> > > getClient static method, I cannot get hold of it.
> > > 
> > > Thanks in advance for the help,
> > > Eva
> > > 
> > > --
> > 
> > > View this message in context:
> > http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp
> > 4975395p4975395.html> 
> > > Sent from the cxf-user mailing list archive at Nabble.com.
> > 
> > ------------------------------
> > 
> >  If you reply to this email, your message will be added to the
> >  discussion
> > 
> > below:
> > 
> > http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp
> > 4975395p4976473.html> 
> >  To unsubscribe from Problem migrating from 2.3.1 to 2.5.0, click
> >  here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=u
> >  nsubscribe_by_code&node=4975395&code=ZXZhbmdlbGluYW1ybUBnbWFpbC5jb218N
> >  Dk3NTM5NXwzMDY0Njk3NDM=>> 
> > .
> > See how NAML generates this
> > email<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=ma
> > cro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namesp
> > aces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view
> > .web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3
> > Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21na
> > bble%3Aemail.naml>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp497
> 5395p4976515.html Sent from the cxf-user mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: Problem migrating from 2.3.1 to 2.5.0

Posted by Evangelina <ev...@gmail.com>.
Well yes, the thing is that I'm still using the client instance when the
ClientProxy is gc, which destroys the state of client.


On Tue, Nov 8, 2011 at 11:30 PM, Jeff Wang-2 [via CXF] <
ml-node+s547215n4976473h9@n5.nabble.com> wrote:

> This should be expected, right?  The client represents an active
> connection (the conduit.) Shouldn't you be calling
> ClientProxy.getClient(...) again when you need a new client?
>
> Jeff
>
> On Tue, Nov 8, 2011 at 11:28 AM, Evangelina <[hidden email]<http://user/SendEmail.jtp?type=node&node=4976473&i=0>>
> wrote:
>
> > Hi,
> >
> > I'm having a few issues trying to migrate CXF from 2.3.1 version to
> 2.5.0.
> > The main issue is with the Client that I'm creating using the
> > ClientProxyFactoryBean.
> >
> > I'm creating my client like this:
> >
> > ClientProxy.getClient(cpf.create())
> >
> > where cpf is the instance of ClientProxyFactoryBean, and then in my
> > application I use the client that I get from that invocation.
> >
> > After migrating to 2.5.0 I'm running into NullPointerException because
> the
> > client is being destroyed when the method finalize is called on the
> > ClientProxy instance. I haven't had this issue before, because in 2.3.1
> the
> > method finalize is not implemented in the ClientProxy class.
> >
> > Is this a bug or working as expected? And if so, is there any way the
> client
> > can outlive the clientProxy? since that instance is created inside the
> > getClient static method, I cannot get hold of it.
> >
> > Thanks in advance for the help,
> > Eva
> >
> > --
> > View this message in context:
> http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp4975395p4975395.html
> > Sent from the cxf-user mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp4975395p4976473.html
>  To unsubscribe from Problem migrating from 2.3.1 to 2.5.0, click here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4975395&code=ZXZhbmdlbGluYW1ybUBnbWFpbC5jb218NDk3NTM5NXwzMDY0Njk3NDM=>
> .
> See how NAML generates this email<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp4975395p4976515.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Problem migrating from 2.3.1 to 2.5.0

Posted by Jeff Wang <je...@plutom.com>.
This should be expected, right?  The client represents an active
connection (the conduit.) Shouldn't you be calling
ClientProxy.getClient(...) again when you need a new client?

Jeff

On Tue, Nov 8, 2011 at 11:28 AM, Evangelina <ev...@gmail.com> wrote:
> Hi,
>
> I'm having a few issues trying to migrate CXF from 2.3.1 version to 2.5.0.
> The main issue is with the Client that I'm creating using the
> ClientProxyFactoryBean.
>
> I'm creating my client like this:
>
> ClientProxy.getClient(cpf.create())
>
> where cpf is the instance of ClientProxyFactoryBean, and then in my
> application I use the client that I get from that invocation.
>
> After migrating to 2.5.0 I'm running into NullPointerException because the
> client is being destroyed when the method finalize is called on the
> ClientProxy instance. I haven't had this issue before, because in 2.3.1 the
> method finalize is not implemented in the ClientProxy class.
>
> Is this a bug or working as expected? And if so, is there any way the client
> can outlive the clientProxy? since that instance is created inside the
> getClient static method, I cannot get hold of it.
>
> Thanks in advance for the help,
> Eva
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Problem-migrating-from-2-3-1-to-2-5-0-tp4975395p4975395.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>