Skip to content

Conversation

jbonofre
Copy link
Member

This PR adds the camel-servlet-osgi "attached" to the camel-servlet component allowing to hook in the OSGi HttpService.

As Apache Karaf 4.4.x/Pax Web 8.0.x and OSGi HttpService only supports jakarta.servlet-api 4.x for now, this PR also fixes the camel-karaf modules that must be changed to use this servlet-api version (camel-servlet, camel-http-com).

As atmosphere requires jakarta.servlet-api 6 and camel-servlet, it can't work for now, so this PR excludes it from the features repository.

This PR is required as Apache Karaf 4.4.x, we will be able to clean this up when Apache Karaf 4.5.x will be available (as it will use new Pax Web version support servlet-api 6.x).

…rta.servlet-api 6+

as Karaf 4.4.x/Pax Web 8.0.x and OSGi HttpService support jakarta.servlet-api 4 for now
@jbonofre jbonofre linked an issue Dec 17, 2024 that may be closed by this pull request
@essobedo
Copy link
Contributor

It seems to have an impact on the camel-cxf integration test as camel-http-common is a dependency of camel-cxf-transport which is part of camel-cxf-all.

In the log of the build, I can see:

2024-12-17T17:49:09.8162474Z Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest not found by camel-http-common [202]
2024-12-17T17:49:09.8163371Z 	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591) ~[?:?]
2024-12-17T17:49:09.8164082Z 	at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79) ~[?:?]
2024-12-17T17:49:09.8164739Z 	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976) ~[?:?]
2024-12-17T17:49:09.8165305Z 	at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
2024-12-17T17:49:09.8165871Z 	at org.apache.camel.http.common.HttpConverterLoader.registerConverters(HttpConverterLoader.java:49) ~[?:?]
2024-12-17T17:49:09.8166546Z 	at org.apache.camel.http.common.HttpConverterLoader.load(HttpConverterLoader.java:43) ~[?:?]
2024-12-17T17:49:09.8167164Z 	at org.apache.camel.karaf.core.Activator$BundleTypeConverterLoader.load(Activator.java:467) ~[?:?]
2024-12-17T17:49:09.8167806Z 	at org.apache.camel.karaf.core.OsgiTypeConverter.addingService(OsgiTypeConverter.java:77) ~[?:?]

Since javax.servlet is an optional import camel-http-common, I guess that adding the installation of the corresponding bundle in this method https://github.com/apache/camel-karaf/blob/main/tests/features/camel-cxf/src/test/java/org/apache/karaf/camel/itest/CamelCxfITest.java#L104 should do the trick

@jbonofre
Copy link
Member Author

Yes I saw that. I'm fixing. We have to deal with different servlet namespaces to work in Karaf

@essobedo
Copy link
Contributor

Great 👍

Do you mind adding an integration test in blueprint using the rest DSL to ensure that everything works as expected?

@jbonofre
Copy link
Member Author

Actually, I think we should use a different approach: not using the OSGi HttpService nor Pax Web.
Instead, we can embed a Jetty server in camel-servlet (as we do in camel-cxf) and hook there. We would not depend to HttpService (a specific camel-karaf service instead), the user experience should be the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-add OsgiServletRegisterer

2 participants