Menu

#102 JDK 7 Compatibility Problem - ParamTag

open-works-for-me
nobody
None
7
2016-12-23
2012-02-28
Lawful
No

There seems to be a severe problem with the cewolf:param tag when running Tomcat 7 (7.0.22 x64) under JDK 7.0.3.

Extract from a huge stack trace, relevant lines are:

org.apache.jasper.JasperException: Unable to convert string "#009900" to class "java.io.Serializable" for attribute "value": Property Editor not registered with the PropertyEditorManager
at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:846)

JSP code is:

<cw:chartpostprocessor id="seriesPaint">
<cw:param name="0" value="#009900"/>
<cw:param name="2" value="#ff0000"/>
<cw:param name="1" value="#3399ff"/>
</cw:chartpostprocessor>

It does not make any difference what the parameter value exactly is, the problem occurs also when passing number (strings), eg. for the Title Enhancer. Switching back to JDK 6.026, everything works fine again.

Apparently Java 7 has Problems converting a string value to Serializable. Part of the problem may be that the setValue() method of ParamTag is overloaded, taking either a String or Serializable as a parameter. I've read somewhere that this may be forbidden by the specs, but didn't look further into this.

Unfortunately, this is kind of a showstopper bug in this scenario, as the entire page fails, and we cannot easily live without the chart postprocessors :-) Meanwhile, we'll stick to Java 6, but we cannot for long, as Oracle announced to terminate support for it in mid-2012. Any help would be greatly appreciated, as this may well also affect others, and CeWolf live charts are quite a great feature.

