Skip to content
Advertisement

Tag: java

Websphere liberty profile error: 404 SRVE0190E

What could be the reason for the error: Error 404: SRVE0190E: File not found: /SimpleServletPath I am deploying in websphere liberty profile server. I can’t reach my admin console login page I can reach my welcome page on my websphere liberty profile server but can’t do so after creating a servlet. That’s when the above 404 error comes up. There

Finding closest number to 0

I have an array of integers, and I need to find the one that’s closest to zero (positive integers take priority over negative ones.) Here is the code I have so far: Currently I’m getting a result of -2 but I should be getting 2. What am I doing wrong? Answer Sort the array (add one line of code) so

Handle optional parameters in QueryDSL

I am using QueryDSL with SpringData. I have Table say, Employee and I have created entity class say, EmployeeEntity I have written following service method As in above I commented the NPException. How to use QueryDSL for optional Parameters in QueryDSL using Spring Data? Thank you 🙂 Answer BooleanBuilder can be used as a dynamic builder for boolean expressions:

How do I convert from YAML to JSON in Java?

I just want to convert a string that contains a yaml into another string that contains the corrseponding converted json using Java. For example supose that I have the content of this yaml in a String called yamlDoc: I want some method that can convert the yaml String into another String with the corresponding json, i.e. the following code should

Add interval to a datetime

I want to achieve a similar operation in java: What’s the best approach to express this in Java given the following constraints: The datetime is a formated string. The interval is an integer. The calculated time should be also a datetime formatted string. Answer You should work with “Date” objects, which basically represent an instance in time (number of milliseconds

How to share code between two projects?

I have two Java projects called A and B. Both of them are web apps deployed as war files. I created them in Eclipse workspace separately. Project B uses a class in project A named MusicMapper. I added the project A to project B’s build path in Eclipse as suggested in this post. So now project B can compile without

Advertisement