Unable to start Google Chrome 78 with selenide - selenide

I am unable to start Google Chrome Browser Version 78.0.3904.108.
Version of chromedriver is ChromeDriver 78.0.3904.105.
#Test
public void uiTest() {
System.setProperty("webdriver.chrome.driver", "src/test/resources/driver/chromedriver");
System.setProperty("selenide.browser", "Chrome");
open("https://www.google.com");
}
Error is the following:
Starting ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904#{#877}) on port 3782
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
java.lang.NoSuchMethodError: com.google.common.util.concurrent.SimpleTimeLimiter.create(Ljava/util/concurrent/ExecutorService;)Lcom/google/common/util/concurrent/SimpleTimeLimiter;
Error is the same even without System.setProperty configurations. Is it possible to be related to Chrome version?

I've resolved the issue.
Guava dependency has to be added.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>

Related

ActiveMQ Artemis broker and Spring Boot - prevent from starting embedded

I have a project, where I want to use ActiveMQ Artemis with Spring Boot 3.0.1, but I have an issue with embedded server.
Dependencies used:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-artemis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-server</artifactId>
</dependency>
The drill should be: when needed, start embedded server, but there is no need for that, connect to existing instance.
From I understand, there are two parameters, that might be useful here:
spring.artemis.mode - I should set it whenever want to start embedded service or connect to native instance of the server and:
spring.artemis.embedded.enabled - Quote from documentation, "Whether to enable embedded mode if the Artemis server APIs are available."
All that said, setting first one to native and second one to false does not do the trick. Native server is still starting. Am I missing something? Is there a simple way to tell Spring Boot via property or any other way to not start server if not needed?
EDIT1:
Maybe I'll provide some more details.
All configuration for the Artemis goes into separate module, where dependencies that has been provided above are.
Then, this module (let's call it "message") has only following properties:
spring:
artemis:
broker-url: tcp://localhost:61616
mode: native
Then, other module has than module as a dependency (has changed names of the groupId and artifactId for simplicity):
<dependency>
<groupId>org.example.company</groupId>
<artifactId>message</artifactId>
</dependency>
Then, changing the value in the properties does nothing to starting the server, in both configurations I see in logs:
2023-01-23T11:41:18.445+01:00 INFO 35336 --- [ restartedMain] o.apache.activemq.artemis.core.server : AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=C:\Users\USR~1.JAR\AppData\Local\Temp\artemis-data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
...
2023-01-23T11:41:19.058+01:00 INFO 35336 --- [ restartedMain] o.apache.activemq.artemis.core.server : AMQ221007: Server is now live
2023-01-23T11:41:19.059+01:00 INFO 35336 --- [ restartedMain] o.apache.activemq.artemis.core.server : AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.26.0 [localhost, nodeID=78075d71-9b0a-11ed-8116-3cf011ac7196]
In this second module, where "message" is being imported as a dependency, I'm sending and receiving some messages, if that matters.

Weird behaviour with Quarkus + GraalVM + URLConnection

I am testing the Quarkus capabilities for Travel Applications and I found a weird behaviour when I try to establish an URLConnection running in a GraalVM application
based on Quarkus. If I run a Native application:
./target/getting-started-1.0.0-SNAPSHOT-runner
and I Call the REST endpoint:
curl 'http://localhost:8080/api/v1/covid-restrictions'
then I receive the following error:
2022-06-01 17:38:43,844 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /api/v1/covid-restrictions failed, error id: f6130b71-c9fb-4a67-a996-c58fba695117-1: com.amadeus.exceptions.NetworkException: [---]
But when I run the same application as a Jar, everything is fine.
java -jar target/quarkus-app/quarkus-run.jar
One example to see the error here:
https://github.com/jabrena/quarkus-amadeus-sdk-demo
Do I need to configure the Quarkus app in some way for GraalVM?
I share the whole StackTrace if it could help:
2022-06-01 17:38:43,844 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /api/v1/covid-restrictions failed, error id: f6130b71-c9fb-4a67-a996-c58fba695117-1: com.amadeus.exceptions.NetworkException: [---]
at com.amadeus.HTTPClient.fetch(HTTPClient.java:372)
at com.amadeus.HTTPClient.execute(HTTPClient.java:358)
at com.amadeus.HTTPClient.unauthenticatedRequest(HTTPClient.java:253)
at com.amadeus.client.AccessToken.fetchAccessToken(AccessToken.java:67)
at com.amadeus.client.AccessToken.updateAccessToken(AccessToken.java:53)
at com.amadeus.client.AccessToken.lazyUpdateAccessToken(AccessToken.java:47)
at com.amadeus.client.AccessToken.getBearerToken(AccessToken.java:39)
at com.amadeus.HTTPClient.request(HTTPClient.java:339)
at com.amadeus.HTTPClient.get(HTTPClient.java:67)
at com.amadeus.dutyOfCare.diseases.Covid19AreaReport.get(Covid19AreaReport.java:51)
at org.acme.CovidResource.hello(CovidResource.java:27)
at org.acme.CovidResource$quarkusrestinvoker$hello_a2fbfead069e804ef1bb0315d16c4dc5e7951978.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:7)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:548)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:833)
at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:704)
at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:202)
Many thanks in advance.
Juan Antonio
As most APIs nowadays are, the Amadeus library is HTTPS only.
For Quarkus in native mode, you need to explicitly enable SSL in src/main/resources/application.properties (except for certain extensions, see the link below).
quarkus.ssl.native=true
See https://quarkus.io/guides/native-and-ssl
After adding this property you will get a different runtime error:
2022-06-02 00:45:25,381 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /api/v1/covid-restrictions failed, error id: 6d821ce1-23fd-4d88-8f63-992b6453830a-1: com.oracle.svm.core.jdk.UnsupportedFeatureError: Code that was considered unreachable by closed-world analysis was reached.
Try to register the following reflection classes (DiseaseAreaReport and all inner classes) as Amadeus will use GSON and therefore also Java reflection to apply the JSON String data to the DiseaseAreaReport POJO.
https://quarkus.io/guides/writing-native-applications-tips#registering-for-reflection
package org.acme;
import io.quarkus.runtime.annotations.RegisterForReflection;
#RegisterForReflection(targets = {
com.amadeus.Amadeus.class,
com.amadeus.HTTPClient.class,
com.amadeus.Params.class,
com.amadeus.Response.class,
com.amadeus.client.AccessToken.class,
com.amadeus.dutyOfCare.diseases.Covid19AreaReport.class,
com.amadeus.exceptions.ResponseException.class,
// com.amadeus.resources.DiseaseAreaReport and all inner classes
com.amadeus.resources.DiseaseAreaReport.class,
com.amadeus.resources.DiseaseAreaReport.Area.class,
com.amadeus.resources.DiseaseAreaReport.AreaAccessRestriction.class,
com.amadeus.resources.DiseaseAreaReport.AreaPolicy.class,
com.amadeus.resources.DiseaseAreaReport.AreaRestriction.class,
com.amadeus.resources.DiseaseAreaReport.AreaVaccinated.class,
com.amadeus.resources.DiseaseAreaReport.Border.class,
com.amadeus.resources.DiseaseAreaReport.DatedInformation.class,
com.amadeus.resources.DiseaseAreaReport.DatedQuarantineRestriction.class,
com.amadeus.resources.DiseaseAreaReport.DatedTracingApplicationRestriction.class,
com.amadeus.resources.DiseaseAreaReport.DeclarationDocuments.class,
com.amadeus.resources.DiseaseAreaReport.DiseaseCase.class,
com.amadeus.resources.DiseaseAreaReport.DiseaseInfection.class,
com.amadeus.resources.DiseaseAreaReport.DiseaseTestingRestriction.class,
com.amadeus.resources.DiseaseAreaReport.DiseaseVaccination.class,
com.amadeus.resources.DiseaseAreaReport.EntryRestriction.class,
com.amadeus.resources.DiseaseAreaReport.ExitRestriction.class,
com.amadeus.resources.DiseaseAreaReport.GeoCode.class,
com.amadeus.resources.DiseaseAreaReport.Link.class,
com.amadeus.resources.DiseaseAreaReport.MaskRestriction.class,
com.amadeus.resources.DiseaseAreaReport.Sources.class,
com.amadeus.resources.DiseaseAreaReport.Transportation.class,
com.amadeus.resources.DiseaseAreaReport.ValidityPeriod.class,
com.amadeus.resources.Resource.class
})
public class AmadeusReflection {
}
I hope this fixes this issue, if not dig deeper which classes or inner classes are missing to be registered for reflection with a debugger or following the stack trace.
P.S. your test shows the following warnings:
[WARNING] [io.quarkus.resteasy.reactive.server.deployment.QuarkusServerEndpointIndexer] Quarkus detected the use of JSON in JAX-RS method 'org.acme.CovidResource#hello' but no JSON extension has been added. Consider adding 'quarkus-resteasy-reactive-jackson' or 'quarkus-resteasy-reactive-jsonb'.
[WARNING] [io.quarkus.resteasy.reactive.server.deployment.QuarkusServerEndpointIndexer] Quarkus detected the use of JSON in JAX-RS method 'org.acme.ConfigResource#hello' but no JSON extension has been added. Consider adding 'quarkus-resteasy-reactive-jackson' or 'quarkus-resteasy-reactive-jsonb'.
Consider to add the RESTEasy Reactive Jackson extension in the pom.xml:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>

