Questions tagged [java]
Java is a high-level object-oriented programming language. Use this tag when you're having problems using or understanding the language itself. This tag is frequently used alongside other tags for libraries and/or frameworks used by Java developers.
180
questions
0
votes
0
answers
5
views
How can I determine if a Java/Kotiln/JVM (AWT / Compose multiplatform) application is running within a window manager on linux?
I am creating a desktop application using Compose multiplatform.
More specifically, using the JetBrainsRuntime
via the glue provided by jewel.
I am looking for a way to determine if my application is ...
0
votes
0
answers
5
views
Not provider of jakarta.mail.util.StreamProvider was found (not Spring Boot!)
I'm trying to migrate a JavaX.mail class to use Jakarta mail, as it's required to move from Tomcat 9 to 10. I'm receiving a message java.lang.IllegalStateException: Not provider of jakarta.mail.util....
0
votes
0
answers
6
views
KafkaConsumer is not able to process 2 million records
I am facing issue while fetching 2 million records from kafka topic through a consumer.
My requirement is to fetch the record and store those records into a Map and return that Map to other methods so ...
0
votes
0
answers
5
views
MultiPart Request Spring
How can I make a breakpoint in my api to receive a request with json + file using Spring?
I've already tried using RequestParam, RequestBody and RequestPart, but none of it worked. It works to receive ...
0
votes
0
answers
5
views
Show pdf file uploaded by user in Primefaces | Spring Boot
I have a widget to upload a file, and I want to preview the file after upload. I am using p:media tag but it is not showing the uploaded pdf file.
However, I have another widget where there is an ...
-1
votes
0
answers
8
views
GRPC python cannot modify trailing metadata of python rpc status when aborting request (StatusRuntimeException)
Tried some hours to transfer trailing metadata inside StatusRuntimeException from a python service. This is like the current code sample which apparently doesn't work since the trailing_metadata is ...
-1
votes
0
answers
7
views
Spring Boot JSON Merge Patch map properties to custom type field
In our codebase, we have a class called OptionalOrUndefined
public class OptionalOrUndefined<T> {
@Getter private final boolean defined;
private final T value;
public static <T> ...
0
votes
1
answer
22
views
Proper way to shut down a Spring Boot application after a specific unit of work is completed
I have a number of Spring Boot services that are always running that perform several different kinds of tasks. For example I have one service that is reading from an Azure Service Bus queue using ...
-1
votes
0
answers
6
views
ObservationHandler<ServerRequestObservationContext> does not expose context values to DefaultServerRequestObservationConvention
I am trying to use and extend spring boot's Observation API solution for instrumenting metrics for spring mvc http.server.requests.
I'm trying to add a custom tag, with the key duration, and a value ...
0
votes
0
answers
17
views
OpenAPI Swagger Documentation Jargons
I have configured OpenAPI documentation in my spring boot application. Everything is coming that is expected but there are a lot of jargons coming up. Only the highlighted and ticked values are ...
0
votes
0
answers
8
views
Getting AccessDenied while accessing getAllSites() method in MS Graph using Java
Getting AccessDenied error while accessing getAllSites() method in MS Graph using Java. I have taken this block of code from Microsoft Learn. When I tried to execute this code, I'm receiving Access ...
-2
votes
0
answers
33
views
Exception in thread "main" java.time.format.DateTimeParseException: Text '04-Sep-2023' could not be parsed at index 3 [duplicate]
below is the datetimeformatter
DateTimeFormatter dtf2 = new DateTimeFormatterBuilder().parseCaseInsensitive()
.append(DateTimeFormatter.ofPattern("dd-MMM-yyyy")).toFormatter()...
-1
votes
1
answer
36
views
Stream anyMatch accept an method reference not implement Predicate [duplicate]
Stream.anyMatch is defined as:
boolean anyMatch(Predicate<? super T> predicate)
I created a new Class as follows:
class ClassA {
public boolean anyMethodName(Object o) {
return ...
-1
votes
0
answers
10
views
Trouble streaming non-local Google Photos video without downloading
I'm making an app where the user can select a video from the gallery and launch it later using their default viewer.
My initial attempt looked like this
Intent intent = new Intent();
intent.setType(&...
0
votes
0
answers
5
views
Java API only partially available with Frida aarch64
I tried to attach with Frida to Java process run on aarch64 Linux (not Android)
I got that error:
using frida-server-16.4.3-linux-arm64
[Remote::PID::1234 ]-> Java.enumerateLoadedClasses();
Error: ...
-3
votes
0
answers
46
views
Why Can't Characters Be Converted to Operators at Runtime?(java) [closed]
While learning Java, I wondered if there was a way to take an operator as a character input and use it directly in calculations. I realized that without using if or switch statements, there is no way ...
0
votes
1
answer
38
views
How do you assess code for problems handling leap seconds (particularly Java)? [duplicate]
We recently got notice that there may be a negative leap second at the end of the year and we need to determine how it will affect our programs (we write mostly java programs). I've done some ...
0
votes
0
answers
15
views
cannot access class com.sun.tools.javac.api.JavacTrees (in module jdk.compiler)
I have customized an annotation handler using java21. The pom file of the project where the annotation processor is located is shown below:
<project xmlns="http://maven.apache.org/POM/4.0.0&...
0
votes
0
answers
11
views
Android - BillingLogger: Skipped logging since initialization failed
Testing out in app purchases with the following:
purchasesUpdatedListener = new PurchasesUpdatedListener() {
@Override
public void onPurchasesUpdated(BillingResult billingResult, List<...
0
votes
0
answers
32
views
Why is a clean Maven project in Netbeans not running
I am setting up a local instance to run a Java webapp. It's been a while since I've done this but I've done it in the past. So far what I've done is installed JDK 22.0.2 and Netbeans 22 on my local ...
0
votes
0
answers
9
views
Hide page count from the go to section of the pdf toolbar when pdf is opened in browser
From java side I am converting tiff images to PDF like below.
Rectangle pagesize = new Rectangle(maxWidth, maxHeight);
Document document = new Document(pagesize);
PdfWriter.getInstance(document, ...
-1
votes
0
answers
13
views
Springboot quickstart project always gives same error no matter what I do; Could not determine the dependencies of task ':bootRun' [duplicate]
error in question:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':bootRun'.
> Could not resolve all dependencies for configuration ':...
0
votes
0
answers
13
views
OkHttp Response doesn't have provided body object on the client side
I am writing REST APIs using okhttp library in Spring Boot. I have my OkHttpClient requesting a GET request(client) from another API(server). Both the client and server uses OkHtttp libraries, so I ...
-1
votes
0
answers
8
views
WebClient static mock is not working the second time is called in a test
I have the next static mock:
try (MockedStatic<WebClient> webClientStatic = Mockito.mockStatic(WebClient.class)) {
webClientStatic.when(WebClient::builder).thenReturn(...
-1
votes
1
answer
17
views
Upload an Excel sheet with huge number of records to a MySql database in the form of a JSON
I have a requirement in Spring Boot project, where I have a huge Excel file with 15-20 sheets, each sheet containing 30,000 rows with an average of 15 columns in each sheet.
My Database is roughly as ...
0
votes
0
answers
6
views
Flink GlobalWindow Trigger only process the trigger event
I have datastream keyby by an event property, that is then passed to a globalwindow, trigged when a specific event comes in, the issue is that when the window is trigged to process the events, it only ...
-1
votes
1
answer
26
views
Spring RestTemplate - How to remove `client_secret` from the logs?
My backend application currently leaks client_secret inside my log file. I would like to keep the log level of DEBUG except for the RestTemplate where I don't want this line to be executed.
The log ...
-2
votes
0
answers
19
views
Using a Bean method result in a static context [closed]
I've got a class:
public class SomeBean {
public String getSomeValue() {
return "result";
}
}
I am using this class as a bean:
@Configuration
public class ...
-13
votes
0
answers
63
views
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8ed191184, pid=51412, tid=0x0000000000009a34 [closed]
I am writing protection for the maincraft cheat in the form of a native and when I added lazy importer I started having such errors
# A fatal error has been detected by the Java Runtime Environment:
#
...
-1
votes
0
answers
19
views
How to Automate Adding Global Libraries in IntelliJ Idea
I'm working on client's Java 8 application in IntelliJ IDEA that requires adding / re-adding two JAR files as Global Libraries to every component in the project after every code change. (Yes, this is ...
-1
votes
0
answers
14
views
How to display image from USB camera on old android?
Short question: I'm making an app for android 4.2.2, to display image from USB camera on tablet. The picture is not displayed. Can you please explain why? Thanks!
(below is a link to the source code)
...
-1
votes
0
answers
11
views
Can't download files content-disposition inline with a POST request from my app after activating CORS on a spring boot 3 application on Chrome/Edge
I'm currently working on a java spring boot (3.2) application with Spring MVC and secured with Spring security.
I wanted to add a CORS configuration on my app but this add a bug on downloading files ...
-1
votes
0
answers
25
views
Memory issues after upgrade to Spring boot 3, Java 17 [closed]
We recently upgraded our application from Spring boot 2.2, Java 11 to Spring boot 3.2 Java 17. After the upgrade we observed that the memory progressively increases and then goes down to zero and it ...
1
vote
1
answer
11
views
OpenCV ArUco marker detection in Java does not work
I was working on a project where I have to detect ArUco markers in the images captured by the webcam. I was following the documentation until I found out that Java implementation of OpenCV ArUco ...
0
votes
0
answers
17
views
PanacheEntity record update works only once
I am learning qurkus and I have a problem that I can't update a record in the db more than once.
I use merge() to update my records:
@WithTransaction
public Uni<User> update(User user) {
...
0
votes
0
answers
15
views
Java orc-tools-2.0.1 can't use this version
I saw new version of hadoop and orc-tools libraries, so I decided to update my project.
There are my new libraries:
implementation group: 'org.apache.hadoop', name: 'hadoop-hdfs', version: '3.4.0'
...
0
votes
1
answer
15
views
Validation Problem For Request Class in Spring
In the application, I have an entity class named "Car" and a request class named "AddCarRequest" from which I will get information about that class via user input.
@RequestMapping(&...
0
votes
1
answer
19
views
Spring controller and processing of parameter string as an array of strings
I encountered this problem. I have a simple spring REST controller that has a get method, it should process a request like this http://localhost:8080/test/get?params=["param1", "param2&...
0
votes
1
answer
37
views
Make RGB java.awt.Color lighter
Can I take a java.awt.Color, turn it into a HSL color, and make it a notch lighter or darker — that is, increase or decrease the L value by, say ten points (obviously, within the 0 to 100 range)?
If ...
-3
votes
0
answers
19
views
* What went wrong: Value 'C:Program FilesJavajdk-17.0.12' given for org.gradle.java.home Gradle property is invalid (Java home supplied is invalid) [closed]
What platform(s) does this occur on?
Android
Where did you reproduce the issue?
in a development build
Summary
I'm facing an issue creating an Android development build using EXPO. After updating ...
0
votes
0
answers
13
views
Android, Java + Goople Map: Straight routes useless. Is it possible to eliminate them?
Video of problem
Straight routes useless. Is it possible to eliminate them? there are straight lines that i wouldn't want.
Input from rest_api it's a simple json in this link:
https://drive.google.com/...
-3
votes
0
answers
15
views
Basic auth to get token in spring security oauth2
So i have migrated my token service from spring 2.4.5 to 3.2.3, there are many changes in spring security, i'm refactored my SecurityConfiguration, UserDetailsService etc, but i have a problem with ...
0
votes
0
answers
7
views
Question: How to Create a Custom WireGuard Client App Using Java in Android Studio?
I am trying to create a custom WireGuard client app using Java in Android Studio. I'm using the com.wireguard.android:tunnel library available on Maven Central. Here are the steps I've followed so far:...
0
votes
0
answers
26
views
Is there a way to change the Java SDK depending on the git branch on Intellij IDEA?
Im new to Intellij IDEA. On my git project I use branches for different version (minecraft modding) and for example version1 is using JDK 17 and the second one JDK21.
When I switch between branches I ...
-1
votes
1
answer
11
views
How to action update expression
I'm using the AWS Java SDK v2 with UpdateExpression so that I can update an item without having to retrieve the item from DynamoDB.
I've managed to build the update expression but now I don't know how ...
-1
votes
0
answers
24
views
Are RMap `getMap`, `putAll`, `put`, `remove` operations atomic & threadsafe?
We are using Redisson library for Redis and we are utilizing Hash data structure to store an object with different properties.
We have 2 Kafka listeners, which listen for incoming messages, and store ...
0
votes
0
answers
26
views
How to catch the PSQLException exception? [closed]
How to catch the **PSQLException ** exception? I am using Spring boot JDBCTemplate and it can throw a PSQLException exception. Using try-catch, I get this message from IDEA: "Exception 'org....
-2
votes
0
answers
11
views
How to get Last element in the redis elasticache if the highest score is not known? Also, how to get limited number of elements in a particular range?
I am trying to get the element with highest score in redis elasticache.
some documentation states that, this can be done by using 2 methods-
jedis.zrangeByScoreWithScores(key, min, max);
jedis....
-1
votes
1
answer
41
views
Best Practices for Validation in a Spring Boot Application [closed]
In my Spring Boot application, I have encountered a scenario where multiple services interact with each other, and objects passed between them need to be validated. Currently, I am using @Valid in the ...
0
votes
0
answers
22
views
excelWB.write(fileOut); gives IllegalArgumentException
I am trying to use an excel to write the into new file using Apache POI. This is the method code,
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import ...