Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
The trailboss has a kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic