2 Replies Latest reply: Jun 18, 2012 4:22 AM by Carl Wilson RSS

What's the equivalent of the UserCredentials class in the Java API?

BMCUserD

Hello,

 

In mid-tier, we have a login.jsp page.  After it authenticates, it calls another page called index.jsp.  In index.jsp, I have the following:

 

<%@ page import="com.remedy.arsys.session.*" %>

 

<%
UserCredentials creds = (UserCredentials) session.getAttribute(HttpSessionKeys.USER_CREDENTIALS);
String User = creds.getUser(); // This line causes Android 4.x to break
session.setAttribute( "UserName", User ); 


%>

 

...


We are developing a version of login.jsp and index.jsp to work with Android, as an app, wrapped with webview.  However, only Android 4.x (Ice Cream Sandwich) is having problems with the index.jsp page.  We isolated it to "creds.getUser()".  We are getting a Tomcat error, which is:

 

 

java.lang.ClassCastException: java.lang.Object cannot be cast to java.lang.String

 

What's strange is the error occured on Tomcat!  Tomcat is just serving the jsp page to the client; the jsp code is handled by Tomcat, not the Android app. And, yet, that's exactly what it seems to be doing, something I'll have to investigate, fo rsure. 

 

Anyway, either the UserCredentials class did not get instantiated correctly or completely, or there is a problem with the method, "getUser()".  We can't access these BMC remedy classes because BMC only provides compiled files; so, it's just a black-box.  However, BMC does provide the Java API.

 

Is there a way I can typecast the UserCredentials class to something equivalent in BMC's Java API?  I know the API has the ARServerUser class, but I think you need to authenticate with it.  Authenticating is NOT the issue for us.  The issue is retrieving the user's session variable using the above method causes a Tomcat error, with Android 4.x.  If I can find some way of converting the UserCredentials class to something in the API, then I'm in business.

 

Any help would be appreciated.  Thank you.