Hi, Thanks for fast response. On 22/09/2014 13:37, "Sergey Beryozkin" <[email protected]> wrote:
>Hi >On 22/09/14 12:40, Duncan Keysell (dkeysell) wrote: >> Hi, >> >> I am having problems migrating from CXF 2.2.12 to 2.6.x and would like >>advice on how best to proceed. My servlet configuration and jaxrs:server >>configuration that was working with 2.2.12 does not work with 2.6.x >> >> I have the following servlet: >> >> <servlet> >> <servlet-name>CXFServlet</servlet-name> >> >><servlet-class>org.apache.cxf.transport.servlet.CXFServlet >> </servlet-class> >> <load-on-startup>1</load-on-startup> >> </servlet> >> <servlet-mapping> >> <servlet-name>CXFServlet</servlet-name> >> <url-pattern>/rs/*</url-pattern> >> <url-pattern>/preference-rest/*</url-pattern> >> </servlet-mapping> >> >> I have the following jaxrs:server config: >> >> <jaxrs:server id="wap2" address="/"> >> <jaxrs:serviceBeans> >> <ref bean="systemDashletRESTImpl"/> >> <ref bean="userPreference"/> >> </jaxrs:serviceBeans> >> <jaxrs:providers> >> <ref bean="jsonProvider6" /> >> <ref bean="i18nWebAppExcMapper" /> >> </jaxrs:providers> >> <jaxrs:extensionMappings> >> <entry key="json" value="application/json"/> >> </jaxrs:extensionMappings> >> >> >> The clients of userPreference call URL containing "/preference-rest/". >> >> The clients of systemDashletRESTImpl call URL containing "/rs/". >> >> I have found that the calls to the systemDashletRESTImpl fail with this >>message: >> >> [2014-09-22 04:31:32,616] [http-bio-443-exec-5] [JAXRSInInterceptor] >>[WARN ] - No root resource matching request path >>/webacs/rs/system-rest/getsysteminfo has been found, Relative Path: >>/webacs/rs/system-rest/getsysteminfo. Please enable FINE/TRACE log level >>for more details. >> >> In debugger I can see the issue is related to: >> >> org.apache.cxf.transport.http.DestinationImpl where the destinations >>field is a Map between URL and AbstractHTTPDestination. Because >>systemDashletRESTImpl and userPreference are both using the address '/' >>what happens is that the value held in the destinations field is that >>for the preferences resource and the systemDashletRESTImpl resource >>entry gets overwritten. >> >> Is this a regression in CXF? This configuration all works in CXF 2.2.12. >> > >Do you mean that the issue occurs when a request with URI containing a >'/preference-rest/' is issued first, followed by a request with URI >containing '/rs' or the other way around ? > >What happens in CXF up until 3.0.0 is that CXFServlet overrides the >destination addresses by default which has side-effects in cases when >more than one HTTP route into a given endpoint is available. I don't believe the order of the requests matters. I think that its just at startup the destinations field is populated. I might be wrong.. > >> Can you advise on how I can get this working with 2.6.x? Preferably >>without any of the resource URLs changing (as I do not want to change >>the client code) and preferably without any change to the resource code. >>Is there something I can do in CXF configuration to get this working >>again? E.g. Implement resource comparator? >> >Adding a "disable-address-updates" servlet init parameter with a value >true will fix it. > >By the way, CXF 2.6.x has reached the end of life, perhaps you should >consider migrating to CXF 2.7.x at least. This worked. Thanks for your support! Yes I would like to move to 2.7.x but I'm working on a big platform with many contributors so its not easy.. Thanks again. Duncan > >HTH, Sergey >> >> Thanks >> Duncan >> > > >-- >Sergey Beryozkin > >Talend Community Coders >http://coders.talend.com/ > >Blog: http://sberyozkin.blogspot.com
