Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-128193

JasperException is thrown due to JSP compilation errors when using an OSGI module that provides it's own Spring libraries



      Initial Findings
      Liferay's JSP Compiler ends up using classes from Liferay's global Spring libraries, instead of the OSGI module's provided Spring libraries.

      This can lead to compilation failures, especially when the Spring versions don't match (e.g. Spring 3 vs 4)

      Steps to Reproduce

      1. Deploy poc-older-spring-library.war
      2. Add portlet: poc-older-spring-library to the page

      Expected Result
      The portlet is displayed without any errors and stacktraces

      Actual Result
      The portlet shows an error and a stacktraces are thrown

      Sample Stacktrace: poc-sample-stacktrace.txt

      Additional Details

      Creating: poc-older-spring-library
      Source code attached: poc-older-spring-library-src.zip

      1. Run: blade init -v 7.3
      2. Run: blade create -t spring-mvc-portlet -p poc.older.spring.library --framework springportletmvc --view-type jsp poc-older-spring-library
      3. Edit file: modules/poc-older-spring-library/build.gradle to use older Spring libraries
        • Replace version: 4.1.9.RELEASE with 3.2.18.RELEASE
      4. Edit file: modules/poc-older-spring-library/src/main/webapp/WEB-INF/views/user.jspx to add disabled attribute
        • Replace: <form:input id="${namespace}firstName" cssClass="form-control" path="firstName"/>
        • With: <form:input id="${namespace}firstName" cssClass="form-control" path="firstName" disabled="true"/>
      5. Run: gradlew build
      6. Locate compiled WAR: modules/poc-older-spring-library/build/libs/poc-older-spring-library.war

      Note: The portlet works as expected if we skip step 4

      Compile Error - Analysis
      Using the attribute disabled="true" introduces this compilation error, due to code differences between Spring 3.2.18.RELEASE vs 4.1.9.RELEASE

      The error seems to be related on not recognizing the parameter as String and expecting a boolean instead.

      This conclusion was made because the class org.springframework.web.servlet.tags.form.InputTag extends org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag and in this class there are some codes refactor regarding getter and setter, in https://mvnrepository.com/artifact/org.springframework/spring-webmvc version 3.x receives and returns String and in version 4.x receives and returns boolean, maybe here is the clue.

      For 3.2.18: spring-framework - v3.2.18.RELEASE - AbstractHtmlInputElementTag.java#L139-L145

        * Set the value of the '{@code disabled}' attribute.
        * May be a runtime expression.
       public void setDisabled(String disabled) {
        this.disabled = disabled;

      For 4.1.9: spring-framework - v4.1.9.RELEASE - AbstractHtmlInputElementTag.java#L139-L144

        * Set the value of the '{@code disabled}' attribute.
       public void setDisabled(boolean disabled) {
        this.disabled = disabled;




            summer.zhang Summer Zhang
            georgel.pop Georgel Vasile Pop
            Kiyoshi Lee Kiyoshi Lee
            Eric Yan Eric Yan
            0 Vote for this issue
            2 Start watching this issue


              2 years, 4 weeks, 3 days ago


                Version Package
                7.2.10 DXP FP12
                7.3.7 CE GA8
                7.3.10 DXP FP2
                7.4.0 CE GA1 DXP 7,4
                7.4.13 DXP GA1