Collect all kinds of java programming exceptions and fault solutions.

Feign Client Throwing Unauthorized Exception for Url, where authentication is not needed

I have followed this blog and have created few microservices: Eureka-server,Auth-service,Zuul-service,Gallery-service,Image-service.
From the gallery service I wanted to invoke auth-service API using

How to trigger onPerformSync when a certain variable value changes

I'm developing an app which contains updating profile picture. What I'm doing is the following: I'm storing the user's profile URI using sharedPreferences, and when the user updates their profile i...

Find classes in package that does not implement superclass

I am using Eclipse 2019-09 (4.13.0). I have a project structure as followed.

Annotation based Auditing for spring-data-elasticsearch?

I am trying to use the annotation based approach to audit my elasticsearch document using spring-data-elasticsearch. I followed the JPA guide while implementing my classes/setup.
My code looks like

Java to Slack API: SlackError{type=MISSING_SCOPE, error=missing_scope}

I am trying Slack API for the first time and I wanted to post a chat message from a Java client. For this purpose I am using the recommended HubSpot Java client and from its examples I am trying the

Trying to setup spring boot cloud config server with ssh private key file and getting: ucom.jcraft.jsch.JSchException: USERAUTH fail

I am trying to setup spring boot cloud config server with ssh private key file and getting: ucom.jcraft.jsch.JSchException: USERAUTH fail
My file:

Parameter 0 of constructor in ... required a bean of type 'org.springframework.web.client.RestTemplate' that could not be found

I can't run my application that I learn from this link 'สร้าง-microservices-ด้วย-netflix-oss-และ-spring-cloud-2678667d9dbc'
when I run application, it shows 'Para...

Overriding print statement in java based on object class

I have the following code in Java
I am able to print the calculated values in printDistance method.
But I need the output in below format(Expected Output).Please help
3D Distance = ...

How to autogenerate a Unique ID from Immutables Criteria Library?

The advice given on Immutables site is to switch to the new Immutables-Criteria functionality. In this sense I try to convert my project so that instead of Immutables-MongoDB it uses the Immutables-

In Java, how to let child class decide of which type parameter class use as overridden method argument?

I have an abstract class in which I want to have an abstract method taking in argument a Consumer functional interface and let the child class decide which type should parameterize the consumer.
I ...

Using Aeron with RSocket

Good morning,
I am trying to use RSocket on top of the Aeron transport protocol. However, it appears that there is no documentation on the topic - did anyone successfully integrate those two

How to convert java id in form of number in a character ASCII string?

I code some TextViews programatically and I want to provide them with ids. In the xml file I would have done something like:
but in the .java file I'm allowed to set the id...

Creating a simple web application with Eclipse, Java, Gradle, Wildfly, Hibernate JPA, Spring and Angular

