Vaadin 14 fails to render but only when running from IntelliJ - java

I am running Vaadin 14.8.1 and Spring Boot 2.6 and when I deploy the app to GCP it works absolutely fine however the same code fails to render properly when running from IntelliJ.
There is an error in the browser console which suggests there are duplicate js dependencies being loaded, however as this is a java app we don't specify any dependencies other that the java ones in the pom file. Any ideas how to resolve this?
Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "vaadin-avatar" has already been used with this registry
at eval (webpack-internal:///../node_modules/#vaadin/vaadin-messages/node_modules/#vaadin/vaadin-avatar/src/vaadin-avatar.js:343:16)
at Module.../node_modules/#vaadin/vaadin-messages/node_modules/#vaadin/vaadin-avatar/src/vaadin-avatar.js (http://localhost:8080/VAADIN/build/vaadin-bundle-eb17c7fdd852fcb6b788.cache.js:3145:1)
at __webpack_require__ (http://localhost:8080/VAADIN/build/vaadin-bundle-eb17c7fdd852fcb6b788.cache.js:20:30)
at eval (webpack-internal:///../node_modules/#vaadin/vaadin-messages/src/vaadin-message-avatar.js:2:100)
at Module.../node_modules/#vaadin/vaadin-messages/src/vaadin-message-avatar.js (http://localhost:8080/VAADIN/build/vaadin-bundle-eb17c7fdd852fcb6b788.cache.js:3169:1)
at __webpack_require__ (http://localhost:8080/VAADIN/build/vaadin-bundle-eb17c7fdd852fcb6b788.cache.js:20:30)
at eval (webpack-internal:///../node_modules/#vaadin/vaadin-messages/src/vaadin-message.js:6:83)
at Module.../node_modules/#vaadin/vaadin-messages/src/vaadin-message.js (http://localhost:8080/VAADIN/build/vaadin-bundle-eb17c7fdd852fcb6b788.cache.js:3229:1)
at __webpack_require__ (http://localhost:8080/VAADIN/build/vaadin-bundle-eb17c7fdd852fcb6b788.cache.js:20:30)
at eval (webpack-internal:///../node_modules/#vaadin/vaadin-messages/src/vaadin-message-list.js:8:76)

Related

Wix embedded mysql does not start due CommandFailedException due 'Stream closed'

Trying to run my embedded mysql based Unit tests I get an exception with this part:
Failed to instantiate [com.wix.mysql.EmbeddedMysql]: Factory method 'getEmbeddedMysql' threw exception; nested exception is com.wix.mysql.exceptions.CommandFailedException: Command 'CREATE USER 'sa'#'%' IDENTIFIED BY '';' on schema 'information_schema' failed with message 'Stream closed'
The same unit test and environment setup work on my MacBook
This machine with the error is an Ubuntu 20.04
Wix version is 4.6.2; Java 8, mysql.connector 8.0.24
I tried changing the dependencies versions and also tried with Java 11.
Run from within IntelliJ and on the command line. Same result.
Let me put the full comment I found in Github which helped me to fix this and I'm pretty sure most of the people seeing this in Ubuntu will find this as the solution:
I had this same issue with MySQL 5.7, while working on another open source project. I cloned the wix-embedded-mysql repository and ran the tests using the master branch, which also failed in the exact same way, except that I received a longer, more thorough message in the catch.
The issue was that I was on Ubuntu and did not have the ncurses 5 shared library installed. On ubuntu, I installed libncurses5 (apt install libncurses5) and everything started working (all tests on wix, and on my project).
I hope this helps resolve the issue.
Thanks to https://github.com/codesplode

ModelNotFoundException: ModelZoo doesn't support specified engine: PyTorch

I'm try to run some ML on Java (17) using Yolov5, DJL with OpenCV.
I have built a model and exported to torchscript. When I run my code in IntelliJ all works fine, photos are processed and the object are recognized on them... great :)
But when I try to run this app outside IntelliJ i have problems.
Application is built using maven and maven-assembly-plugin with jar-with-dependencies.
I run it using command:
java "-Djava.library.path=C:\Program Files\OpenCV\build\java\x64" -jar app-0.1-SNAPSHOT-jar-with-dependencies.jar
in return I get:
Exception in thread "main" ai.djl.repository.zoo.ModelNotFoundException: ModelZoo doesn't support specified engine: PyTorch
at ai.djl.repository.zoo.Criteria.loadModel(Criteria.java:121)
at my.app.Yolov5.process(Yolov5.java:70)
at my.app.Main.main(Main.java:22)
In pom I have dependencies to (0.19.0 versions + 4.5.5-0 in opencv [same as installed in OS]):
ai.djl:api
ai.djl:model-zoo
ai.djl.pytorch:pytorch-model-zoo
ai.djl.pytorch:pytorch-engine
ai.djl.pytorch:pytorch-native-auto
org.openpnp:opencv

Application error and logs not loading, what steps to take?

I've been getting the following error page, when visiting my app:
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
However, heroku logs --tail does not return anything. If I go to the dashboard through web (https://dashboard.heroku.com/apps/app-name/logs), the logs window keeps loading but nothing is shown.
I have nothing to go on, and Heroku won't accept a ticket of a free app. Does anyone know any more steps I can take to trace the error?
Additional info:
The build logs all look fine:
BUILD SUCCESSFUL in 49s
5 actionable tasks: 5 executed
Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
Compressing...
Done: 85.2M
Launching...
Released v3
https://app-name.herokuapp.com/ deployed to Heroku
I am creating a spring Java API, it works fine when I try to run it locally. If I try to run it through $heroku local I do get an error:
[FAIL] No Procfile and no package.json file found in Current Directory - See run --help
I had same issue. I just added system.properties to root folder of spring app and this file contained 1 line:
java.runtime.version=11
Heroku procfile documentation.
Spring documentation for Heroku deployment

Submitting Spark application on YARN from Eclipse IDE

I am facing an issue when I try to submit my Spark application on Yarn from eclipse. I try to submit a simple SVM program, but i gives below error. I Have macbook, and I will be so thankful if somebody give me detailed answer
16/09/17 10:04:19 ERROR SparkContext: Error initializing SparkContext.
java.lang.IllegalStateException: Library directory '.../MyProject/assembly/target/scala-2.11/jars' does not exist; make sure Spark is built.
at org.apache.spark.launcher.CommandBuilderUtils.checkState(CommandBuilderUtils.java:248)
at org.apache.spark.launcher.CommandBuilderUtils.findJarsDir(CommandBuilderUtils.java:368)
at org.apache.spark.launcher.YarnCommandBuilderUtils$.findJarsDir(YarnCommandBuilderUtils.scala:38)
at org.apache.spark.deploy.yarn.Client.prepareLocalResources(Client.scala:500)
at org.apache.spark.deploy.yarn.Client.createContainerLaunchContext(Client.scala:834)
at org.apache.spark.deploy.yarn.Client.submitApplication(Client.scala:167)
at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:56)
at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:149)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:500)
at SVM.main(SVM.java:21)
Go to
Run Configurations --> Environment
in Eclipse and add the environment variable SPARK_HOME.

Managed VM deploy failed because "env" setting is not supported

Trying to deploy a Java app to Google Appengine Managed VM. I'm using console gcloud and already prepared WAR file. Plus app.yaml.
Using following command:
gcloud preview app deploy ./build/libs/app.yaml
Right now it fails with:
Building and pushing image for module [default]
-------------------------------------------------------------------------------- DOCKER BUILD OUTPUT --------------------------------------------------------------------------------
Step 0 : FROM gcr.io/google_appengine/jetty9
---> 005014071b64
Step 1 : ADD webapp-webapp.war $JETTY_BASE/webapps/root.war
---> 3e9023930cc8
Removing intermediate container 342e8a2f5750
Successfully built 3e9023930cc8
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Beginning teardown of remote build environment (this may take a few seconds).
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [400] "env" setting is not supported for this deployment.
I see similar error (there) for maven-gcloud-plugin that happens when project is not configured as WAR. But notice that:
i'm using plain command line tool gcloud, a latest version
and my project is packaged into WAR already
Also i'm using following app.yaml (which i've got from maven plugin sources):
runtime: java
env: 2
api_version: 1
handlers:
- url: .*
script: dynamic
So the question, where from this error is coming from (docker image is already prepared at this moment, right?). What it means? And how to fix this?
Update
I noticed that it uses FROM gcr.io/google_appengine/jetty9 for VM. But for Appengine it should be FROM gcr.io/google_appengine/jetty9-compat. I've tried to switch to exploded app instead of WAR, and it started using correct Docker base image. But still fails:
Building and pushing image for module [default]
-------------------------------------------------------------------------------- DOCKER BUILD OUTPUT --------------------------------------------------------------------------------
Step 0 : FROM gcr.io/google_appengine/jetty9-compat
---> 2ad8572ef3d8
Step 1 : ADD . /app/
---> b10f4bc6718e
Removing intermediate container 8b149f4baf9c
Successfully built b10f4bc6718e
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Beginning teardown of remote build environment (this may take a few seconds).
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [400] "env" setting is not supported for this deployment.
The reason was this line in app.yaml:
env: 2
it was too simple and too obvious to try to deploy w/o this option. Also, every doc, official and unofficial, mentions that you need to have env: 2 option set to deploy your app as Appengine app. That's really strange.
Removing this line also changed base Docker image to gcr.io/google_appengine/java-compat. I guess it means that jetty images, including jetty9-compat, aren't compatible with Appengine apps

Categories

Resources