-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NamespaceException thrown with OSGi application when using Karaf 4.2 #12396
Comments
This exception doesn't look like it's related to the cores ResourceContribution but more like double registration of the theme. Could it be that there's some other bundle that registers that same theme path? The missing bootstrapJS-problem is AFAIK related to changes in 8.9.0. The integration tests for karaf are not executed and clearly show this same problem. |
That is a possiblity, I have not been able to hunt down deep enough into code to verify that. If you have some ideas I am more than happy to hear them.
There was some fixes made for version 8.9.0 regarding OSGi use in context of Liferay, and regression is due that is a possibility. There seem to be much less Karaf users than Liferay users, hence we have not received vocal feedback about this or tickets filed.
Yes, we have been working on to fix the tests, but that task has been not completed yet. (This ticket was filed as collateral of that process) |
Either there's a duplicate Resource-registration in that bundle or some other bundle registers that same path. The changes in 8.9.0 make the ServletContext from vaadin-shared as the default-context, so any resource registered without specific context will be mapped to it. That is what I've observed. So possibly test with a clean karaf with just http-whiteboard and that bundle installed, and check that bundle for duplicate paths.
At my work we have an app running with Karaf 4.2.x and Vaadin 8.8.6, since the versions above that fail. We've just never had time to confirm where the problem is, hence no ticket, thought it has been discussed with our dev contact. |
I found a way to reproduce your exception. Running this on a clean karaf (started with bin/karaf clean), you'll end up with the same exception
Just check that you have the other 2 bundles from that demo available. The echos show that the ResourceServlet for the theme is still registered after the demo-bundle providing it is uninstalled, so the next install causes the NamespaceException. Tracing that lead to pax-web-runtime/AbstractTracker#removedService(ref,element). Seems that when the context is shared, the services/elements are not removed. |
I think the missing vaadinBootstrap.js is not caused by this, since it can be observed by running the test setup from test/servlet-containers/karaf/karaf-run/pom.xml and then browsing to the url in the test/servlet-containers/karaf/karaf-run/src/test/java/com/vaadin/test/osgi/KarafIntegrationIT.java tests. |
Yes, this rather peculiar. My understanding is the Theme is registered by VaadinResourceTrackerComponent And there is checking if the resource is already registered, it wont be done again framework/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java Line 266 in 2d30ee9
|
One potential caveat is that metainfo in this annotation is not 100% correct. Should it be ReferenceCardinality.OPTIONAL instead of ReferenceCardinality.MULTIPLE ? |
MULTIPLE is valid there if you want to allow multiple themes to be registered, MULTIPLE is 0..n, OPTIONAL is just 0..1. To me it seems that the problem with the namespace is related to ops4j/org.ops4j.pax.web#1603 when using Karaf with pax-web. |
This exception is logged and when one tries to access the application there is an error shown in browser
"Failed to load the bootstrap javascript: /vaadin-8.13.3/VAADIN/vaadinBootstrap.js?v=8.13.3"
It looks like that exception is thrown before https://github.com/vaadin/framework/blob/master/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java is applied, thus bootstrap loading fails.
Used Karaf 4.2.11, Vaadin 8.13.3
The text was updated successfully, but these errors were encountered: