orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
514 stars 220 forks source link

ClassCastException running XForms Sandbox as servlet in Liferay #890

Open ebruchez opened 11 years ago

ebruchez commented 11 years ago

See:

https://groups.google.com/forum/?fromgroups=#!topic/orbeon/jP1rXduONRk

+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|com.liferay.portlet.PortletContextImpl cannot be cast to javax.servlet.ServletContext                                 |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/ops/xforms/xforms-server-submit.xpl                 |  72|  51|executing processor                               |
|oxf:/ops/pfc/xforms-xml-submission.xpl                   |  50|  46|executing processor                               |
|----------------------------------------------------------------------------------------------------------------------|
|Exception: java.lang.ClassCastException                                                                               |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.servlet.ServletExternalContext      |getRequestDispatcher          |ServletExternalContext.java   | 765|
|org.orbeon.oxf.xforms.submission.RequestDispatcherS|openRequestDispatcherConnectio|RequestDispatcherSubmission.ja| 236|
|org.orbeon.oxf.xforms.submission.RequestDispatcherS|call                          |RequestDispatcherSubmission.ja| 163|
|org.orbeon.oxf.xforms.submission.RequestDispatcherS|call                          |RequestDispatcherSubmission.ja| 154|
|org.orbeon.oxf.xforms.submission.XFormsModelSubmiss|runDeferredSubmission         |XFormsModelSubmission.java    | 581|
ebruchez commented 11 years ago

This is because Liferay calls portlet initialization first, and we initialize a WebAppContext with a PortletContext. Later, when getting the request dispatcher on ServletExternalContext, we get the invalid cast.