Category "java"

Bad type on operand stack error when using hibernate

I am getting an error when using the hibernate. This is the stack trace:- java.lang.VerifyError: Bad type on operand stack Exception Details: Location: o

Mockito ClassCastException - A mock cannot be cast

I have a method in the class AppleProcessor which I would like to test: public void process(Fruit fruit) { if(fruit.getType() == Fruit.APPLE) { fru

How do I update an entity using spring-data-jpa?

Well the question pretty much says everything. Using JPARepository how do I update an entity? JPARepository has only a save method, which does not tell me if i

How to have placeholder for variable value in Java Text Block?

How can I put a variable into Java Text Block? Like this: """ { "someKey": "someValue", "date": "${LocalDate.now()}", } """

Cucumber cannot find StepDefinitions while running the code but manually using the option "Find Step" can find step definition

In the project Structure defined like below, src/main/java -- Config (RunCukesTest.java) -- StepDefinitions src/test/resources -- features/login When I run fro

How to use java .class file in Visual Studio Code?

I'm currently studying a Java course, and one of the assignments requires me to use (import) a class inside a .class file. I'm currently using Visual Studio Co

How does a byte[] in java actually store data

If I have the following: byte[] byteArray = new byte[] {87, 79, 87, 46, 46, 46}; I know that the size of each element would be one byte. But what I don't see

An instance of OnFlingListener already set in Recyclerview

I'm using a RecyclerView in my Android app. I've many cardviews in my RecyclerView, such that only 1 cardview is displayed to the user at a time. The user has t

How to use java .class file in Visual Studio Code?

I'm currently studying a Java course, and one of the assignments requires me to use (import) a class inside a .class file. I'm currently using Visual Studio Co

Reversing an array using a stack

I am attempting to reverse an array using a stack. However, I get an error on arr[i] = stack.top();, and the suggestion to resolve it in Eclipse is to change it

telephonyManager.listen not working after targetSdkVersion is set to 31 or android 12

After i upgrade the targetSdkVersion to 31 telephonyManager.listen is not working. Consider following line of code: telephonyManager.listen(phoneStateListener,P

No Dialect mapping for JDBC type: 1111

I'm working on a Spring JPA Application, using MySQL as database. I ensured that all spring-jpa libraries, hibernate and mysql-connector-java is loaded. I'm ru

How do I create a Jersey FormDataContentDisposition object?

I have the following method in a service: public interface MyService { @POST @Path("/upload-file") @Consumes(MediaType.MULTIPART_FORM_DATA)

The specified child already has a parent. You must call removeView() on the child's parent first (Android)

I have to switch between two layouts frequently. The error is happening in the layout posted below. When my layout is called the first time, there doesn't occu

Unable to fetch data from test rail using java

I am using the API provided by Test rail to pull info using java. Below is my program. APIClient client = new APIClient("https://test.testrail.net/index.php?/r

Unable to fetch data from test rail using java

I am using the API provided by Test rail to pull info using java. Below is my program. APIClient client = new APIClient("https://test.testrail.net/index.php?/r

Arquillian and TimerService

So I have an EJB that has a @Schedule annotated method, and I want to test it using arquillian, what I can easily do invoking the method directly, but because t

DetachCriteria paginated query returns duplicate values

I've got a paginated detached criteria execution which return rows of an entity. The entity class is as following. @Entity @Table(name="POS_T_HTL_ITEM_GROUP")

DetachCriteria paginated query returns duplicate values

I've got a paginated detached criteria execution which return rows of an entity. The entity class is as following. @Entity @Table(name="POS_T_HTL_ITEM_GROUP")

java URL working on browser but not in client program

Client JAVA Program part : try { String downloadUrl1="https://www......&downloaded=1";