Embedding Javascript-Component problematic with SpringBoot?

Hi and Hello,

i am trying to integrate a JavaScript-Component (GoogleMap) into my UI. I have read the guides for this and was successfully able to do this on a small test-application.

I then wanted to integrate all of this into a SpringBoot-Context. I assumed that it would be enough to change the package-Name in the connector of the JS-Component and fixing other naming-Divergences, but it would not work. I´ve tried for several hours now and keep getting the same error:

“Could not initialize JavaScriptConnector because no JavaScript init function was found. Make sure one of these functions are defined:” etc…

I´ve attached a Screenshot of my setup and exact wording.

I know that this problem has been encountered before and in most cases it was naming-Issues. But could it be that the SpringBoot-Building causes problems because of the placing of the js-files? I can’t figure out any other reason.

I would be VERY grateful for any sort of help, because this thing is driving me NUTS :slight_smile:

Thx in advance,


Non-Surprisingly storing the connector on a different server and linking its address resolves the problem, but it feels dirty, clunky and is somewhat impractical for developing


The first thing to check is that the javascript files are loaded. If you load the Javascript files with the @JavaScript annotation you should see them in sources tab in Chrome inspector, folder “APP/PUBLISHED”. There should also be a script tag in the header that ends with “/APP/PUBLISHED/the_file_name.js” for all Javascript files loaded this way.

You might have to put the javascript files in the resources folder, see https://vaadin.com/forum#!/thread/9721905

Hope this helps.



Thank you very much for your response. I managed to get it to work on the localhost with your help.

However, i got stuck during deployment:
As mentioned, i use Vaadin with Spring-Boot. I created a JavaScript-Component representing a “Google Map”. For this purpose i embed the necessary remote scripts, a connector and the component itself.

When deploying to Apache Tomcat(8.5.), i do NOT get a “Could not initialize JavaScript-Connector…”-Error. The Javascript-Components get deployed exactly where i want them and the lack of an error indicates that my structure works as intended.

However, my GoogleMap, created by the javascriptComponent via gmapAPI does not show. As i write this i realize that i´m actually not at all sure, that this Problem is Vaadin-related, but i´ll still give it a shot: Do you have any experience with a generated gMap not working on a tomcat-Server?

Thank you very much again :slight_smile:

Edit: I was being an Idiot and tried to access a non-secure script file on my secure server. Added my ‘s’ and now it works fine.


Great that it works! Just in case you haven’t noticed, there is an existing Google maps add-on: https://vaadin.com/directory#!addon/googlemaps-add-on.

This might not fit your needs, but I thought I would mention it just in case.