JAAS – request.isUserInRole always returns false

It is because you omitted to add (for every role you use):

<role-name>your role</role-name>


in your web.xml

Two roles example:


<role-name>your role 1</role-name>


<role-name>your role 2</role-name>




Deploy on save/publish on save in Eclipse

I am using a remote Glassfish server and Eclipse published my web app every time when I saved or created any file. Publishing was very slow. I found this to disable auto deploy/publish:
1. In Eclipse menu click “Window->show view->servers”, it shows your servers.
2. RightClick on server -> Open
3. Expand tag Publishing, click on your choice and save it – ctrl+s

How to use SSL socket in Java

I have been searching for a long time how to use SSL socket in java…. we will continue soon.


 SSLContext ctx = null;
// load keystore
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
char[] password = getPassword();
InputStream in = ClassLoader.getSystemResourceAsStream(keystore);
ks.load(in, password);
// set-up SSLContext
KeyManagerFactory kmf = KeyManagerFactory.getInstance(“SunX509”, “SunJSSE”);
kmf.init(ks, password);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(“PKIX”, “SunJSSE”);
ctx = SSLContext.getInstance(“TLS”);
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);