Here is the problem. I get the sessionId
with:
request.getRequestedSessionId();
However when site is opening first time it returns null. Only starting with second visit it returns session id. But I need to know from first time. Can I get it?
It's null because there is no session.
Consider instead:
request.getSession(true).getId()
which will create a session if one does not exist, then provides a unique session identifier.