Bug 64259 - Cannot precompile jsps with jetty-jspc-maven-plugin since 8.5.51
Summary: Cannot precompile jsps with jetty-jspc-maven-plugin since 8.5.51
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 8.5.53
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-23 15:48 UTC by Marek Neumann
Modified: 2020-03-27 12:30 UTC (History)
0 users



Attachments
Very simple maven project to reproduce (1023 bytes, application/x-gzip)
2020-03-23 15:48 UTC, Marek Neumann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Neumann 2020-03-23 15:48:43 UTC
Created attachment 37117 [details]
Very simple maven project to reproduce

Since 8.5.51 we cannot precompile jsps. We are using jspc-maven-plugin:

[WARNING] org.apache.jasper.JasperException: javax.el.ELException: Unable to find ExpressionFactory of type [# Licensed to the Apache Software Foundation (ASF) under one or more]

This is the stacktrace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.jetty:jetty-jspc-maven-plugin:9.4.24.v20191120:jspc (jspc) on project ...: Failure processing jsps
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
   at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
   at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
   at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
   at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
   at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
   at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
   at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
   at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke (Method.java:566)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failure processing jsps
   at org.eclipse.jetty.jspc.plugin.JspcMojo.execute (JspcMojo.java:278)
   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
   at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
   at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
   at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
   at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
   at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
   at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
   at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
   at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke (Method.java:566)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.tools.ant.BuildException: Generation completed with [17] errors in [43] milliseconds
   at org.apache.jasper.JspC.execute (JspC.java:1543)
   at org.eclipse.jetty.jspc.plugin.JspcMojo.compile (JspcMojo.java:347)
   at org.eclipse.jetty.jspc.plugin.JspcMojo.execute (JspcMojo.java:272)

It can be easily reproduced with a simple Maven project:

<dependencies>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jasper</artifactId>
            <version>8.5.53</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>tomcat-jasper-compiler</finalName>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-jspc-maven-plugin</artifactId>
                <version>9.4.27.v20200227</version>
                <executions>
                    <execution>
                        <id>jspc</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>jspc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <webAppSourceDirectory>${project.basedir}/src/main/webapp</webAppSourceDirectory>
                    <sourceVersion>1.8</sourceVersion>
                    <targetVersion>1.8</targetVersion>
                </configuration>
            </plugin>
        </plugins>
    </build>

With a single jsp in it, "mvn clean install" causes the error. Switching jasper to 8.5.50 solves it. Debugging revealed that the classname for the expression factory cannot be resolved, instead it tries to load the first comment from javax.el.ExpressionFactory services file in tomcat-jasper-el-8.5.53.jar:

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

org.apache.el.ExpressionFactoryImpl

Since this is reproduceable with only one dependency (tomcat-jasper) and a very minimal setup I don't know what I could change.

Thanks,
Marek
Comment 1 Marek Neumann 2020-03-27 11:53:02 UTC
I found out that adding an explicit tomcat-jasper dependency to the plugin definition solves the issue. I assume that the jetty plugin uses an older jasper compiler version which is also indicated by the error.
Comment 2 Mark Thomas 2020-03-27 12:30:19 UTC
Thanks. This is an issue for Jetty then. It looks to be related to the fixes made to the ServiceLoader lookup.