You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Sandeep Ambule <sa...@gmail.com> on 2021/12/30 13:12:27 UTC

Apache Felix OSGI servlet bridge failing after 3.3.5 version upgrade

Hi Team,

I have upgraded CXF version in our working application from 3.3.4 to 3.3.5
but after upgrading not able to access any URL.

we have OsgiCxfNonSpringJaxrsServlet which extends CXFNonSpringJaxrsServlet
and override below method

protected void createServerFromApplication(String cName, ServletConfig
servletConfig) throws ServletException {


JAXRSServerFactoryBean bean =
ResourceUtils.createApplication(odataApplication,
MessageUtils.isTrue(ignoreParam),
getStaticSubResolutionValue(servletConfig), false,null);


String splitChar = getParameterSplitChar(servletConfig);
setAllInterceptors(bean, servletConfig, splitChar);
setInvoker(bean, servletConfig);
setExtensions(bean, servletConfig);
setDocLocation(bean, servletConfig);
setSchemasLocations(bean, servletConfig);

bean.setBus(getBus());

bean.create();
}


in 3.3.4 it was working fine but in 3.3.5 servlet init failed and giving
below error
used by: org.apache.felix.log.LogException:
org.apache.cxf.service.factory.ServiceConstructionException: There is an
endpoint already running on /.


solved above issue by providing diffrent address like below
bean.setAddress(address);

Not all the servlet showing registered but not able to access any of the
URL getting 404

Please find proxy servlet snippet from web.xml

<listener>

<listener-class>org.apache.felix.http.proxy.ProxyListener</listener-class>
    </listener>

    <filter>
<filter-name>WebConsoleFilter</filter-name>
<filter-class>com.sap.banking.web.console.filter.WebConsoleFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>WebConsoleFilter</filter-name>
<url-pattern>/system/console/*</url-pattern>
<url-pattern>/system/console</url-pattern>
</filter-mapping>

    <servlet>
        <servlet-name>proxy</servlet-name>

<servlet-class>org.apache.felix.http.proxy.ProxyServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>proxy</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>


application is working fine with cxf 3.3.4 but in 3.3.5 it's breaking, is
there any changes related to proxy servlet or whiteboarding in 3.3.5?

also observed org.apache.cxf.transport.servlet.CXFNonSpringServlet with
path '/cxf' get registred by default in  Servlet Context
'org.osgi.service.http' Registered Servlet Services
which might causing this issue.

Please help me with this upgrade.


Thanks & Regards,
Sandeep Ambule

Re: Apache Felix OSGI servlet bridge failing after 3.3.5 version upgrade

Posted by Andriy Redko <dr...@gmail.com>.
Hi Sandeep,

There were minor changes in the CXFNonSpringJaxrsServlet (between 3.3.4 and 3.3.5) to use 
provided DestinationRegistry but it seems like it should not trigger in your particular 
case. Could you please share a reproducer for the problem? Also, it is not clear how the 
deployment environment (container(s) / version(s)) looks like, thank you.

Best Regards,
    Andriy Redko

SA> Hi Team,

SA> I have upgraded CXF version in our working application from 3.3.4 to 3.3.5
SA> but after upgrading not able to access any URL.

SA> we have OsgiCxfNonSpringJaxrsServlet which extends CXFNonSpringJaxrsServlet
SA> and override below method

SA> protected void createServerFromApplication(String cName, ServletConfig
SA> servletConfig) throws ServletException {


SA> JAXRSServerFactoryBean bean =
SA> ResourceUtils.createApplication(odataApplication,
SA> MessageUtils.isTrue(ignoreParam),
SA> getStaticSubResolutionValue(servletConfig), false,null);


SA> String splitChar = getParameterSplitChar(servletConfig);
SA> setAllInterceptors(bean, servletConfig, splitChar);
SA> setInvoker(bean, servletConfig);
SA> setExtensions(bean, servletConfig);
SA> setDocLocation(bean, servletConfig);
SA> setSchemasLocations(bean, servletConfig);

SA> bean.setBus(getBus());

SA> bean.create();
SA> }


SA> in 3.3.4 it was working fine but in 3.3.5 servlet init failed and giving
SA> below error
SA> used by: org.apache.felix.log.LogException:
SA> org.apache.cxf.service.factory.ServiceConstructionException: There is an
SA> endpoint already running on /.


SA> solved above issue by providing diffrent address like below
SA> bean.setAddress(address);

SA> Not all the servlet showing registered but not able to access any of the
SA> URL getting 404

SA> Please find proxy servlet snippet from web.xml

SA> <listener>

SA> <listener-class>org.apache.felix.http.proxy.ProxyListener</listener-class>
SA>     </listener>

SA>     <filter>
SA> <filter-name>WebConsoleFilter</filter-name>
SA> <filter-class>com.sap.banking.web.console.filter.WebConsoleFilter</filter-class>
SA> </filter>

SA> <filter-mapping>
SA> <filter-name>WebConsoleFilter</filter-name>
SA> <url-pattern>/system/console/*</url-pattern>
SA> <url-pattern>/system/console</url-pattern>
SA> </filter-mapping>

SA>     <servlet>
SA>         <servlet-name>proxy</servlet-name>

SA> <servlet-class>org.apache.felix.http.proxy.ProxyServlet</servlet-class>
SA>         <load-on-startup>1</load-on-startup>
SA>     </servlet>

SA>     <servlet-mapping>
SA>         <servlet-name>proxy</servlet-name>
SA>         <url-pattern>/*</url-pattern>
SA>     </servlet-mapping>


SA> application is working fine with cxf 3.3.4 but in 3.3.5 it's breaking, is
SA> there any changes related to proxy servlet or whiteboarding in 3.3.5?

SA> also observed org.apache.cxf.transport.servlet.CXFNonSpringServlet with
SA> path '/cxf' get registred by default in  Servlet Context
SA> 'org.osgi.service.http' Registered Servlet Services
SA> which might causing this issue.

SA> Please help me with this upgrade.


SA> Thanks & Regards,
SA> Sandeep Ambule