Getting exception "Not using JDBC" while using quarkus-hibernate-reactive-panache with quarkus-reactive-mysql-client - (Quarkus 1.12.2.Final)

Quarkus 1.12.2.Final
Getting the following exception while using reactive hibernate (quarkus-hibernate-reactive-panache) with reactive MySQL client (quarkus-reactive-mysql-client), kindly suggests what could be the issue.
2021-04-01 11:35:28,694 ERROR [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) Not using JDBC
2021-04-01 11:35:28,727 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.sql.SQLException: Not using JDBC
at org.hibernate.reactive.provider.service.NoJdbcConnectionProvider.getConnection(NoJdbcConnectionProvider.java:25)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180)
Some details
My application.properties
quarkus.datasource.jdbc=false
quarkus.datasource.db-kind=mysql
quarkus.datasource.username=root
quarkus.datasource.password=root
quarkus.datasource.reactive.url=mysql://localhost:3306/mydb
quarkus.datasource.reactive.max-size=20
My Repository Implementation
#ApplicationScoped public class EventRepository implements PanacheRepository<Event> {
}
Change your application.properties to
quarkus.datasource.db-kind=mysql
quarkus.datasource.username=root
quarkus.datasource.password=root
quarkus.datasource.reactive.url=vertx-reactive:mysql://localhost:3306/mydb
quarkus.datasource.reactive.max-size=20
Here is the cause of the problem -> I used property "quarkus.hibernate-orm.database.generation=update". It seems like the use of this property requires JDBC connection, removed it, and it's working fine.
Any of the below config sets can work.
quarkus.datasource.db-kind=mysql
quarkus.datasource.username=****
quarkus.datasource.password=****
quarkus.datasource.reactive.url=mysql://localhost:3306/db
or
quarkus.datasource.reactive.url=vertx-reactive:mysql://localhost:3306/db
"The latest version available of Hibernate Reactive doesn't support schema update and validation yet."
Relative issue here:
Not using JDBC problem met in native build · Issue #19918 · quarkusio/quarkus · GitHub
Can you try to add the following property to your settings?
quarkus.hibernate-orm.database.generation=update
You can write drop-and-create to re-create your db when you run your server as well. See details here.
Hmm. JDBC and Hibernate update should work in your case. Do you have a JDBC extension (dependency) in your project? If not, try to ad one.
In case of a postgres you can add extension this way:
./mvnw quarkus:add-extension -Dextensions="jdbc-postgresql
More info here
Add the agroal extension plus one of jdbc-db2, jdbc-derby, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle or jdbc-postgresql.
https://quarkus.io/guides/datasource
Add this dependency to your pom.xml file.
<!-- https://mvnrepository.com/artifact/io.quarkus/quarkus-jdbc-postgresql -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
<version>2.9.2.Final</version>
</dependency>

