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

2022-05-17 Thread Jira


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

Carlos Sierra Andrés commented on CXF-7409:
---

hey [~antelope424], 

I am sorry but I am not a CXF maintainer and this issue seems to be 5 years old 
and I don't remember about it, to be honest. Looking at the messages it looks 
like we worked around the issue so I can't tell you much more than to have a 
look at the apache aries jaxrs whiteboard implementation, which was the project 
we were building using CXF. 

I am sorry I can't help you more. 
Carlos.

> 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 Andrés
>Priority: Major
>
> 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
(v8.20.7#820007)


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

2022-05-17 Thread Rob Li (Jira)


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

Rob Li commented on CXF-7409:
-

Hi [~csierra] 

I met the same issue migrating from 2.x to 3.x, could you please give me some 
pointers on how you work around this by "using a custom destination Factory to 
detect the conflict before it gets to destroy the server"? 

thanks a lot!

Rob

> 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 Andrés
>Priority: Major
>
> 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
(v8.20.7#820007)


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

2017-08-09 Thread Sergey Beryozkin (JIRA)

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

Sergey Beryozkin commented on CXF-7409:
---

Np, thanks, not a critical issue, I'll try to find some tome later on to play 
with duplicate endpoints on a single servlet.
In meantime if you can make it work the other way then it will probably be 
betterthanks

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


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

2017-08-09 Thread Carlos Sierra (JIRA)

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

Carlos Sierra commented on CXF-7409:


In our case this address is coming from a property on a OSGi service reference. 

We are avoiding it at the moment using a custom destination Factory to detect 
the conflict before it gets to destroy the server. 
To be honest I did not think having several applications per servlet would be a 
problem. Would you suggest we spawn a servlet for each of the applications? If 
you think CXF does not support other way I will refactor and make sure there is 
only one application per servlet (if no other considerations apply)

I will try and find some time to create a test for you. I need to get 
acquainted with your tree. But with you comments I guess you encouraged me to 
change our implementation and completely work around this problem from the 
root.  


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


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

2017-08-09 Thread Sergey Beryozkin (JIRA)

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

Sergey Beryozkin commented on CXF-7409:
---

But can one have multiple Applications per single servlet ? Where is this 
address value coming from ? Do you use ApplicationPath annotation at all ?

Note I agree the issue is still there at the CXF level, but I wonder if it is 
avoidable in your case.

Please also consider creating a test for me if you'd like me to look more into 
it, thanks

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


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

2017-08-09 Thread Carlos Sierra (JIRA)

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

Carlos Sierra commented on CXF-7409:


you mean the ApplicationPath annotation? 
we are not using in this case, we are setting the address in:

{code}
jaxRsServerFactoryBean.setAddress(address);
{code}


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


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

2017-08-09 Thread Sergey Beryozkin (JIRA)

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

Sergey Beryozkin commented on CXF-7409:
---

Well may be in the servlet case it goes via a different path, but I'm actually 
becoming convinced now that it is the wrong use of ApplicationPath. Do you use 
ApplicationPath as an endpoint address instead of the CXF servlet URL pattern ? 
If yes it is def non-compliant. 

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


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

2017-08-09 Thread Carlos Sierra (JIRA)

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

Carlos Sierra commented on CXF-7409:


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)


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

2017-08-09 Thread Sergey Beryozkin (JIRA)

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


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

2017-06-15 Thread Carlos Sierra (JIRA)

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

Carlos Sierra commented on CXF-7409:


On an deeper issue it looks like the culprit is the 
{code:java}
getDestination().shutdown();
{code}

it seems that the destination is shared between the server that have the same 
endpoint address.

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