Category "java"

Manage unique fields insertion with hibernate

I'm working on a JAVA project and need to insert an entity in my DB using Hibernate but the fields need to be inserted only once. I have this ProjectEntity clas

Restrict a class for creating second object in java

Is there a way where we can restrict a class to create only a single object in java? It should give some exceptions if we try to create another new object. Exam

Why can't I use Gradle DSL in apply'ed files

In our team we have lot of projects built with Gradle. Some parts in the Gradle files are all the same. For example, we use Java 11 in all our projects. So my i

Unable to save the screenshot in Selenium using Robot class

When I try to take screenshot using the Robot Class. I'm getting javax.imageio.IIOException: Can't create an ImageOutputStream! error: Code Snippet: public

JAXB unmarshalling - reader cannot be null

I want to retrieve some data from JMS, filter them and send them to REST server. When I unmarshal those data I get an error: java.lang.IllegalArgumentException

Why do not work @Validated in spring boot 2.6.2

I have in my pom file: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validati

How to calculate the distance between GeoPoint and Polyline

Suppose i have: GeoPoint p = new GeoPoint(10.08, 11.09); //(lat, long) and a Polyline (a sequence of Geopoints) ArrayList<GeoPoint> waypoints = new Arra

`RUN ./gradlew build -x test` command error

I have been trying to install conductor using docker but I have been constantly getting errors. I tried using [https://github.com/Netflix/conductor/tree/main/do

I am getting an error "Failed to parse the JSON document", I have used JsonPath

//Get place { String getPlaceResponse = given().log().all().queryParam("key", "qaclick123").queryParam("place_id", placeId ) .when().get(

How to call an activity method from a fragment?

I need to call a method that is in an activity from a fragment , i can't even instatiate the activity in the fragment , I don't know how to approach this proble

How to call an activity method from a fragment?

I need to call a method that is in an activity from a fragment , i can't even instatiate the activity in the fragment , I don't know how to approach this proble

How to detect what the content on the display is?

I have an app that rotates other apps. It uses an accessibility service so I have the ability to retrieve screen content. Say I'm rotating a game called Geometr

Eclipse freezes while showing hover suggestions like method suggestions in class, method info etc

When I enter a dot operator after entering the class name, Eclipse will show method suggestions auto complete, at that time Eclipse hangs and gets closed automa

httpclient5 jdk8(1.8.0_292) CloseableHttpAsyncClient Received fatal alert: protocol_version but CloseableHttpClient works well

httpclient5 async code: HttpContext httpContext = new BasicHttpContext(); BasicCookieStore cookie = new BasicCookieStore(); httpContext.setAttribute(HttpClientC

How to stop listening in a Spring Kafka consumer?

I use Spring for Apache Kafka. I'd like to stop listening to my topic and wait to escape OOM. How can I do it?

How to update few fields in JSON file and again read the JSON with updated values in selenium using Java

How to update few fields in JSON file and again read the JSON with updated values in selenium using Java. Below is my JSON : I want to update { "DemoFileJson

How to resolve: antlr.CommonToken cannot be cast to antlr.Token?

I have just finished an update from wildfly 9 to 23 and am now re-working my arquillian implementation to work with the new application server version. Dependen

Hadoop Streaming Job showing error /bin/java : No such file or directory

I have installed Hadoop in my Macbook M1 2020 with MacOS Monterey 12.3.1. I am able to successfully use hadoop and hdfs commands in my Laptop. I started using h

Logback-classic 1.2.8 DBAppender Missing

I'm trying to upgrade the logback-classic library from version 1.2.3 to 1.2.8. The patch notes say that all DB related code has been removed, so the main DBAppe

High CPU usage when shifting from Java 8 to Java 11 with G1GC

We are having following VM settings for our server. This configuration works perfectly when running Java 8. But when we switch JVM to Java 11 OpenJDK, the serve