Failed to load the bootstrap javascript in 8.1.0 OSGi application

Hi,

I am getting the following error message on accessing the application with the browser:

Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js?v=8.1.0

I am using Karaf 4.0.8 with Vaadin 8.1.0.

http:list output:

ID  | Servlet           | Servlet-Name                    | State       | Alias                                                       | Url
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
680 | ResourceServlet   | DefaultWidgetSet                | Deployed    | /vaadin-8.1.0/VAADIN/widgetsets/com.vaadin.DefaultWidgetSet | 
[/vaadin-8.1.0/VAADIN/widgetsets/com.vaadin.DefaultWidgetSet/*]
692 |                   | Vaadin Osgi Integration Servlet | Deployed    |                                                             | 
[/v8/*]
67  | ResourceServlet   | /res                            | Deployed    | /system/console/res                                         | 
[/system/console/res/*]
692 | JspServletWrapper | jsp                             | Deployed    |                                                             | [*.jsp, *.jspx, *.jspf, *.xsp, *.JSP, *.JSPX, *.JSPF, *.XSP]

692 | V8Servlet         | ServletModel-20                 | Deployed    |                                                             | 
[/v8/*]
71  | InstancePlugin    | ServletModel-9                  | Deployed    | /instance                                                   | 
[/instance/*]
68  | FeaturesPlugin    | ServletModel-13                 | Deployed    | /features                                                   | 
[/features/*]
692 | V8Servlet         | ServletModel-15                 | Undeployed  |                                                             | 
[/v8/*]
69  | GogoPlugin        | ServletModel-2                  | Deployed    | /gogo                                                       | 
[/gogo/*]
692 | ResourceServlet   | default                         | Deployed    | /                                                           | 
[/]
678 | ResourceServlet   | gz                              | Deployed    | /vaadin-8.1.0/VAADIN/vaadinBootstrap.js.gz                  | 
[/vaadin-8.1.0/VAADIN/vaadinBootstrap.js.gz/*]
67  | KarafOsgiManager  | ServletModel-4                  | Deployed    | /system/console                                             | 
[/system/console/*]
678 | ResourceServlet   | js                              | Deployed    | /vaadin-8.1.0/VAADIN/vaadinBootstrap.js                     | 
[/vaadin-8.1.0/VAADIN/vaadinBootstrap.js/*]
681 | ResourceServlet   | /VAADIN/themes/valo             | Deployed    | /vaadin-8.1.0/VAADIN/themes/valo                            | 
[/vaadin-8.1.0/VAADIN/themes/valo/*]

Also the page source says:

[code]

[/code]but the bootstrap javascript is registered at

/vaadin-8.1.0/VAADIN/vaadinBootstrap.js

Also the Atmosphere could not be configured correctly it seems: see https://pastebin.com/v6mQvsjq

Installed bundles:

673 | Active   |  80 | 2.4.11.vaadin1     | atmosphere-runtime                                                | com.vaadin.external.atmosphere.runtime
674 | Active   |  80 | 1.2.0.vaadin1      | GenTyRef                                                          | com.vaadin.external.gentyref
675 | Active   |  80 | 1.6.1              | vaadin-slf4j-jdk14                                                | com.vaadin.external.org.slf4j
676 | Active   |  80 | 8.1.0              | vaadin-client                                                     | com.vaadin.client
677 | Active   |  80 | 8.1.0              | Vaadin OSGi Integration                                           | com.vaadin.osgi.integration
678 | Active   |  80 | 8.1.0              | Vaadin Server                                                     | com.vaadin.server
679 | Active   |  80 | 8.1.0              | Vaadin Shared                                                     | com.vaadin.shared
680 | Active   |  80 | 8.1.0              | Default Widgetset                                                 | com.vaadin.client-compiled
681 | Active   |  80 | 8.1.0              | Vaadin Themes                                                     | com.vaadin.themes

What am I missing?

Best regards

Mihael

It seems that the order of installation is very important and fixed the problem.

Thanx

First I want to say that you guys at Vaadin did a great job with this integration into OSGi. It really simplifies things a lot and this improvement is of equal scale to me as the the new features of Grid in 8.1.0. Keep up the fantastic work.

Generally the order of installing bundles should not matter. But it seems it does in this case.

My order was as stated here https://vaadin.com/vaadin-fw8-documentation-portlet/framework/advanced/advanced-osgi.html :

bundle:install -s mvn:org.jsoup/jsoup/1.8.3 bundle:install -s mvn:com.vaadin.external/gentyref/1.2.0.vaadin1 bundle:install -s mvn:com.vaadin/vaadin-shared/8.1.0 bundle:install -s mvn:com.vaadin/vaadin-server/8.1.0 bundle:install -s mvn:com.vaadin/vaadin-osgi-integration/8.1.0 bundle:install -s mvn:com.vaadin/vaadin-client-compiled/8.1.0 bundle:install -s mvn:com.vaadin/vaadin-themes/8.1.0 I also installed the features http and http-whiteboard before installing the bundles:

feature:install http http-whiteboard But the documentation states it works for Apache Karaf 4.0.8. But the version 4.0.8 of Karaf doesn’t have Declarative Services installed out-of-the-box. So you also need to install this feature:

feature:install scr You don’t have that problem with Apache Karaf 4.1.1 as it has the feature
scr
installed initially.

The documentation doesn’t list the atmosphere bundle to be installed. Is it still needed for server side push?

It installed fine so far with:

bundle:install -s mvn:com.vaadin.external.slf4j/vaadin-slf4j-jdk14/1.6.1
bundle:install -s mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.4.11.vaadin1
bundle:install -s mvn:com.vaadin/vaadin-push/8.1.0

Best regards

Mihael

Hi,

do you mind sharing your working order - in case someone else runs into the same problem?

Best regards,

Olli

And though push generally seems to work (at least in my little example), there are some error messages in the log which let one assume that no everything works as expected: https://pastebin.com/nhftipP1

Especially this seems odd:

2017-08-02T09:02:53,420 | ERROR | Atmosphere-Shared-10 | PushHandler                      | 102 - com.vaadin.server - 8.1.0 | Could not get resource. This should never happen.
2017-08-02T09:02:53,440 | WARN  | qtp1091316422-117 | DefaultBroadcaster               | 106 - com.vaadin.external.org.slf4j - 1.6.1 | Duplicate resource 1cfed68c-2888-441b-bd8c-5c4acd855f99. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

I’m quite in the same situation:
Everything was running fine using Karaf 4.0.9, Vaadin 8.0.9 and Charts 4.0.
As I now switched to Karaf 4.1.2, Vaadin 8.1.3 and Charts 4.0 I’m getting the same errors:

2017-09-12T09:26:02,249 | ERROR | Atmosphere-Shared-4 | PushHandler | 78 - com.vaadin.server - 8.1.3 | Could not get resource. This should never happen. 2017-09-12T09:26:02,280 | WARN | qtp1236621876-2040 | DefaultBroadcaster | 75 - com.vaadin.external.org.slf4j - 1.6.1 | Duplicate resource 7f9494d1-3f99-41e4-a43d-b3e95554404a. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one Push seems to work though…

Dear all,

The above solutions have not fixed our problem…

We’re using Vaadin 8.1.5, with Karaf 4.1.2.
This is the error we’re receiving:

2017-10-17 13:01:26,938 | ERROR | 106 - n.external.org.slf4j | AtmosphereFramework | Failed to initialize Atmosphere Framework java.util.ServiceConfigurationError: org.atmosphere.inject.Injectable: Provider org.atmosphere.inject.AtmosphereConfigInjectable not found (The complete stacktrace: https://pastebin.com/J0JHq9LG)
It’s the same error Mihael Schmidt mentions in his first Pastbin post. By the way, it is the only resource on the Internet with this excact same error…
No matter what I’ve tried, it won’t work.

This is the feature we use:

<feature>http</feature>
<feature>http-whiteboard</feature>
<bundle>mvn:org.jsoup/jsoup/1.10.3</bundle>
<bundle>mvn:com.vaadin.external/gentyref/1.2.0.vaadin1</bundle>
<bundle>mvn:com.vaadin/vaadin-shared/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-server/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-osgi-integration/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-client-compiled/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-themes/8.1.5</bundle>
<bundle>mvn:com.vaadin.external.slf4j/vaadin-slf4j-jdk14/1.6.1</bundle>
<bundle>mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.4.11.vaadin2</bundle>
<bundle>mvn:com.vaadin/vaadin-push/8.1.5</bundle>

Any ideas?
Any missing items?
Do we forget something?

Thanks in advance!

Additionally I have those in my feature:

<bundle>mvn:com.vaadin.external.streamhtmlparser/streamhtmlparser-jsilver/0.0.10.vaadin1</bundle>
<bundle>wrap:mvn:org.w3c.css/sac/1.3</bundle>
<bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>

Furthermore in the UI I’ve set:

@Push(value = PushMode.MANUAL, transport = Transport.LONG_POLLING)

I think that’s not related - but you never know - in the main servlet (I’m using scr):

@Component(
service = VaadinServlet.class,
property = {
"init.org.atmosphere.websocket.suppressJSR356=true",
...
}
)

Thanks for the suggestion, but unfortunately it did not help. We’ve still the same problem.
Your situation is the same? Same Karaf, etc?
In that case We’re probably overlooking something else…

Features.xml

<feature>http</feature>
<feature>http-whiteboard</feature>
<bundle>mvn:org.jsoup/jsoup/1.10.3</bundle>
<bundle>mvn:com.vaadin.external/gentyref/1.2.0.vaadin1</bundle>
<bundle>mvn:com.vaadin/vaadin-shared/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-server/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-osgi-integration/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-client-compiled/8.1.5</bundle>
<bundle>mvn:com.vaadin/vaadin-themes/8.1.5</bundle>
<bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>
<bundle>wrap:mvn:org.w3c.css/sac/1.3</bundle>
<bundle>mvn:com.vaadin.external.slf4j/vaadin-slf4j-jdk14/1.6.1</bundle>
<bundle>mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.4.11.vaadin2</bundle>
<bundle>mvn:com.vaadin/vaadin-push/8.1.5</bundle>

Pom.xml (amongst other dependencies, of course)

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
            <scope>provided</scope>
        </dependency>

Our UI

@Push //Adding some options here doesn't make any changes
public class MyUI extends UI {
...
}

Our Servlet

@Component(service = VaadinServlet.class)
@WebServlet(urlPatterns = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = true, ui = MyUI.class)
public class OsgiVaadinServlet extends VaadinServlet {
...
}

And in our class

void addDataAsync() {
    getLayout().removeAllComponents();
    ProgressBar bar = new ProgressBar();
    bar.setCaption("Loading: " + getMessages().size() + " objects");
    bar.setIndeterminate(true);
    getLayout().addComponent(bar);
    executor.execute(() -> {
        getLayout().removeAllComponents();
        if (getObjects().isEmpty()) {
            getLayout().addComponent(new Label("No data"));
        } else {
            getLayout().addComponent(new Label(getObjects().toString()));
        }
        currentUI.push(); //In main thread this is set with UI.getCurrentUI();
    });
}

Do you see anything we might have missed?
It’s driving us crazy.

Or is there any other way to be able to work asynchronously?

I fixed it for now, by adding “ServiceLoader.load(AtmosphereConfigInjectable.class);” to our BundleActivator.
Now Atmosphere loads correctly and I get the same two errors:

2017-10-24 12:15:47,490 | ERROR | 67   - com.vaadin.server    | PushHandler               | Could not get resource. This should never happen.
2017-10-24 12:15:48,862 | WARN  | 64   - n.external.org.slf4j | DefaultBroadcaster        | Duplicate resource 79d00d9c-beb9-4172-9c4d-fd744fc96429. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

Hey did you solve the atmosphere problem? I also have error that " org.atmosphere.inject.Injectable: Provider org.atmosphere.inject.AtmosphereConfigInjectable not found", how to solve this problem?

2017-11-28 15:43:29,229 | DEBUG | tures-1-thread-1 | ServletHolder                    | 359 - org.eclipse.jetty.util - 9.3.14.v20161028 | Servlet.init fi.xaxis.akseli.wristband.printer.WristbandPrinterServlet@5343e2e0 for org.ops4j.pax.web.service.spi.model.ServletModel-94
2017-11-28 15:43:29,229 | WARN  | tures-1-thread-1 | DefaultDeploymentConfiguration   | 88 - com.vaadin.server - 8.1.4 | 
=================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.
=================================================================
2017-11-28 15:43:29,230 | DEBUG | tures-1-thread-1 | PushRequestHandler               | 88 - com.vaadin.server - 8.1.4 | Initializing Atmosphere for servlet org.ops4j.pax.web.service.spi.model.ServletModel-94
2017-11-28 15:43:29,231 | INFO  | tures-1-thread-1 | AtmosphereFramework              | 84 - com.vaadin.external.org.slf4j - 1.6.1 | Installed AtmosphereHandler com.vaadin.server.communication.PushAtmosphereHandler mapped to context-path: /*
2017-11-28 15:43:29,231 | INFO  | tures-1-thread-1 | AtmosphereFramework              | 84 - com.vaadin.external.org.slf4j - 1.6.1 | Installed the following AtmosphereInterceptor mapped to AtmosphereHandler com.vaadin.server.communication.PushAtmosphereHandler
2017-11-28 15:43:29,235 | ERROR | tures-1-thread-1 | AtmosphereFramework              | 84 - com.vaadin.external.org.slf4j - 1.6.1 | Failed to initialize Atmosphere Framework
java.util.ServiceConfigurationError: org.atmosphere.inject.Injectable: Provider org.atmosphere.inject.AtmosphereConfigInjectable not found
    at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]

    at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]

    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372) ~[?:?]

    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) ~[?:?]

    at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]

    at org.atmosphere.inject.InjectableObjectFactory.configure(InjectableObjectFactory.java:86) ~[82:com.vaadin.external.atmosphere.

Hey Geertsema, I have the sam error, how did u solve this problem finally?
I have the code:

@Component(scope = ServiceScope.PROTOTYPE, service = VaadinServlet.class, property = {
    HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT + "=" + DashboardContext.CONTEXT_SELECT_FILTER
})
@WebServlet(urlPatterns = LoginServlet.CONTEXT_PATH + "/*", name = "LoginServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = LoginUI.class, productionMode = false, widgetset = AkseliWidgetSet.NAME)
public class LoginServlet extends VaadinServlet {

Hi,

For me worked modyfing antMatchers ( e.g. .antMatchers(“/VAADIN/“,”/vaadinServlet/”).permitAll() ) to your spring security config file.

Kind Regards,
Artur