Category "java"

Axon Framework: Aggregate Autowired Bean throws NullPointerException in Test

Springboot and Axon: Basically I am unit testing an aggregate that uses three different ObjectMapper instances, each with a different configuration. These are d

How do I take the users input and have the program loop that many times for a for loop? [closed]

How do I take the user's input for how many legs are on the trip and have it loop that amount of times? int counter = 0; int gas = 0

Java For Loop Repeating Sequence Triangle Program

Can someone help me write the program in Java that prints the following triangle? I'm having trouble coming up with a solution. Example User input: Enter increm

Using nested Quarkus tests with different test profiles

I want to create a test case for a class Foo. That class Foo gets an instance of Bar injected; however, there are different implementations of Bar, and the deci

No context error in Java, but the context is set immediately after window creation [closed]

I'm trying to make a game using LWJGL 3, but I get this error: No context is current or a function that is not available in the current contex

Dynamic JFreeChart for custom X-Axis values

I make a JFreeChart for displaying values from serial port. It is working well, but I want to make X-axis movable from right to left. It means when plotting the

Is there an expiring map in Java that expires elements after a period of time since *first* insertion?

I tried looking at cache mechanisms, such as Guava's Cache. Their expiration is only since last update. What I'm looking for is a data structure that stores ke

How to split a readLine but dont split values inside apostrophes?

Example txt file ADD 'Cordless Screwdriver' 30 1 2 COST 'Multi Bit Ratcheting' FIND 'Thermostat' FIND 'Hand Truck' SELL 'Hammer' 1 QUANTITY 'Paint Can' FIRE 'Jo

How do I capture the time a tcp socket is moving from ESTABLISHED TO WAIT state

I have a Java WebSocket server that uses Netty to establish WebSocket connections. This is basically a chat application where a few agents will be interacting w

Best way to convert a List<Object> to List<Object.Property>

Consider the following use case: I have List<Song> which holds an ArrayList. I want to translate the above on-the-fly to List<String> which may be a

Parentheses around data type?

I am a beginning programmer and came across this in my textbook: public boolean equals(DataElement otherElement) { IntElement temp = (IntElement) otherElem

Searching data in the JTable using

I have a table that I post with a database connection. I am searching the table, but after searching, selecting the row and bringing the result to the textbox r

Binary tree not clearing with each loop iteration

I am using a binary tree to convert prefix expression into infix, and then solving them. That part works fully. My issue is the input loop I set up is adding on

How to fix 'java.lang.NoClassDefFoundError: org/springframework/validation/annotation/ValidationAnnotationUtils' In Spring MVC

I have Spring MVC application with JSP and the server is Tomcat. when I run this web application. Tomcat log as follows. 24-Feb-2022 16:13:16.054 SEVERE [http-n

Firebase functions deploy errors

I've deployed firebase deploy in cmd console. but error has occured several times. I already tried these things: Changing %RESOURCE_DIR% in firebase.json file T

Wildfly 26 elytron security domain config is not working

I am trying to migrate an application to wildfly 26, and i am trying to use elytron to secure the application. I successfully run this commands using the jboss

Can a custom serializer/deserializer be a Spring bean?

I have a field in a POJO which needs to be encrypted before being serialized and, similarly, decrypted upon deserialization. The issue is that a cryptor is a Sp

What is the meaning of the construction in array initialization?

I was solving tasks and saw a construction like that: String t[] = new String[n], e; Can you help me, what does ", e" mean? Wasn't able to find something about

How can I create a truststore from a base64 encoded String?

I have a String that is encoded in base64, I need to take this string, decode it and create a truststore file, but when I do that, the final file is not valid.

How to wait until file is downloaded and also wait until the file is deleted from folder in Selenium Java

Have to download a file in multiple formats xls, pdf, rtf, csv, txt. But I have to check all these file formats are downloaded one after another So I have writt