• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Migration issues from Websphere portal 5.1 to Websphere portal 6.1

 
Deboshree Roy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to migrate my application from Potal 5.1 to 6.1.I used the following code used for obtaining the profile information about the currently logged in user in 5.1
String user_objid = "";
String strUser = null;
PortletServiceHome psh;
javax.naming.Context ctx = new javax.naming.InitialContext();
psh = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
if (psh != null) {
PumaHome service = (PumaHome) psh
.getPortletService(PumaHome.class);
PumaProfile pp = service.getProfile(request);
User user = (User) pp.getCurrentUser();
if (user != null) {
user_objid = pp.getIdentifier(user);

StringTokenizer strToken = new StringTokenizer(user_objid,",");
while (strToken.hasMoreElements()) {
String strUserId = strToken.nextElement().toString();
if (strUserId.indexOf("uid") >= 0) {
strUser = strUserId
.substring(4, strUserId.length());
}
}
}
}
But this code is throwing the following error in the Version 6.1
0000004c ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: /themes/html/MarshAviCertTheme/Default.jsp. Exception thrown : java.lang.ClassCastException: com.ibm.wps.um.UserImpl incompatible with com.ibm.portal.puma.User
at com.ibm._jsp._Default._jspService(_Default.java:451)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1068)
Please advise whatc changes should be done.
 
stéphanie leperck
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
here the old code which doesn't work in WP 6.0

--------------------------------------------------------------------------------
ctx = new InitialContext();
Name myjndiname = new CompositeName(PumaHome.JNDI_NAME);
PumaHome myHome = (PumaHome) ctx.lookup(myjndiname);
if(myHome!=null){
PumaProfile pumaProfile = myHome.getProfile();
com.ibm.portal.puma.User user;
user = (com.ibm.portal.puma.User) pumaProfile.getCurrentUser();
utilisateurCourant = user.getUserID();
}

--------------------------------------------------------------------------------
Here the new code which works fine in WP 6.1

--------------------------------------------------------------------------------
ctx = new InitialContext();
Name myjndiname = new CompositeName(PumaHome.JNDI_NAME);
PumaHome myHome = (PumaHome) ctx.lookup(myjndiname);
if(myHome!=null){
PumaProfile pumaProfile = myHome.getProfile();
com.ibm.portal.um.User user;
user = (com.ibm.portal.um.User) pumaProfile.getCurrentUser();
List attributes = new ArrayList();
attributes.add("uid");
Map userAttributes = pumaProfile.getAttributes(user,attributes);
utilisateurCourant = (String) userAttributes.get("uid");
}

--------------------------------------------------------------------------------
Bye.
Stéphanie.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic