docs
docs copied to clipboard
It is not obvious from the documentation that FixedVaadinServlet name cannot be changed.
If trying to change the name "FixedVaadinServlet" to anything else (in https://github.com/vaadin/base-starter-flow-karaf), push fails to load. There are the following errors in the browser's console:
Uncaught SyntaxError: Unexpected token '<'
...
vaadin-5-1ca1eb43b4ae79ad0352.cache.js:1 http://localhost:8181/VAADIN/static/push/vaadinPush.js could not be loaded. Push will not work.
...
How to fix: mention in the Apache Karaf documentation (https://vaadin.com/docs/latest/flow/integrations/osgi/#osgi.servlet) that the FixedVaadinServlet's name should not be changed.
Are we certain that this is not a bug in our Karaf implementation?
We could document it as a feature until we know better. If it turns out to be a bug, we can update the docs to point to the issue.
I think we'd be better off confirming that it's not a bug before documenting it.
Who knows about our Karaf integration? @mshabarov perhaps? Is this a bug?
It seems like some kind of bug in the OSGi add-on or in the starter. Servlet rename worked for me on several attempts, but seldom I got an exception during startup and the push script was not loaded, even with the original servlet name.
The error is a class cast with a lambda exception.
Caused by: java.lang.ClassCastException: Cannot cast com.vaadin.flow.osgi.support.OSGiVaadinInitialization$$Lambda$1098/0x00000008014487c8 to com.vaadin.flow.internal.VaadinContextInitializer
at java.lang.Class.cast(Class.java:3889) ~[?:?]
at com.vaadin.flow.server.VaadinServletContext.getAttribute(VaadinServletContext.java:76) ~[?:?]
at com.vaadin.flow.server.VaadinContext.getAttribute(VaadinContext.java:58) ~[?:?]
at com.vaadin.flow.server.VaadinServlet.initializeContext(VaadinServlet.java:614) ~[?:?]
at com.vaadin.flow.server.VaadinServlet.init(VaadinServlet.java:110) ~[?:?]
at com.vaadin.flow.osgi.support.servlet.OSGiVaadinServlet.init(OSGiVaadinServlet.java:76) ~[?:?]
at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.init(OsgiInitializedServlet.java:68) ~[?:?]
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:632) ~[?:?]
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:486) ~[?:?]
at org.eclipse.jetty.servlet.ServletHolder.prepare(ServletHolder.java:759) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHolder.prepare(PaxWebServletHolder.java:295) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:306) ~[?:?]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[?:?]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[?:?]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[?:?]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[?:?]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[?:?]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[?:?]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[?:?]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[?:?]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) ~[?:?]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[?:?]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[?:?]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[?:?]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[?:?]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191) ~[?:?]
at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96) ~[?:?]
Another issue seems to be that if you rename the servlet and do not clean the project mvn clean
, the old servlet service descriptor will still be in the jar file, and this prevents the bundle to be loaded correctly