Web base PX – Getting Agile Session Failed
Hi,
I have a Servlet which get the the information on the cookies j_username and j_password to get an Agile Session.
I have been doing this for a long time and never have this problem. I was given a new laptop and starting having this problem after setting up my Eclipse IDE.
Below is my boiler plate code:
String passWd = null;
String userName = null;
Cookie[] cookies = request.getCookies();
if (cookies !=null && cookies.length != 0)
for (Cookie cookie: cookies) {
if (cookie.getName().equals("j_username"))
userName = cookie.getValue();
else if (cookie.getName().equals("j_password"))
passWd = cookie.getValue();
}
AgileSessionFactory factory;
try {
factory = AgileSessionFactory.getInstance("http://mydomain.com:7001/Agile");
HashMap<Integer, String> params = new HashMap<Integer, String>();
params.put(AgileSessionFactory.PX_USERNAME, userName);
params.put(AgileSessionFactory.PX_PASSWORD, passWd);
IAgileSession session = factory.createSession(params);
} catch (APIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Exception:
javax.security.auth.login.LoginException: java.lang.SecurityException: User: , failed to be authenticated.
at weblogic.security.auth.Authenticate.authenticate(Authenticate.java:119)
at com.agile.api.common.WebLogicAuthenticator.login(WebLogicAuthenticator.java:74)
at com.agile.api.pc.Session.authenticate(Session.java:1155)
My Agile is 9.3.4. My Eclipse is on Windows 10 with Tomcat V8.0
This code worked fine on my old laptop with the same configuration. It also worked fine if I use actual userid and password.
params.put(AgileSessionFactory.USERNAME, userName);
params.put(AgileSessionFactory.PASSWORD, passWd);
I also made sure the client, Tomcat server and Agile servers are all on the same domain.
Anybody has experienced similar problem before or has some suggestion on trouble shooting?
Thanks,
Alex