[jira] [Comment Edited] (CXF-7409) ServiceConstructionException when adding JAX-RS application ruins existing applications

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jira] [Comment Edited] (CXF-7409) ServiceConstructionException when adding JAX-RS application ruins existing applications

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/CXF-7409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16119758#comment-16119758 ]

Carlos Sierra edited comment on CXF-7409 at 8/9/17 11:52 AM:
-------------------------------------------------------------

hey [~sergeyb],

thanks for looking into this. I have rechecked and this is still happening in our case, even in 3.1.12.

I have looked at JAXRSClientServerBookTest and we are bootstrapping CXF using CXFNonSpringServlet:
{code:java}
CXFNonSpringServlet cxfNonSpringServlet = new CXFNonSpringServlet();
        cxfNonSpringServlet.setBus(_bus);
{code}

I can see in your test that it is using SpringBusFactory. Could that be responsible for the different behavior?

I know that this might not be orthodox but I could point you to a branch in our project with the failing test and the way we worked it around. Would that be useful for you? I can see in my debug that the culprit is:
{code:java}
getDestination().shutdown()
{code}

because the same destination is shared between all the servers that are created for the same address, thus effectively destroying the destination when the second and conflicting server is shutdown.




was (Author: csierra):
hey [~sergeyb],

thanks for looking into this. I have rechecked and this is still happening in our case, even in 3.1.12.

I have looked at JAXRSClientServerBookTest and we are bootstrapping CXF using CXFNonSpringServlet:
{code:java}
CXFNonSpringServlet cxfNonSpringServlet = new CXFNonSpringServlet();
        cxfNonSpringServlet.setBus(_bus);
{code}

I can see in your test that it is using SpringBusFactory. Could that be responsible for the different behavior?

I know that this might not be orthodox but I could point you to a branch in our project with the failing test and the way we worked it around. Would that be useful for you? I can see in my debug that the culprit is:
{code:java}
getDestination().shutdown()
{code}

because the same destination is shared between all the servers that are created for the same address, thus effectively destroying the destination when the second and conflicting server is created.



> ServiceConstructionException when adding JAX-RS application ruins existing applications
> ---------------------------------------------------------------------------------------
>
>                 Key: CXF-7409
>                 URL: https://issues.apache.org/jira/browse/CXF-7409
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.10
>            Reporter: Carlos Sierra
>
> if a new application conflicts with
> an existing one, an Exception:
> ---
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
> There is an endpoint already running on /test-application.
>       at
> org.apache.cxf.jaxrs.JAXRSBindingFactory.addListener(JAXRSBindingFactory.java:86)
>       at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:123)
>       at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:206)
> ---
> is raised, which is expected. The problem is that the already existing
> application ceases to work in the bus.
> Following [~sergeyb]'s advice I tried removing
> {code:java}
> server.destroy()
> {code}
> from the
> {code:java}
> catch(RuntimeException e) {}
> {code}
> block in JAXRSServerFactoryBean's create method. However there is a comment saying that that invocation is there to prevent leaks. Also, invocations to server.destroy() in other moments don't affect other existing applications in the bus.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Loading...