[
https://issues.apache.org/jira/browse/DOSGI-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15797869#comment-15797869
]
Christian Schneider edited comment on DOSGI-252 at 1/4/17 10:21 AM:
--------------------------------------------------------------------
The first approach of just using the context most likely will not work. You
always should use a org.apache.cxf.rs.address. Context should only be used if
you want to specifically configure the http service for the context.
The second approach should work. I am currently testing to see if I can
reproduce on master. The error you see could happen if both services use the
same cxf bus. As a new CXF bus is created per service it should not happen.
Have you tried to just give the address and leave out the context?
org.apache.cxf.rs.address=/service1/v1
org.apache.cxf.rs.address=/service2/v1
Is the problem that CXF then uses the servlet on /cxf ?
was (Author: [email protected]):
The first approach of just using the context most likely will not work. You
always should use a org.apache.cxf.rs.address. Context should only be used if
you want to specifically configure the http service for the context.
The second approach should work. I am currently testing to see if I can
reproduce on master. The error you see could happen if both services use the
same cxf bus. As a new CXF bus is created per service it should not happen.
> Unable to export RS services with same addresses and different contexts
> -----------------------------------------------------------------------
>
> Key: DOSGI-252
> URL: https://issues.apache.org/jira/browse/DOSGI-252
> Project: CXF Distributed OSGi
> Issue Type: Bug
> Affects Versions: 2.0.0
> Reporter: Dmytro Pishchukhin
> Assignee: Christian Schneider
>
> I've tried to export RS services with such urls:
> {noformat}
> http://<default_host>:<default_port>/service1/v1
> http://<default_host>:<default_port>/service2/v1
> {noformat}
> if I use only
> {noformat}
> org.apache.cxf.rs.httpservice.context=/service1/v1
> org.apache.cxf.rs.httpservice.context=/service2/v1
> {noformat}
> I receive an exception
> {noformat}
> org.apache.cxf.service.factory.ServiceConstructionException
> at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)
> ...
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException: There
> is an endpoint already running on /.
> at
> org.apache.cxf.jaxrs.JAXRSBindingFactory.addListener(JAXRSBindingFactory.java:85)
> {noformat}
> If I use
> {noformat}
> org.apache.cxf.rs.httpservice.context=/service1
> org.apache.cxf.rs.address=/v1
> org.apache.cxf.rs.httpservice.context=/service2
> org.apache.cxf.rs.address=/v1
> {noformat}
> I receive another exception
> {noformat}
> org.apache.cxf.service.factory.ServiceConstructionException
> at
> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)
> ...
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException: There
> is an endpoint already running on /v1.
> at
> org.apache.cxf.jaxrs.JAXRSBindingFactory.addListener(JAXRSBindingFactory.java:85)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)