Surinder Mehra

Ranch Hand
+ Follow
since Aug 06, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Surinder Mehra

I had to change the data element syntax and it worked. Just add a function to data instead of taking values directly. Here is my working code

I have implemented server side pagination using JQuery data tables and now I want to pull records using date picker. When I select date from date picker, this value goes into search filter field not in the field  I want (dob1 in below code). How do I set value selected from date picker into ajax request after table have been initialized. I am using data-tables version 1.10

I solved it. below is my code. Note :All Objects from org.codehaus not from fasterxml except from java.time.LocalDate and Time. Hope it helps someOne

Server side configuration

Client side configarion

5 years ago
I need to convert Java 8 LocalDate in client side received from REST Service in JSON form. I read about  ParamConverterProvider, but looks like it works only for REST resource methods i.e. server side.
Is there any thing to convertt LocalDate on client side.

I tried implementing ParameterHandler<LocalDate> and registered it in jaxrs:client providers. I can see constructor is called , but not the method 'fromString'. Am I missing anything ?
Below is my implementation:

Client stub file:

Please note that I am able to fetch JSON string If I invoke resource directly from browser. SO only issue is my JavaLocalDateParamHandler "fromString" method is not called during conversion.

Does it work only on server side where REST resources(i.e. methods with diff annotations) are present
5 years ago
Hi All,
I am facing one very known issue yet no solution is working for me. Any quick help will be grateful
From MVC controller, I am calling REST service which returns me Model object with LocalDate as one of the fields.  JacksonJAXbJSONProvider  does not parse the Localdate object. I wrote custom Mapper as below And dependency is added in pom.xml

This was suggested in

My spring.xml(contains configuration for MVC controller etc...) has already one mapper configured which does conversion automatically as below

Below is stub file which connects to REST Service

Now How do I configure my Context resolver which I just wrote so that I should be able to convert LocalDate.

Where should my custom class go, in message converter or jaxrs:providers> ?

I am getting below exception

No suitable constructor found for type [simple type, class java.time.LocalDate]: can not instantiate from JSON object (need to add/enable type information?)
5 years ago
I updated the eclipse m2e plugin and it worked.

Thanks for concern. Cheers!
6 years ago
Unfortunately, POM.xml is confidential to organization and hence I will not be able to show its contents. But this error is common with maven. I saw it even in ( . This link explain it, but I did not get much from it, how do we solve it.
6 years ago

Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: ***************:jpublisher-maven-plugin:1.6:jpublisher (execution: jpublisher-generate, phase: generate-sources) pom.xml /*******-jpublisher line 54 Maven Project Build Lifecycle Mapping Problem

Guys, I am struggling with above error in eclipse. pom,xml has this error. maven build is successful. but eclipse shows erros in code. Any one has idea how to fix this without effecting maven build.

I have searched it in different forums but could not find any clear solution.

Will appreciate any help.

6 years ago
Below code throw outofBound Exception on arraylist if executed continuously(immediately)2-3 times.
I am aware that this exception can be avoided by synchronizing alterlist() methods or synchronized bocks using different objectslock1 and lock2 I have created. I want to understand why this exception is thrown. Arraylist auto increase its size when needed.

Can anyone explain what is happening behind the scene


Exception in thread "Thread-1" java.lang.ArrayIndexOutOfBoundsException: 25
at java.util.ArrayList.add(
at com.suri.threads.MultipleLocks.alterList2(
at com.suri.threads.MultipleLocks.process(
at com.suri.threads.MultipleLocks$
Time taken : 2067
List 1 size : 1013 List 2 Size : 1013
I was just going through java questions in Facebook group for Java and found below code throwing null pointer Exception. I gave an explanation below. However i want to make sure i have given correct explaination. So please review it and let me know so that i can convey the same

can anyone explain
why jvm throw NullPointerException?

My Explaination:

That is because you are recraeting instance of class A and this is not set to reference of A in class B. here is the flow of your program
1. Created instance of A in main()
2. call m1();
3. Inside m1(), created instance of Class B.
4. call m2(CURRENT instance of A)
5. set this insatnce of A to A's reference valraible a
6. Sysout and exit m2.
7. sysut in m1() and exit m1() and come back to main method
8. Create instance of B( which calls uper class constructoer and create new instance of A)
9. call m3();
10. Now m3 dont have instance of A set in a, a is null, so throw Null Pointer Exception.
11. Now how do we solve it: just call m3 with refernce var a holding instanceof A actualy,
This can be done by calling m3("msg") from m2(); and comment b.m3("prince") from main method or pass instance of A to m3() and set it to ref variable a in m3() body

Changes req any one of below:
1. comment b.m3("prince"); in main() and call from m2();
2. pass instance of A to m3() ns et it there to a e.g
b.m3("prince", newA());

Just want to make sure my explaination is correct.
7 years ago
Can anyone help me with this?
I installed glassfish server and plugin to eclipse. But when i select the server directory, its says Missing classpath entry C:\glassfish3\install\lib\appserv-rt.jar. I found the instructions on below website but all in vain

I have jdk6 installed in my system and JAVA_HOME set to C:\Program Files\Java\jdk1.6.0_29
when i run below command
java -Xmx256m -jar filename.jar

i get the error:

C:\glassfish3\glassfish\lib> java -Xmx256m -jar appserv-rt.jar
Failed to load Main-Class manifest attribute from

Please share your thoughts or link to the configuration steps would be helpful

sorry for waking the zombie, but i am little mystified of explanation of intern() quoted below ,
In the article its mentioned that "Invoking two.intern() will look for a String object referenced from the String Literal Pool that has the same value as the one you invoked the intern method upon. If one is found, a reference to that String is returned and can be assigned to your local variable.".
What if String Literal Pool does not have the same reference/value as the one we invoked on intern ???
I am trying to match the input string with range of values and getting PatternSyntaxException. below is my code

output: true

But when i try to give range in double digits, it throws exception. What if i have to match a number(as string) between 10 to 25 or like that.


Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal character range near index 5
7 years ago