I am running a spark job: And the command gives an error: Invalid maximum heap size: -Xmx4g –jars Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. I checked memory: So, it seems to be fine. I checked java: Then I checked in Chrome whether spark …
CompletableFuture runAsync vs supplyAsync, when to choose one over the other?
What is the rationale for choosing one over the other? Only difference I could infer after reading the documentation is that runAsync takes Runnable as an input parameter and supplyAsync takes Supplier as an input parameter. This stackoverflow post discusses the motivation behind using Supplier with supplyAsy…
Java Error: java.lang.IllegalArgumentException: Comparison method violates its general contract
I am working on a old application which was originally written in Java 6 and which was upgraded to Java 7 a couple of years ago. In this application i am using a Collection.Sort to sort a list with a custom compare method by implementing Comparator interface. Type of objects in the list are CompanySchedule wh…
AbstractMethodError when creating JdkHttpServer for JAX-RS
I’m trying to create a Java server for a REST API and following this question I used jersey’s JdkHttpServer. I imported the necessary jars (from here), but when I start the server the following error appears: My code is the following: And in PokerResource I’ve got all the paths for the API. …
Understanding Number of StreamProcessor instances created and do stream task share same streamprocessor instance?
I want to understand a little more details on the relationship between StreamThread, StreamTask and how many instances of StreamProcessor is created when we have: a source kafka topic with multiple partitions , say 6. I am keeping only ONE StreamThread (num.stream.threads=1) I am keeping a simple processor to…
Can’t configure antMatchers after anyRequest (Multiple antMatcher)
I am trying to configure Spring Security and get this following error: Caused by: java.lang.IllegalStateException: Can’t configure antMatchers after anyRequest This is my SecurityConfig class: I already tried call httpSecurityauthorizeRequests().anyRequest().authenticated() as mentioned here, still didn…
react + spring boot upload file and form data
i have a case like in my form (front end), i can fill personal data (name, address, DOB) and then i can attach multiple image. In my spring boot controller : My model wrapper : Front end (React) Code : With above example, i always encounter errors. like : java.io.IOException: Stream closed and zero attachment…
Using Spring data JPA EntityGraph with LAZY load mode for NamedAttributeNode field
I am facing with 2 problems: N + 1 query and Out Of Memory (OOM). I solved OOM by paging and lazy loading: But when I use lazy loading, N + 1 query happened. So I try to use EntityGraph as https://www.baeldung.com/spring-data-jpa-named-entity-graphs. But as my researches and local test, EntityGraph always do …
How I can specify the version of JDK for travis CI
I have the file .travis.yml generated by JHipster and I would like to use adopt open jdk 12 for travis, but I can not set it. Update alternative doesn’t work, I always see error: resetting java alternatives and second error update-alternatives: error: no alternatives for mozilla-javaplugin.so And jdk is…
Find a string in Html and get value after
I’m posting to a webpage and in my response I get a big chunk of HTML that will change next request. With groovy I’d like to find this string: var WPQ1FormCtx = {“ListData”:{“owshiddenversion”:23, …