unable to install playwright as a maven dependancy - java

I'm trying to build my automation framework using playwright with java, however I'm running into below issue when running the tests. Please advice!
Failed to install browsers
Error: Failed to download chromium v1000, caused by
Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
at TLSSocket.emit (node:events:390:28)
at TLSSocket._finishInit (node:_tls_wrap:944:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)
Exception in thread "main" java.lang.RuntimeException: Failed to create driver
at com.microsoft.playwright.impl.Driver.ensureDriverInstalled(Driver.java:61)
at com.microsoft.playwright.impl.PlaywrightImpl.create(PlaywrightImpl.java:40)
at com.microsoft.playwright.Playwright.create(Playwright.java:96)
at com.microsoft.playwright.Playwright.create(Playwright.java:100)
at Example.main(Example.java:5)
Caused by: java.lang.RuntimeException: Failed to install browsers, exit code: 1
at com.microsoft.playwright.impl.DriverJar.installBrowsers(DriverJar.java:76)
at com.microsoft.playwright.impl.DriverJar.initialize(DriverJar.java:48)
at com.microsoft.playwright.impl.Driver.ensureDriverInstalled(Driver.java:57)
... 4 more

I could solve it by disabling the download (as it was already installed with npx playwright install) by setting the env
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
IntelliJ IDE Run Configuration

It's not a Playwright or Maven problem. You can fix it yourself. If you want just to avoid the problem, not fixing it, you can follow this recommendation: https://community.claris.com/en/s/question/0D53w00005GuQXxCAN/nodejs-fmsapiclient-unable-to-verify-the-first-certificate-local-server
namely by setting the system variable to zero

Related

Keycloak server problem Could not find or load main class

I can't run keycloak server, when I try to run kc.bat in windows powershell or cmd with
.\kc.bat
I get the error
Error: Could not find or load main class io.quarkus.bootstrap.runner.QuarkusEntryPoint
Caused by: java.lang.ClassNotFoundException: io.quarkus.bootstrap.runner.QuarkusEntryPoint
I installed quarkus but it doesn't work even tho I installed it
There is an open bug related to this issue.
You have to edit kc.bat line 127 replace : with ;

Building Micronaut docker image in GitlabRunner with docker executor

TLDR: How can one build docker images with Gradle inside a Openjdk container?
The problem
We are building a Micronaut based suite of microservices in a multi-module Gradle project using GitLab pipelines.
Currently our pipeline builds docker images in a separate pipeline stage using docker command line, but it is starting to become unwieldy and cumbersome to add new services that way.
So instead of having separate pipeline steps for building the executable and then building docker images for each executable, I am looking into building the docker images right along with the main build step using gradle.
Micronaut's gradle plugin includes and extends gradle-docker-plugin and allows building docker images using dockerBuild task.
The whole Gradle build step is executed from within openjdk:14 docker image by custom private gradle-runner instance, so that container doesn't have any docker related bits on it.
What I've tried so far
The naive approach
My first attempt was to simply add dockerBuild target to the Gradle command line. That one failed as expected with the following stacktrace (abbreviated for the sake of clarity):
Execution failed for task ':my-service:dockerBuild'.
> com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.HttpHostConnectException: Connect to http://127.0.0.1:2375 [/127.0.0.1] failed: Connection refused
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':my-service:dockerBuild'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
/.../
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
> Task :my-service:dockerBuild FAILED
Building image using context '/builds/my-group/my-project/my-service/build/docker'.
Using Dockerfile '/builds/my-group/my-project/my-service/build/docker/Dockerfile'
Using images 'registry.gitlab.com/my-group/my-project/my-service:1.0.1-SNAPSHOT+4b9f8460.179'.
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
/.../
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
Caused by: java.lang.RuntimeException: com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.HttpHostConnectException: Connect to http://127.0.0.1:2375 [/127.0.0.1] failed: Connection refused
at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:153)
at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:8)
at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
Caused by: com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.HttpHostConnectException: Connect to http://127.0.0.1:2375 [/127.0.0.1] failed: Connection refused
at com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.socket.PlainConnectionSocketFactory$1.run(PlainConnectionSocketFactory.java:87)
at com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:84)
/.../
at com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:67)
at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:149)
... 3 more
After some initial headschratching I figured out that this was basically caused by the fact that a build running in a container simply did not have access to docker engine remote api.
Docker socket approach
Couple of mediocre applications of Google-Fu later, I found the recommendation to map /var/run/docker.sock into the container file system.
This prompted me to modify my gitlab-runner configuration:
[[runners]]
name = "gennet-elab jdk runner"
url = "https://gitlab.com/"
executor = "docker"
[runners.docker]
image = "openjdk:14.0.2-slim"
volumes = ["/var/run/docker.sock:/var/run/docker.sock", ...]
Running the pipeline with that configuration yielded me the following failure stacktrace:
Execution failed for task ':my-service:dockerBuild'.
> java.io.IOException: native write() failed : Connection reset by peer
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':my-service:dockerBuild'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:186)
[...]
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
Caused by: java.lang.RuntimeException: java.io.IOException: native write() failed : Connection reset by peer
at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:153)
at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:8)
at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
Caused by: java.io.IOException: native write() failed : Connection reset by peer
at com.github.dockerjava.httpclient5.UnixDomainSocket$UnixSocketOutputStream.write(UnixDomainSocket.java:319)
at com.bmuschko.gradle.docker.shaded.org.apache.hc.core5.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:117)
[...]
at com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:67)
at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:149)
... 3 more
Suppressed: java.io.IOException: native write() failed : Broken pipe
at com.github.dockerjava.httpclient5.UnixDomainSocket$UnixSocketOutputStream.write(UnixDomainSocket.java:319)
at com.bmuschko.gradle.docker.shaded.org.apache.hc.core5.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:117)
at com.bmuschko.gradle.docker.shaded.org.apache.hc.core5.http.impl.io.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:126)
[...]
at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:8)
at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
at java.base/java.lang.Thread.run(Thread.java:832)
This suggests to me, it tries to connect over the socket, but the connection is closed by docker API server. From reading the documentation it seems there is some sort of
From all that I can understand, the problem might have something to do with docker api security, but all of the tutorials out there show dind (Docker in Docker) usage and that does not really help my use case.
I've also tried running the container with privileged access and tried once with dind service attached to the build job, but none of these seemed to work.
The Question
So, the question for the Great and Powerful Internet is if there is a way to build docker images using Gradle inside openjdk container and leveraging Docker remote API?
If yes, what am I missing? If no, what are the alternatives (yes, I know I can probably just create a separate gitlab shell runner, but I'd like to explore the Docker option first)

Run JavaFX with Visual Studio Code Remote Extension

I'm already trying for a few hours to run a JavaFX application with the help of the Visual Studio Remote Development extension within a Docker Container.
I want to forward the graphic of the application with the help of X11. I already integrated the required packages for X11 in the container, set the DISPLAY environment variable and mounted the X11 socket in the container (/tmp/.X11-unix/).
Unfortunately, it won't work like that... Whenever I try to run the application, I get the following error message:
root#c0699153fc1c:/workspaces/JavaFX/src# java --module-path /usr/share/openjfx/lib/ --add-modules javafx.controls,javafx.fxml HelloWorldApplication.java
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222)
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:678)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
... 1 more
Exception in thread "main" java.lang.RuntimeException: No toolkit found
I'm using openjdk:11 as base image for the docker container and installed the following packages inside of it:
openjfx
libx11-dev
libxext-dev
libxrender-dev
libxtst-dev
I previously already tried to run IntelliJ within a Docker container, which is working fine. The GUI gets forwarded to my Display and also JavaFX applications are working fine in there.
I would appreciate any help on this matter. Maybe I oversee something.
EDIT:
I think I found the problem. It seems like OpenJDK:11 and OpenJFX do not work correctly, even though I followed tons of tutorials...
So what I did now is that I exported the JDK, which comes with IntelliJ IDEA and mounted it into the container, which gets created of VS Code. After compiling the .java file with the mounted compiler and executing it, it worked flawlessly.
So now my only problem is, that I need a working setup within VS Code to get JavaFX applications working -> so a proper OpenJDK and OpenJFX configuration.
Finally, I was able to fix the problem. So the solution was:
I created an own Dockerfile, where I took the openjdk:12 image as base and copied the JavaFX libraries (which I got from here: https://gluonhq.com/products/javafx/) into the container. Additionally, I added all required packages for X11 (mentioned above).
In VS Code, after the container has been started, I simply had to add the libs to the "Referenced Libraries".
Afterwards, I had to adjust the launch.json and added the following vmArgs:
"vmArgs": "--module-path <Path-to-FX-Folder> --add-modules javafx.controls"
Now when I run the application, the window is going to be created and shown on my DISPLAY.

Jenkins Pipeline error when building

We have been trying to get Pipeline working on Jenkins 2.107 however it keeps coming up with an error that i have struggled to locate online. We have a Windows 2008 R2 server with Jenkins running as a service.
I have installed the pipeline plugin and set up the Hello World provided to test it. As soon s it starts to build it throws this error to the console.
Running in Durability level: MAX_SURVIVABILITY [BFA] Scanning build
for known causes... [BFA] No failure causes found [BFA] Done. 0s
java.lang.ClassNotFoundException:
org.kohsuke.groovy.sandbox.GroovyInterceptor at
jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1374)
at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1327)
at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1080)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) Caused:
java.lang.NoClassDefFoundError:
org/kohsuke/groovy/sandbox/GroovyInterceptor at
org.jenkinsci.plugins.workflow.cps.CpsGroovyShellFactory.makeClassLoader(CpsGroovyShellFactory.java:113)
at
org.jenkinsci.plugins.workflow.cps.CpsGroovyShellFactory.build(CpsGroovyShellFactory.java:119)
at
org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:556)
at
org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:520)
at
org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:319)
at
hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429) Finished: FAILURE
We are running Java 8 and i have set Jenkins to use Java 8 in the config file. I have researched this error but can't seem to find something similar.
We have another server which runs pipeline fine however the differences are that this is windows 2012 server and it is running an older version of Jenkins and Java. Other than the two differences all plugins and config match.
I had this error and resolved it by upgrading the Script Security plugin to version 1.44 (had 1.41).

Cannot run WOInstaller.jar and thus cannot create frameworks in WOLips

I am installing WOLips. I have installed the plugins in Eclipse and everything seems fine (except Goodies won't install). I have tried to run WOInstaller.jar but I get a "connection time out" error:
$ sudo java -jar WOInstaller.jar 5.4.3 $HOME/workspace/WebObjects543/Versions/WebObjects543.
Exception in thread "main" java.net.ConnectException: Connection timed out at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
This is the build recommended for my version of Eclipse on Debian. Any ideas?
I solved it. It was a proxy problem. Using java -Dhttp.proxyHost=10.0.0.0 -Dhttp.proxyPort=8080 -jar etc. it works!

Categories

Resources