Discussion

  • Lawful

    Lawful - 2012-02-28
    • priority: 5 --> 7
     
  • Lawful

    Lawful - 2012-02-29

    Think I found a solution that works for me at least. Solution is to simply comment out the Serializabe variant of setValue() in ParamTag. There already is an overloaded setter taking a String value that works perfectly with JDK 7. Probably this could be changed to Object, as that is how the value is stored internally, but I didn't try. Day saved, at least :-)

     
  • Lawful

    Lawful - 2012-02-29
    • status: open --> open-works-for-me
     
  • Ulf Dittmer

    Ulf Dittmer - 2013-02-09

    I had at the time ignored this issue since you figured out a solution quickly on your on. That solution, however, is not perfect, e.g. it breaks one of the "complex" charts in the example web app. And of course it requires a code change that makes upgrading difficult.

    I have now uploaded a beta version of cewolf that I hope will address this issue, although at the cost of trivially adapting any postprocessors you may have written. I can't test it directly due to lack of access to Java 7 (it works fine on Java 6, though), but if you don't mind a little experimenting, get the cewolf-1.2.2-b1.jar from the "beta" directory and see if that fixes the problem. There's more detail about the change in the release notes on that page. Feel free to hit me with any questions.

     
  • Ben Nzewi

    Ben Nzewi - 2015-02-03

    Hello,

    We recently upgraded to JDK 1.8 from 1.6 and had this same problem: org.apache.jasper.JasperException: Unable to convert string "#FF0000" to class "java.io.Serializable" for attribute "value": Property Editor not registered with the PropertyEditorManager

    JSP Code:

    <cewolf:chartpostprocessor id="seriesPaint">
    <cewolf:param name="0" value="#FF0000"/>
    <cewolf:param name="1" value="#FFA500"/>
    <cewolf:param name="2" value="#9504AE"/>
    <cewolf:param name="3" value="#088A08"/>
    </cewolf:chartpostprocessor>

    We currently have the latest version of cewolf i.e. 1.2.4.

    Can you please advice on if you managed to verify your changes on JDK 1.7?

    Thanks

    Ben

     
  • Ulf Dittmer

    Ulf Dittmer - 2015-02-03

    Ben, judging by "JasperException", the problem may not be in cewolf, but in JasperReports: cewolf no longer uses Serializable for setting the "value" attribute. Maybe Jasper ships with an older cewolf version which is used instead? Post the full stack trace, so we can see where the problem occurs.

     
  • Adithya

    Adithya - 2015-02-03

    Hello,

    Below is the complete stack trace

    org.apache.jasper.JasperException: Unable to convert string "#FF0000" to class "java.io.Serializable" for attribute "value": Property Editor not registered with the PropertyEditorManager
    org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:873)
    org.apache.jsp.WEB_002dINF.jsp.lastrunstatus_jsp._jspx_meth_cewolf_005fparam_005f0(lastrunstatus_jsp.java:772)
    org.apache.jsp.WEB_002dINF.jsp.lastrunstatus_jsp._jspx_meth_cewolf_005fchartpostprocessor_005f0(lastrunstatus_jsp.java:729)
    org.apache.jsp.WEB_002dINF.jsp.lastrunstatus_jsp._jspx_meth_cewolf_005fchart_005f0(lastrunstatus_jsp.java:637)
    org.apache.jsp.WEB_002dINF.jsp.lastrunstatus_jsp._jspService(lastrunstatus_jsp.java:510)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

    Thanks,
    Adithya

     
  • Ulf Dittmer

    Ulf Dittmer - 2015-02-03

    I see. Ignore my comment about JasperReports, I was thrown off by "JasperException" - the Jasper in question is just Tomcat's JSP engine.

    Strange thing is, it works fine for me on Java 7, and cewolf doesn't use Serializable for parameters any more. Please download java7test.jsp.txt from https://sourceforge.net/projects/cewolf/files/beta/, rename it to *.jsp, and see what happens if you access it directly as part of your web app. You may have to change the URL in the cewolf:img tag, since your web app likely isn't called "cewolf".

    I wonder if Spring somehow interferes with this; I don't use it, so I have no idea of what interactions there might be.

     
  • jlcdev

    jlcdev - 2016-09-06

    Hi, I've been struggling with the same problem even with Java 6, which kept crashing my Web app. The cewolf jar was provided by Ulf when it was still in beta. Question is, if I upgrade to a more recent version, will it help?

    Thanks,
    Ping

    Here is the technology stack I am using:
    Server version: Apache Tomcat/6.0.45+dfsg
    Server built: Mar 16 2016 13:12:40 UTC
    Server number: 6.0.45+dfsg.0
    OS Name: Linux
    OS Version: 3.2.0-4-amd64
    Architecture: amd64
    JVM Version: 1.6.0_16-b01
    JVM Vendor: Sun Microsystems Inc.
    cewolf-1.2.1-b1.jar

    Following is the complete stacktrace:
    Sep 6, 2016 12:34:05 AM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Unable to convert string "true" to class "java.io.Serializable" for attribute "value": Property Editor not registered with the PropertyEditorManager
    at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:887)
    at org.apache.jsp.requestDetailsNew1_jsp._jspx_meth_cewolf_005fparam_005f0(requestDetailsNew1_jsp.java:2746)
    at org.apache.jsp.requestDetailsNew1_jsp._jspx_meth_cewolf_005fchartpostprocessor_005f0(requestDetailsNew1_jsp.java:2695)
    at org.apache.jsp.requestDetailsNew1_jsp._jspService(requestDetailsNew1_jsp.java:484)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:343)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:200)
    at org.apache.jsp.viewrequestdetailsnew1_jsp._jspx_meth_c_005fimport_005f2(viewrequestdetailsnew1_jsp.java:507)
    at org.apache.jsp.viewrequestdetailsnew1_jsp._jspx_meth_f_005fsubview_005f2(viewrequestdetailsnew1_jsp.java:472)
    at org.apache.jsp.viewrequestdetailsnew1_jsp._jspService(viewrequestdetailsnew1_jsp.java:170)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
    at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:355)
    at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:130)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.oda.ui.CharsetFilter.doFilter(CharsetFilter.java:46)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.corejsf.PageAccessFilter.doFilter(PageAccessFilter.java:94)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:612)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
    at java.lang.Thread.run(Thread.java:701)

     
  • Ulf Dittmer

    Ulf Dittmer - 2016-09-06

    It's generally a good idea to use the latest version. I was never able to reproduce the issue, so I'm not sure what exactly caused it. The java7test.jsp page runs fine for me on Java 8.

     
  • MC

    MC - 2016-12-23

    For what it's worth, we encountered this problem when upgrading to Java 7 with a producer's param. We were able to fix it by changing our normal parameter string to a Java scriptlet string literal.

    For example:

    From:
    <cw:param name="0" value="#009900"/>
    
    To:
    <cw:param name="0" value='<%="#009900"%>'/>
    

    It's also worth mentioning, that before making this change, not all of our instances reproduced the error. In one case, we had 2 instances on the same machine, where one would be unable to compile the JSP, and the other was fine. The above fix seems to have consistently worked around the problem.

     

Log in to post a comment.