PDA

View Full Version : XSL Transformation


Yttesen
11-10-2010, 06:14 AM
Hi,

I'm evaluating Resin 4.0.12 (we currently use 3.0.26). I have only one issue left on my list to resolve.

We have some web-applications using XML and XSLT for transformation into HTML - this is working fine with Resin 3.0.26.

These settings are used:
javax.xml.parsers.DocumentBuilderFactory: com.caucho.xml.parsers.XmlDocumentBuilderFactory
javax.xml.transform.TransformerFactory: com.caucho.xsl.Xsl

Using Resin 4.0.12 I get this exception upon transformation:

2010-11-10 06:58:22,746 ERROR 'Transformer exception'
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.AttrImpl cannot be cast to com.caucho.xml.QAbstractNode
at com.caucho.xsl.XslWriter.valueOf(XslWriter.java:93 7)
at com.caucho.xsl.XslWriter.valueOf(XslWriter.java:94 4)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl._xsl_macro_t_service_info__25(_access__xsl. java:1727)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl._xsl_macro_t_tbody__21(_access__xsl.java:16 56)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl._xsl_macro_t_table__19(_access__xsl.java:15 26)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl._xsl_macro_t_body__18(_access__xsl.java:150 5)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl._xsl_macro_t_html__16(_access__xsl.java:140 5)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl._xsl_macro_t_template__15(_access__xsl.java :1387)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl._xsl_template_data(_access__xsl.java:1373)
at _xsl._file_23a._d_23a._development._svn_22ddev._ki te._gui._web._customercare._plugins._access._acces s__xsl.applyNode(_access__xsl.java:2869)
at com.caucho.xsl.StylesheetImpl.transform(Stylesheet Impl.java:221)
at com.caucho.xsl.TransformerImpl.transform(Transform erImpl.java:440)
at com.caucho.xsl.TransformerImpl.transform(Transform erImpl.java:308)
at com.digiquant.ims.gui.web.common.external.xmlsf.Tr ansformerUtil.transform(TransformerUtil.java:100)
at com.digiquant.ims.gui.web.common.external.xmlsf.Se rvicePluginAdapter.transform(ServicePluginAdapter. java:95)
at plugins.access.AccessPlugin.transform(AccessPlugin .java:148)
at com.digiquant.ims.gui.web.common.external.xmlsf.Se rvicePluginAdapter.show(ServicePluginAdapter.java: 105)
at plugins.access.AccessPlugin.show(AccessPlugin.java :197)
at com.digiquant.ims.gui.web.xmlsf.XmlRequestHandlerB ase.displayService(XmlRequestHandlerBase.java:203)
at com.digiquant.ims.gui.web.xmlsf.XmlRequestHandlerB ase.display(XmlRequestHandlerBase.java:156)
at com.digiquant.ims.gui.web.xmlsf.XmlRequestHandlerB ase.execute(XmlRequestHandlerBase.java:119)
at com.digiquant.ims.gui.web.xmlsf.XmlPluginActionSer vlet.doPost(XmlPluginActionServlet.java:161)
at com.digiquant.ims.gui.web.xmlsf.XmlPluginActionSer vlet.doGet(XmlPluginActionServlet.java:144)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:820)
at com.caucho.server.dispatch.ServletFilterChain.doFi lter(ServletFilterChain.java:109)
at com.digiquant.ims.gui.web.extension.SessionFilter. doFilter(SessionFilter.java:98)
at com.caucho.server.dispatch.FilterFilterChain.doFil ter(FilterFilterChain.java:89)
at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAppFilterChain.java:183)
at com.caucho.server.webapp.AccessLogFilterChain.doFi lter(AccessLogFilterChain.java:95)
at com.caucho.server.dispatch.ServletInvocation.servi ce(ServletInvocation.java:287)
at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:792)
at com.caucho.network.listen.TcpSocketLink.dispatchRe quest(TcpSocketLink.java:675)
at com.caucho.network.listen.TcpSocketLink.handleRequ estsImpl(TcpSocketLink.java:637)
at com.caucho.network.listen.TcpSocketLink.handleRequ ests(TcpSocketLink.java:588)
at com.caucho.network.listen.TcpSocketLink$AcceptTask .doTask(TcpSocketLink.java:1175)
at com.caucho.network.listen.TcpSocketLink$Connection ReadTask.runThread(TcpSocketLink.java:1108)
at com.caucho.network.listen.TcpSocketLink$AcceptTask .run(TcpSocketLink.java:1142)
at com.caucho.env.thread.ResinThread.runTasks(ResinTh read.java:182)
at com.caucho.env.thread.ResinThread.run(ResinThread. java:126)


Java version used for both servers are 1.6.

Appreciate any help or suggestions.

Thanks.

Regards
Christian

Yttesen
11-29-2010, 06:08 AM
I was initialializing the 'transformer-factory' and 'document-factory' within a static initializer section.

The class load order has apparently changed between Resin 3.0.26 and 4.x. I simply did a bit of refactoring to ensure that the factories was set prior working on documents and doing transformations.

Issue resolved.