appreciated/apexcharts-flow

[Vaadin20 + Windows] Couldn't find the definition of the element with tag 'apex-charts-wrapper' in any template file declared using '@JsModule' annotations

Closed this issue · 7 comments

Describe the bug
The bug appears for the new Vaadin 20 and app deployed on Windows for vaadin + spring app. I generate and deploy the war app and deploy it on Win10 on Tomcat 9. The bug appears both in debug and production mode.

  • The bug doesn't appear with Vaadin19 (no matter if on Windows or *UX)
  • The bug doesn't appear with *UX (even with Vaadin20)
  • But appears with Vaadin20 on Windows.
    So it could be something with paths inside apex addon (paths used in @JsModule)

After successful deployment going to the View with Apex Chart addon component ends with:
There was an exception while trying to navigate to '' with the exception message 'Error creating bean with name 'com.example.application.views.helloworld.HelloWorldView': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.application.views.helloworld.HelloWorldView]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Couldn't find the definition of the element with tag 'apex-charts-wrapper' in any template file declared using '@JsModule' annotations. Check the availability of the template files in your WAR file or provide alternative implementation of the method getTemplateContent() which should return an element representing the content of the template file'

Caused by: java.lang.IllegalStateException: Couldn't find the definition of the element with tag 'apex-charts-wrapper' in any template file declared using '@JsModule' annotations. Check the availability of the template files in your WAR file or provide alternative implementation of the method getTemplateContent() which should return an element representing the content of the template file
	at com.vaadin.flow.component.polymertemplate.NpmTemplateParser.getTemplateContent(NpmTemplateParser.java:155) ~[flow-polymer-template-7.0.2.jar:7.0.2]
	at com.vaadin.flow.component.polymertemplate.TemplateDataAnalyzer.parseTemplate(TemplateDataAnalyzer.java:217) ~[flow-polymer-template-7.0.2.jar:7.0.2]
	at com.vaadin.flow.component.polymertemplate.TemplateInitializer.lambda$null$23ee5b4f$1(TemplateInitializer.java:95) ~[flow-polymer-template-7.0.2.jar:7.0.2]
	at com.vaadin.flow.internal.ReflectionCache.lambda$wrapValueProvider$d0062d93$1(ReflectionCache.java:93) ~[flow-server-7.0.2.jar:7.0.2]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_181]
	at com.vaadin.flow.internal.ReflectionCache.get(ReflectionCache.java:110) ~[flow-server-7.0.2.jar:7.0.2]
	at com.vaadin.flow.component.polymertemplate.TemplateInitializer.<init>(TemplateInitializer.java:96) ~[flow-polymer-template-7.0.2.jar:7.0.2]
	at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:94) ~[flow-polymer-template-7.0.2.jar:7.0.2]
	at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:109) ~[flow-polymer-template-7.0.2.jar:7.0.2]
	at com.github.appreciated.apexcharts.ApexCharts.<init>(ApexCharts.java:28) ~[apexcharts-2.0.0-beta12.jar:2.0.0-beta12]
	at com.github.appreciated.apexcharts.ApexChartsBuilder.build(ApexChartsBuilder.java:197) ~[apexcharts-2.0.0-beta12.jar:2.0.0-beta12]
	at com.example.application.views.helloworld.HelloWorldView$AreaChartExample.<init>(HelloWorldView.java:79) ~[classes/:1.0-SNAPSHOT]

Vaadin support diagnosed that the problem lies inside the addon.

My simple test app:
my-app.zip
Just generate war and deploy it on Windows.

Environment:

  • OS: Windows
  • Vaadin 20
  • Spring 5

I must say, that we love this addon and use it on our production vaadin app. Now we are on Vaadin19, but it will be deprecated soon because new Vaadin20 appeared. So we have to move to it very soon :) So any help would be very @appreciated :)))

Hi @darmro, Sorry to hear you are having trouble upgrading to Vaadin 20. I guess you already had a look at #51.
This bug always occurs if this file is not found in your application context. In most cases it is simply a build issue (no mvn clean install was run etc.). But since you already had a working build, I guess there is another reason to this. Try upgrading to the newest Vaadin 20 version, and check if the issue still occurs.

So it could be something with paths inside apex addon (paths used in @jsmodule)

I disagree on this point, if it works in Vaadin 14-19, but doesn't work in Vaadin 20, a path issue is very unlikely, more likely would be a bug in Vaadin 20.

But let's not stop here, show me what your build process looks like. If you could provide a small project to help me to reproduce the issue, that would really help.

Hi Johannes,
Before I've created this issue I turned for help to Vaadin support (I have prime subscr.). Vaadin support has tried to solve the problem, but finally after few days and checking internally with flow team they said "It seems to be an issue with the addon" and ask me to create the issue here.
I've attached my-app.zip in the issue :) This simple project is taken from Vaadin start page and uses the newest Vaadin 20.0.3.
I've just generate war file running mvn clean package -Pproduction. I've even delete node_modules and target folder by myself before generating war file. Nothing changed.
The problem appears only in the Windows environment, which is really strange. The same war deployed on the same tomcat version but in tye *UX works well. But on 3 different windows servers does not.

Vaadin support have just asked me to create an issue for flow, so I did it ;)
vaadin/flow#11306
Byt at the moment no one knows if this is a mistake and if so, if it is in Flow or in addon.

It turned out that it's a flow problem (most likely)
vaadin/flow#11220

Haven't tested it myself, but this comment looks like a workaround vaadin/flow#11220 (comment)

Hello I love this library but I also have the same problem. In development it works for me but when I pass it to production it doesn't work and it throws me the same error. I tried all the possible solutions they posted but I can't get it to work. Could someone fix it?

@LChris94 Checkout this workaround vaadin/flow#11220 (comment). Otherwise, simply wait for another Vaadin 20 release.