Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

angad jha

+ Follow
since Dec 26, 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 angad jha

down vote
We currently have 4 Spring applications that use Spring Security Oauth2 project for authentication. The applications are REST APIs that are consumed by other internal applications in the company I work for.

Everything was working fine in the development and QA environments as we were not doing load balancing, now that we are in pre-production we are facing an issue with the load balancer (LB).

This is the workflow for this issue:

Client sends request for the oauth token
LB redirects the request to Box 1
Box 1 authenticates and returns a valid Bearer Token
Client receives the token and store it for using through the sesion
Client sends request for a service in the REST API adding the previously retrieved token to the headers
LB redirects the request to Box 2
Box 2 fails to authenticate as it does not recognize the token and returns an Invalid Credentials response
We are using an in memory user store:

<bean id="tokenStore" class="" />

Is there a way to make different boxes to share the same token store? I know there is a JdbcTokenStore that can be used to persist tokens to the db, but I would prefer to avoid persisting tokens as these applications point to a legacy database that only stores business information.

1 year ago
Hello Guys,

I need a favor in SQLite integration with java, I have configured DB with Java. Now I want to set the password in DB file.
I tried to google search but did not get any solution.

2 years ago
Hello guys

I need favor for Linkedin login integration in Spring boot application.
Can you refer me link for integration.

4 years ago
Hello guys

I'm developing upload profile pic functionality in Spring mvc application,
while upload image, it is saving in my local directory, now I set image path from local machine
it does not show image, in firebug it shows failed to load the given Url.
and my image source path looks like
<img width="100" height="100" alt="Upload Image" src="C:\test111\Desert.jpg" style="border-color: red; border: 1px solid;">

please suggest me solution why is not showing image on page,

4 years ago
Hello Guys

I have employee form and I need to submit details using ajax,
and I made submitForm method in controller, and this controller return Employee Form page and this page has other extra fields for employee,
So this is what i have done,
So i need to know how to submit form using ajax, and i dont want use json as response boby , is it possible ?

please give me solution

4 years ago

I want show data something like that
and data should be come form table.
I did like below :
for(MenuTO m: menuList){
model.addAttribute("menuList", menuList);

private void printChilds(MenuTO m){
if(m.getChilds() !=null){
for(MenuTO mmd:m.getChilds()){

Now I need to show on JSP ,
I'm using Spring MVC
4 years ago
hello guys

I need help for creating Menu and sub menu bar using table from database ,
Menu and sub menu should be dynamically add,
I'm using Spring MVC with Hibernate

4 years ago
Hello guys

I'm making an application which will use encrypt data password from iOS , Now I need to decrypt password and validate password in java server code,
So for Encryption and Decryption I'm using JNCryptor , uses link
Note : Encrypt data is working and I'm getting problem with decryptData.
Here below I shared code,

public class SecurityJNCryptor {

byte[] salt = new String("12345678").getBytes();
static final String HMAC_ALGORITHM = "HmacSHA256";
byte[] hmac = new String(HMAC_ALGORITHM).getBytes();
static String pass = "Java@123";
SecretKey decryptionKey;
SecretKey hmacKey;

public SecurityJNCryptor() throws InvalidKeySpecException, CryptorException{
AES256JNCryptor aesCiphertext = new AES256JNCryptor();
decryptionKey = aesCiphertext.keyForPassword(pass.toCharArray(), salt);
hmacKey = aesCiphertext.keyForPassword(pass.toCharArray(), hmac);


public String encriptorData(String password){
byte [] cipher = null;
String base64EncryptedData = null;
AES256JNCryptor cryptor = new AES256JNCryptor();
byte[] plaintext = "Hello , World!".getBytes();
cipher = cryptor.encryptData(plaintext, password.toCharArray());
base64EncryptedData = new sun.misc.BASE64Encoder().encodeBuffer(cipher);
System.out.println("Encrypted Data " + base64EncryptedData);

}catch(CryptorException exception){

return base64EncryptedData;


public String decryptData(String data) throws InvalidHMACException, CryptorException{
byte [] cipher = null;
AES256JNCryptor cryptor = new AES256JNCryptor();
cipher = cryptor.decryptData(data.getBytes(), decryptionKey , hmacKey);
return Base64.encode(cipher);


public static void main(String[] args) throws InvalidKeySpecException, InvalidHMACException, CryptorException {
SecurityJNCryptor decryptor = new SecurityJNCryptor();
String a = decryptor.encriptorData(pass);
String b = decryptor.decryptData(a);


while running this code I'm getting below exception.
Exception in thread "main" java.lang.IllegalArgumentException: Salt value must be 8 bytes.
at org.cryptonode.jncryptor.Validate.isTrue(
at org.cryptonode.jncryptor.AES256JNCryptor.keyForPassword(
at com.playstore.util.SecurityJNCryptor.<init>(
at com.playstore.util.SecurityJNCryptor.main(

4 years ago
Sorry for Confusion, let me explain.
actually I'm making admin page in server code , So I want value like above formate, it's not compulsory for value with WSDL.
I need only available webservices,
do you have any suggestion for getting all Available RESTful services:
on jsp page,
4 years ago
No, I'm using RESTFul webservice
JAX-RS implementation
4 years ago
Hello Guys

I need a favor regarding some functionality.
I'm making a webservice using Apache CXF, I have done also client side code for using created webservice.
Now I want shows all listed web services operations in jsp page, in server side code, using spring controller.
listed service should have some information like below:
1: Service Overview
2: SID information
4: WSDL Definition


4 years ago
Hi Guys
I'm creating a website using Spring MVC. let you know what I have done.
1: I created App, and got API Id, API version, and App Secret Code,
2: Now I configured all details in our code.
3: Login functionality is working fine and for fetching user data I'm using"; + accessToken;
Now the problem is below.
1: I'm getting only two details from graph , like {"name":"Angad Jha","id":"1004851352898414"}.but I need also other data like gender , email, date of birth etc.
2: please suggest me logout http url. and how to use logout url in java and redirect to login page.
Note: I don't want use java script FB.logout in our code.
4 years ago
Hello Guys.

I'm using Payment gateway in our Spring Application.
let you know what I have done.
1: I created two account in
2: and then we got two email id * and *
3: Now for Integration We added paypal configuration in Web.xml like below:







4: Now I made donation form in JSP page

<form action="${initParam['posturl']}" method="post">
<!-- Saved buttons use the "secure click" command -->
<input type="hidden" name="cmd" value="${initParam['cmd']}"/>
<input type="hidden" name="business" value="${initParam['business']}"/>
<input type="hidden" name="password" value="${initParam['password']}"/>
<input type="hidden" name="cert_id" value="${initParam['signature']}" />
<!-- Saved buttons are identified by their button IDs -->
<input type="hidden" name="amount" value="30"/>
<!-- Saved buttons display an appropriate button image. -->
<input type="hidden" name="cancel_return" value="${initParam['cancelurl']}" />
<input type="hidden" name="return" value="${initParam['returnurl']}" />
<input type="submit" name="Donate" value="Donation" />

5 : then When I'm donating money after login with palpay then we are getting receipt in Paypal page , but I want my page will directly redirect to my Success page with Transaction value.
but It's not happening like that. Please favour me.


4 years ago
Hello Guys

I want use free java web hosting. Is there any websites which are providing free java web hosting for some days without any cost ?.

4 years ago
Yeah Stephan I know how to work with database. Actually I have not ever created EER model. So I was asking for guidance.
by the way I got my solution with example link .
I have gotten idea, how to categorize our schema.
let me know if you have any other guidance link.

Thank Stephan.