cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-7409) ServiceConstructionException when adding JAX-RS application ruins existing applications
Date Wed, 09 Aug 2017 10:51:00 GMT

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

Sergey Beryozkin commented on CXF-7409:
---------------------------------------

Hi, I tried to reproduce it awhile back and just retried this morning, but could not, FYI
I updated locally a systests/jaxrs BookServer class which is used by JAXRSClientServerBookTest
and where a single Jetty endpoint at "http://localhost:PORT/" is created and added one more
endpoint at the same address, creating the 2nd endpoint indeed causes the exception (which
is ignored in BookServer) but the test passes:
{noformat}
Running org.apache.cxf.systest.jaxrs.JAXRSClientServerBookTest
org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:225)
	at org.apache.cxf.systest.jaxrs.BookServer.run(BookServer.java:159)
	at org.apache.cxf.testutil.common.AbstractTestServerBase.startInProcess(AbstractTestServerBase.java:46)
	at org.apache.cxf.testutil.common.ServerLauncher.launchServer(ServerLauncher.java:196)
	at org.apache.cxf.testutil.common.AbstractClientServerTestBase.launchServer(AbstractClientServerTestBase.java:90)
	at org.apache.cxf.systest.jaxrs.JAXRSClientServerBookTest.startServers(JAXRSClientServerBookTest.java:94)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	...
       at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: There is an endpoint
already running on http://localhost:34501/.
	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:212)
	... 22 more

Tests run: 218, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 34.063 sec - in org.apache.cxf.systest.jaxrs.JAXRSClientServerBookTest

{noformat}

I also tried creating the two endpoints at a more specific path, at "http://localhost:PORT/a",
and it also worked...
I guess in your case some different code path is used, can you consider providing a test,
copy JAXRSClientServerBookTest, remove all of unit tests but one of your choice, and copy
BookStore and try to reproduce it ?

By the way, do you create two Applications at the same ApplicationPath say "/test-application"
? I vaguely recall that when you have ApplicationPath, in a no web.xml case, this ApplicationPath
should become a new servlet's URL pattern, "/test-application/*" 


> 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)

Mime
View raw message