Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Migrating from WPS 6.0 to 6.1 - API related problem.txt

 
Dorothy Taylor
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I am facing problem in migrating the portlet code from WPS 6.0 to 6.1. the problem is that the conversion from page scope to portlet scope using the pageContext does not work in 6.1 for eg., if I have the following JSP in my portlet :


[tt][/tt]


I get the following error message:
Error 500: java.lang.ClassCastException: com.ibm.ws.session.HttpSessionFacade incompatible with javax.portlet.PortletSession

Can anyone please advise what is the problem and how can we fix it?

Thanks
 
Ayub ali khan
Ranch Hand
Posts: 394
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I suggest you cast to HttpSessionFacade instead of PortletSession as thats the type which is being reported in the error message.
 
Dorothy Taylor
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We cannot cast to HttpSessionFacade as well. Further pageContext.getSession() returns HttpSession. Actually the problem arises when the HttpSession is cast to PortletSession
 
Ayub ali khan
Ranch Hand
Posts: 394
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case you may have to use HttpSession itself since you do not have an option here.

Also just curious, the initial code you mentioned does nothing with psession reference.

 
Dorothy Taylor
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I guess the problem is solved. The problem is not with teh conversion of session on page scope(PageContext) to session on PortletScope. The problem is the conversion of HttpSession to PortletSession which is invalid. PageContext.getSession returns HttpSession. Till that it is fine. Now when we typecast it to PortletSession, then it fails because HttpSession does not superclass PortletSession.

Actually this will fail on WPS 5.1 or 6.0 as well since this is incorrect API usage
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic