Category "java"

How to match a string's end using a regex pattern in Java?

I want a regular expression pattern that will match with the end of a string. I'm implementing a stemming algorithm that will remove suffixes of a word. E.g. fo

Override the handleNoHandlerFoundException

I want override the Spring Boot default result when calling a not-existing route: { "timestamp": "2022-03-20T17:01:07.453+00:00", "status": 404, "er

No adapter for endpoint; Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?

I am struggling with an Spring-WS with JMS example. I set the Spring-WS and JMS wiring as per the Spring recommendations. But I kept getting following error. I

Memory leak with Mongo Java Connection

I am constructing MongoClient Connection in the below manner : public static synchronized MongoClient getInstance(String mongoDbUri) { try {

Why all the test cases are not getting passed for the below question?

The Coding Question which I am trying to solve is this. I tried to solve but not all the test cases passed I am not able to find what could be the reason? Iden

Gradle: Override transitive dependency by version classifier

One of the dependencies declared in my project has a transitive dependency on 'com.google.guava:guava:15.0'. But my application deployed on WAS/Weblogic doesn't

Round robin with failover with Apache http client

Looking the Apache HTTP components HttpClientBuilder and seeing that it has retry handler route planner backoff strategy I am wondering whether these are intend

Helidon custom interceptor

I use helidon SE 1.4.4, how can add intercepor for all response. My route is: return Routing.builder() .register(JsonSupport.create())

Convert the result of Throwable.getStackTrace() to a string that depicts the stacktrace [duplicate]

Easiest way to convert the result of Throwable.getStackTrace() to a string that depicts the stacktrace?

In Spring mvc application, @RequestBody is throwing java.io.EOFException

In the jsp i am passing the data as json,as in the controller method i am trying to map the data to Personbean object using @RequestMapping. But its throwi

Iterate the values from the List and get oldest, newest dates

I am working on spring application. I am having a LinkedHashMap<Integer, List<MyDTO>> object, in the value of the map (i.e,List<MyDTO>) I hav

Refactor foreach to for loop

I have a foreach loop in Java (simplified version here) List<String> names = getNames(); for(String name:names) { doSomething(name); } Is there an

JPA ERROR: relation does not exist

I can't figure out what I'm doing wrong. I'm learning JPA mapping to a relational DB, by following some tutorials on the web, but can't find one that is straigh

java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.base.KaptContext Android

I've been getting an error like this for days, but I couldn't find a solution. Can you please help me? What could the problem be caused by? Error : java.lang.Il

How to test email verification flow with dynamic email generation and get email data in automation?

I am facing a problem with registration and login flow where it is required to generate an email and get token for verification. I need a service which allows u

'Source code does not match the bytecode' use IDEA debug JdbcTemplate

When I debug the JdbcTemplate sourcecode use IDEA,the IDE tips me:'Source code does not match the bytecode' Screenshot: and i use mvn to manage m

How to get Time Zone through IP Address in JAVA

I want to get time zone through IP Address in JAVA. Actually i have an application which will run at the client machine. I have IP address of client machine

unable to compile conditional breakpoint missing java project context

This is a typical java maven project. The run time instance and source code are exactly the same version. I run into the same error "unable to compile condition

Drawing rectangles at an angle

What is a method in Java that draws a rectangle given the following: The coordinates of the center of the square The angle of the rectangle from vertical, in d

Inputstream.available() always returns 0

I got some stupid problem, I don't know what am i doing wrong. I wrote client and server, client is working properly. I checked that output stream works prope