HTTP/2 with OkHttp

I am trying to communicate with a HTTP/2 server using OkHttp client.
Added to Maven POM:
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.2.0</version>
</dependency>
And this is my test code:
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url("https://http2.akamai.com/demo").build();
Response response = client.newCall(request).execute();
System.out.println("Protocol: " + response.protocol());
System.out.println(response.body().string());
But when I run it it prints:
Protocol: http/1.1
and
This browser is not HTTP/2 enabled.
Environment: OpenJDK 8 on Linux.
Do you need something additional? I saw something called "ALPN" but did not quite understand the concept.
ALPN is required for HTTP/2, but it isn’t available in desktop Java until JDK 9. In Java 7 and Java 8 you’ll need a hack called jetty-alpn to enable it.
(For Java 9 there’s ALPN on the platform but only in the upcoming OkHttp 3.3.)
Alternatively, you can use conscrypt with apache, jetty or okhttpclient to get ALPN support in jdk8 itself,
Security.insertProviderAt(Conscrypt.newProvider(), 1);
p.s: use conscrypt-openjdk-uber jar to include all dependencies

Unable to resolve org.openqa.selenium.WebDriverException: Specified firefox binary location does not exist or is not a real file?

We are getting "org.openqa.selenium.WebDriverException: Specified firefox binary location does not exist or is not a real file: /usr/local/bin/firefox/firefox" exception when we ran the selenium web driver code via linux
Configuration:
aws-cli/1.7.38 Python/2.7.9 Linux/3.14.48-33.39.amzn1.x86_64
Amazon ElasticBeanStalk
Already installed firefox on /usr/local/bin/firefox/firefox
when i ran firefox --version the version clearly getting displayed in the console
Mozilla Firefox 38.1.0
File pathToBinary = new File("/usr/local/bin/firefox/firefox");
FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary);
fBinary.setEnvironmentProperty("DISPLAY", ":1");
FirefoxDriver driver = new FirefoxDriver(ffBinary,pro);
xvfb is already started. (Xvfb :1 -screen 0 1280x768x24)
Please kindly help me on how to resolve the issue?
This problem occurred due to selenium library and firefox version conflict issue.

Resources