Closed nutmix closed 7 months ago
I downloaded the project, imported in IntelliJ IDEA, the "run" arrow in Application
class and the application started normally without any error.
In your case, it looks like IDEA has not correctly imported the project dependencies.
Did you try to reimport the Maven project, using the Maven panel or the project tree context menu Maven -> Reload project
I can confirm the lived demo is currently broken
It could be intellij, its not the ultimate version. It usually auto imports projects as maven project when it sees the pom. I tried maven->reload project but get the same error when I try to run the main
I used File->New->Project from existing sources. There is no option to import a maven project as such - it auto detects it.
I have imported dozens of spring boot projects in the past and not had this issue.
It doesnt seem to run form the mvn command line either - so something is wrong.
Maybe its a maven version or java version incompatibility?
Can you please post the logs of the command line execution?
ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 60.955 s <<< FAILURE! - in com.example.application.it.LoginE2ETest
[ERROR] com.example.application.it.LoginE2ETest.loginAsValidUserSucceeds Time elapsed: 0.002 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class com.vaadin.testbench.browser.BrowserExtension
at com.vaadin.testbench.browser.MultipleBrowsersExtension$CapabilitiesTestTemplateInvocationContext.getAdditionalExtensions(MultipleBrowsersExtension.java:80)
at org.junit.jupiter.engine.descriptor.TestTemplateInvocationTestDescriptor.populateNewExtensionRegistry(TestTemplateInvocationTestDescriptor.java:68)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:99)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:202)
at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.ExceptionInInitializerError [in thread "ForkJoinPool-1-worker-5"]
at com.vaadin.pro.licensechecker.LicenseChecker.checkLicenseFromStaticBlock(LicenseChecker.java:82)
at com.vaadin.testbench.TestBenchVersion.
[ERROR] com.example.application.it.LoginE2ETest.loginAsInvalidUserFails Time elapsed: 0.002 s <<< ERROR!
java.lang.ExceptionInInitializerError
at com.vaadin.pro.licensechecker.LicenseChecker.checkLicenseFromStaticBlock(LicenseChecker.java:82)
at com.vaadin.testbench.TestBenchVersion.
[INFO] [INFO] Results: [INFO] [ERROR] Errors: [ERROR] LoginE2ETest.loginAsInvalidUserFails » ExceptionInInitializer [ERROR] LoginE2ETest.loginAsValidUserSucceeds » NoClassDefFound Could not initialize class com.vaadin.testbench.browser.BrowserExtension [INFO] [ERROR] Tests run: 5, Failures: 0, Errors: 2, Skipped: 0
I see its complaining about a licence key in the second exception.
I didnt see any instructions in the readme
Yes, the project uses Vaadin Testbench that is a commercial product
So we cant run this tutorial without paying?
You can remove the LoginE2ETest
class
or just skip tests with maven -DskipTests
command line option
ok, I deleted LoginE2ETest, and project now builds. how do I run it? I still cant run it in IDE though.
This is what it looks like when imported as existing sources into intellij community edition:
This looks like an IDE problem failing to resolve maven dependencies. Any errors when you run the "Reload All Maven projects" from the maven panel that is usually on the right side of the IDE?
"Reload all Maven projects: doesnt seem to help. Just pops up a "sync" window with no output. The build output still shows all the errors and missing dependencies. I have no idea what the profiles section is for - or why its showing adobe-public. I didnt set or select that.
Interestingly, if I now do a "rebuild", I get an error about java 17. Maybe vaadin tutiral wont work with java 17 (the projects readme is missing information).
java: warning: source release 17 requires target release 17 Module flowcrmtutorial SDK 11 is not compatible with the source version 17. Upgrade Module SDK in project settings to 17 or higher. Open project settings.
Do I have to downgrade java to 8 or 11 to get this to work?
No, you have to use Java 17, but it looks like the project in IDEA is configured to use JDK 11. Check the project settings
Also the main.iml
IDEA file in src/main/java
looks weird
When I imported the project, it asked what version of java I wanted to use, 11 or 17. I chose l7. I can remove the project, start again, and select 11.
You have to use 17, not 11
Ok, I did the following:
Something in File->New->project from existing sources fails, tried this route 3 times. Opening as a directory instead of a project from intellij, then build, AFTER doing the external $mvn package, seems to do the trick.
Next problem is that you cant actually login with user/userpass, so cant see or use the app, and there is no user/pass in the readme.
Check the SecurityConfig.java
code
The credential in the codebase are user/password, they are not the same as in the online demo
user and password works, thanks for the help!
@nutmix we already have a ticket for checking what's wrong with the online demo. Do you think this issue can be closed?
README updated
Unfortunately, the readme is missing how to run this project.
I cloned the project then tried opening it in intellij, then hitting the "run" arrow next to main in com.example.application.Application.java, and get the following error:
/Users/simon/dev/tutorials/flow-crm-tutorial/src/main/java/com/example/application/Application.java:3:38 java: package com.vaadin.flow.component.page does not exist
If I try to do the following:
$ mvn package
I get the following errors:
[ERROR] Errors: [ERROR] LoginE2ETest.loginAsInvalidUserFails » ExceptionInInitializer [ERROR] LoginE2ETest.loginAsValidUserSucceeds » NoClassDefFound Could not initialize class com.vaadin.testbench.browser.BrowserExtension [INFO]
The live demo is also broken (cant login with user/userpass) at https://crm.demo.vaadin.com/
Using M1 Mac, osx 13.2.1, with Zulu java 17, mvn version 3.8.7