I've created several projects in Eclipse following online examples on how to create simple web applications with a combination of various technologies. I'm using Java 11 at the moment, Eclipse IDE (

Which package strategy use to achieve high cohesion and low coupling

My question is about achieve high cohesion but I think the next example promote low cohesion and high coupling and I would someone to explain me if this is the case or not, I am talking about the p...

Unable to invoke https REST endpoint through spring boot

I have to build a REST endpoint which is internally calling some REST Endpoints (Business Confidential) and will do some customization and give a user-specific response. Endpoints (Business Confide...

Look and feel of html page template after storing that in DOCX file with user data

I have developed an HTML and CSS web page template which looks like:
Once the user enters the data on this web page and clicks on the send button. My java application will trigger an e-mail along ...

'Cannot find symbol' when sorting a stream of files using compareToIgnoreCase (JShell)

Using JShell of java 13.0.1 on Debian Stretch:
import static java.nio.file.Files.*;
var hm=Path.of(System.getProperty("user.home"));
void p(String s) {System.out.println(s);}

HTTP Status 404 - Not found - Spring MVC and Hibernate

I am trying to run my application without using web.xml. Below is my code for webAppInitalizer
package com.restAPI.ResumeCreator.config;

Whether the Apache FTPClient.retrieveFile method creates temporary file

I am using Apache FTPClient for the Android. I download files from the server and overwrite them instead of local ones. I need to make sure that the files were downloaded correctly. Will the method

How does one compare Path equivalence in Java?

Given two Path objects p1 and p2 (that do not necessarily point to a file that exists), how do I check the underlying paths are equivalent? That is, Path objects arising from

Kafka Streams : Flushing intermediate Windowed results as commit interval and window time are not in sync

Configuration for kafka Streams:
threads = 1;
replicationFactor = 1;
ktableCommitInterval= 10000;

Maven ant task. Transitive (pom) dependencies and https issue

As you know, starting from 15 January 2020 Maven central repo requires HTTPS-only access. One of our projects is using Ant and Maven Ant Tasks (dependency management only). Yes, I know it's depreca...

Couldn't find PersistentEntity for type class debug error

I have the following piece of code that tries to insert a document object into mongoDB.
return reactiveMongoTemplate.insert(document)
.doOnSuccess(filler -> System.out.

Implement generic interface in a generic abstract class

interface Service<T>
void foo(T t);
I want to create an abstract class that implements the Service interface. I don't want to provide the implementation for T i.e. generic.

Basic spring boot app not working, showing: Failed to refresh live data from process xxxx

I am beginner for spring boot. I initialized a new project and tried to run it but it does not work successfully. WHen I run this as spring boot application, it starts execution. In bottom compiler/

RestAssured: how to iterate through JSON object and validate each value of key fields

"body": {
"format": "json",
"query": {
"attributes": [
"field": "name",
"order": "none",
"hidden": false,
"label": "Computer"

Azure - Startup command - Unable to access jarfile app.jar

I have a Java Spring Boot application which is deployed on an Azure Webservice, it's all working. What I really want to do at this moment is the following:
"java -jar

Sample routine uisng JAVA APIs for T24

Can I have a sample routine (that has been tested) on latest T24/Transact release using Temenos Java APIs?
As per Temenos, Infobasic routines cannot be used anymore if EXTENSIBLE.CUSTOMISATION flag...

Java Spring Adding or removing @Component at runtime is possible?

I have something like this.
@Component public class JohnStephen
@Component public class Guadalupe
@Component public class CristianOrtiz
@Component public class CristinaCuellar
All the

Java code to generate comma separated values and sum

While running this code I am getting ArrayIndexOutOfBoundsException.
public class Evensum {
public static void main(String[] args) {
int num = Integer.parseInt(args[0]);
int ...

JPA EntityManager.lock with H2 DB - java.sql.SQLException: Connection is closed when multiple Transactions use lock on same entity

I am implementing application where data blobs are downloaded. I want to make sure that when two download Transactions start around the same time, the first Transaction locks the data and I don't w...

How can I check whether the numbers in the array list are sequential

I want to check if numbers in an arraylist are sequential. The number in array start with 1, and for the next should be 2, 3, and 4. This means that every next element is 1 larger than the previous...

How do I use a variable from another method? (cannot find symbol - variable evenNum)

I am making a code that only prints the even numbers of an array. But I am having a problem sending evenNum variable from countEm to getAllEvens.
private static int countEm(int[] array)

Selenium Java - TestNG Data Providers using Getters and Setters

I am using Getters and Setters this within a Test Case and I am parsing an array to it. I then try to reference it later from another Test Case in a dataset controller class where I will pull the v...

What in particular restricts Quantum to one NPAPI plugin?

Firefox Quantum still supports NPAPI, but it is designed to load only the Adobe Flash Player plugin. It does not load the Java plugin or others. What in particular restricts Firefox Quantum to one ...

java.lang.NoSuchMethodError: No virtual method toString(Z)Ljava/lang/String; in class Lokhttp3/Cookie; or its super classe

I'm using retrofit (2.7.2) and OkHttp version (4.4.0) in an Android project and I'm facing a crash on a request.

AWS QLDB - Java Tutorial Step 2 (ConnectToLeger) - Unable to determine service/operation name to be authorized

I am trying to run the Java Tutorial from AWS found here:
In the first step of the guide I had to add the ...

How to display RecyclerView items after clicking on "View All" button

I am a beginner in android. I am creating an application where data will be shown through recyclerview, but I want that only some items should display in recyclerview.
However when the user clicks...

How to show localized date units in a formatted string in Java/Android?

Let's say I have a period of days:
Period p = Period.ofDays(3);
And I want to format the period with the "days" label in the string to get this string as output:
// "3 days"
...but, I want to

Can't properly hide the bottom navigation bar

I have created a drawer activity from the android studio templates and i did activate che full sticky immersive mode so that i don't always see the titlebar and the bottom navigation bar but the fa...

"Unnecessarily replacing a task that does not exist is not supported" - Error

I get this error when trying to run the code that is further below.
Unnecessarily replacing a task that does not exist is not supported. Use create() or register() >directly instead. You attem...

AzureSpringBootRequestHandler can't find function

I have a simple Spring Boot Function app with just 2 endpoints. Both produce a Exception: IllegalStateException: No function defined error with the following stacktrace:
[23/03/2020 14:16:57] 2020...

How to call methods in random order(Java JDK11)?

class Scratch {
public void meth1(){
public void meth2(){
public void meth3(){
public void meth4(){
public void meth5(){
public static void

When can I access an objects variable using object.variable?

Probably a simple question I should by now. I'm writing some code for a class and I have 1 class that I have 3 instance variables of
class LruC {
int counter
int RAM_address
boolean valid_invalid

Not able to delete in @OneToMany relationship spring data jpa

In my spring boot project, I have one LineItem entity below is the code
@Table(name = "scenario_lineitem")
public class LineItem implements Cloneable {

Verifying the number of times the method was called using Mockito?

I am new to mockito...
What I am trying to do is to use mockito and System.print out the number of times that a certain method was called...
For example,
The numer of times that the Class.doSometh...

Read file line by line and Access values from List<List<String>> for below specifications in java

The following 5 columns of character strings are stored as text file separated by tab code.
r1c1 = filename1 r1c2 = abc1 r1c3 = def1 r1c4 = ghi1 r1c5 = col51
r2c1 = filename2 r2c2 = abc2 r2c3 =

SwaggerUI doesn't show documented API properly generated by OpenApi codegen

I'm using openapi-generator-maven-plugin to generate code from YAML documentation.
openapi: 3.0.3
title: Example API Doc
description: Those are example endpoints.
termsOfService: https://

2020-04-03 20:17:46 to "yyyy-MM-dd'T'HH:mm:ss" format

Is there any way in java(java.util.* or Joda api ) to convert "2020-04-03 20:17:46" to "yyyy-MM-dd'T'HH:mm:ss"
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
.parse("2020-04-03 20:17:46")...

How to disable the "Hypersistence Optimizer" Banner when using hibernate-types-52 in Spring Boot?

I use the com.vladmihalcea:hibernate-types-52 dependency in my Spring Boot Project. And I notices that on application boot, some large log messages where added:
2020-04-09 11:43:59.535 WARN 3465 ...