Wrong POM dependency in javax.servlet.jsp:jsp-api:2.2

Bug #1664179 reported by Yury Zavarin
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tomcat7 (Ubuntu)
Trusty
Fix Released
High
Joshua Powers
Xenial
Won't Fix
High
Joshua Powers
Yakkety
Won't Fix
High
Joshua Powers

Bug Description

== Begin SRU Template ==
[Impact]

 * The Tomcat7 package specifies an incorrect version of the javax.servlet api. If users attempt to use the version specified, 2.2, it will fail trying to find that version as it does not exist at all.
 * Currently the version is auto filled in by @MAVEN.DEPLOY.VERSION@, which is used to fill in other fields as well. However, the API versions are not all the same and should not be specified like this.
 * The official servlet version for Tomcat 7, 3.0, was specified here: https://jcp.org/en/jsr/detail?id=315

[Test Case]

An example to test Tomcat7 on Trusty. The same instructions can apply to other releases.

Overview: Install tomcat7 and attempt to build the pom. It will fail as the built in library specifies a non-existent version of 2.2.

 * lxc launch ubuntu-daily:trusty trusty
 * lxc exec trusty bash
 * apt install tomcat7 maven-debian-helper libmaven-dependency-plugin-java libservlet3.0-java
 * wget https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1664179/+attachment/4818104/+files/pom.xml
 * mvn-debian -q generate-sources -X

[Regression Potential]

 * Users currently experiencing this issue would be expecting a SRU fix to come from us. Working around it would require changing the /usr/share/maven-repo/javax/servlet/jsp/jsp-api/2.2/jsp-api-2.2.pom to use the 3.0 version. This fix does the same thing.
 * There is the slight, albeit incredibly low chance, that someone actually has scripted something to modify the package itself and swap out @MAVEN.DEPLOY.VERSION@ to the correct value.
 * The tomcat8 package has gone away from using @MAVEN.DEPLOY.VERSION@ in favor of specifying the exact version as well to avoid this type of mismatch.

[Other Info]

Hi,

Ubuntu 16.04.1 LTS,
libservlet3.0-java=7.0.68-1ubuntu0.1

In /usr/share/maven-repo/javax/servlet/jsp/jsp-api/2.2/jsp-api-2.2.pom file that belongs to libservlet3.0-java there is the following dependency:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.2</version>
  <scope>compile</scope>
</dependency>

But there is no corresponding javax.servlet:servlet-api:2.2 in /usr/share/maven-repo. So if I try to build some Java library that depends on javax.servlet.jsp:jsp-api:2.2 with mvn-debian, I cannot do it due to wrong transitive dependency.

I've attached a test pom.xml to reproduce the bug:

ubuntu@build:~$ ls -la pom.xml
-rw-rw-r-- 1 ubuntu ubuntu 1185 Feb 13 10:12 pom.xml
ubuntu@build:~$
ubuntu@build:~$ mvn-debian -q generate-sources
find: ‘/usr/share/maven-repo/org/codehaus/plexus/plexus-compiler/*/*.jar’: No such file or directory
find: ‘/usr/share/maven-repo/org/codehaus/plexus/plexus-compilers/*/*.jar’: No such file or directory
find: ‘/usr/share/maven-repo/org/codehaus/plexus/plexus-containers/*/*.jar’: No such file or directory
[ERROR] Failed to execute goal on project yyy: Could not resolve dependencies for project xxx:yyy:pom:debian: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact javax.servlet:servlet-api:jar:2.2 has not been downloaded from it before. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
ubuntu@build:~$

I believe that javax.servlet.jsp:jsp-api:2.2 should list javax.servlet:servlet-api:3.0 as dependency, not 2.2

== End SRU Template ==

Revision history for this message
Yury Zavarin (tadam) wrote :
Revision history for this message
Joshua Powers (powersj) wrote :

Thanks for the bug report.

# Steps to reproduce
I am kind of a novice when it comes to maven and what we have in Ubuntu, so my apologies if I miss something obvious here. In a Xenial LXD container I ran the following:

> apt install maven-debian-helper libmaven-dependency-plugin-java libservlet3.0-java
> wget <your pom.xml>
> mvn-deiban -q generate-sources -X

It failed as expected with the your error message. After looking at your suggestion if I modified:
/usr/share/maven-repo/javax/servlet/jsp/jsp-api/2.2/jsp-api.2.2.pom
to point at 3.0 and not 2.2 and your build worked.

# Source
The source for that file is contained in debian/javaxpoms/jsp-api.pom and if you pull the Ubuntu source you will find that the version is set to "<version>@MAVEN.DEPLOY.VERSION@</version>". Well in debian/rules there is a stanza for setting it:

perl -p -i -e 's/\@MAVEN.DEPLOY.VERSION\@/2.2/' \
              debian/javaxpoms/jsp-api.pom

I believe you would then propose we change 2.2 to 3.0?

Changed in tomcat7 (Ubuntu):
status: New → Incomplete
importance: Undecided → High
Revision history for this message
Yury Zavarin (tadam) wrote :

> I believe you would then propose we change 2.2 to 3.0?

If you simply change 2.2 to 3.0 in debian/rules in that stanze, then it'll change the dependency on javax.el:el-api as well.

So, the dependencies should be the following:
javax.el:el-api:2.2 (same as it is now)
javax.servlet:servlet-api:3.0 (changed from 2.2 to 3.0)

You can consult the table of versions for jsp, servlet, etc. here:
http://stackoverflow.com/questions/2013879/the-ultimate-java-version-table-j2ee-java-ee-servlet-jsp-jstl

In case of libservlet2.5-java package maintainers have replaced the actual versions to "debian", so it works properly.

For the case of libservlet3.1-java everything is also fine:
https://anonscm.debian.org/cgit/pkg-java/tomcat8.git/tree/debian/javaxpoms/jsp-api.pom
(compare it with the table).

Saying more general: Tomcat always provides a compatible set of versions for jsp-api, servlet-api and el-api. So, POM dependencies within a libservletXXX-java package have to point to the corresponding versions of .jar-s that are placed in such package.

Revision history for this message
Joshua Powers (powersj) wrote :

Thanks for the table. Looking at the docs it does look like 2.2 JSP should have 3.0 servlet and 2.2 EL, therefore I believe the following changes would fix this:

diff --git a/debian/javaxpoms/jsp-api.pom b/debian/javaxpoms/jsp-api.pom
index 56271e0..e2dbf6d 100644
--- a/debian/javaxpoms/jsp-api.pom
+++ b/debian/javaxpoms/jsp-api.pom
@@ -19,7 +19,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>javax.servlet.jsp</groupId>
   <artifactId>jsp-api</artifactId>
- <version>@MAVEN.DEPLOY.VERSION@</version>
+ <version>2.2</version>
   <description>JSP package</description>
   <url>http://tomcat.apache.org/</url>
   <licenses>
@@ -43,13 +43,13 @@
     <dependency>
       <groupId>javax.el</groupId>
       <artifactId>el-api</artifactId>
- <version>@MAVEN.DEPLOY.VERSION@</version>
+ <version>2.2</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
- <version>@MAVEN.DEPLOY.VERSION@</version>
+ <version>3.0</version>
       <scope>compile</scope>
     </dependency>
   </dependencies>

Changed in tomcat7 (Ubuntu):
status: Incomplete → Confirmed
assignee: nobody → Joshua Powers (powersj)
Joshua Powers (powersj)
Changed in tomcat7 (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Joshua Powers (powersj) wrote :

@tadam I have submitted these changes to be fixed on trusty, xenial, and yakkety. I am not submitting this to be fixed on zesty because it is source only.

Once the changes are reviewed and accepted, unless I need to make any changes :), the new packages will enter the proposed pocket for final testing and acceptance and after a minimum of 7 days released. I believe I have that right, but open to correction from anyone ;)

Joshua Powers (powersj)
description: updated
Changed in tomcat7 (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Yury Zavarin (tadam) wrote :

OK, thank you Joshua.

Joshua Powers (powersj)
Changed in tomcat7 (Ubuntu Trusty):
status: New → In Progress
Changed in tomcat7 (Ubuntu Xenial):
status: New → In Progress
Changed in tomcat7 (Ubuntu Yakkety):
status: New → In Progress
Changed in tomcat7 (Ubuntu Trusty):
assignee: nobody → Joshua Powers (powersj)
Changed in tomcat7 (Ubuntu Xenial):
assignee: nobody → Joshua Powers (powersj)
Changed in tomcat7 (Ubuntu Yakkety):
assignee: nobody → Joshua Powers (powersj)
Changed in tomcat7 (Ubuntu Trusty):
importance: Undecided → High
Changed in tomcat7 (Ubuntu Xenial):
importance: Undecided → High
Changed in tomcat7 (Ubuntu Yakkety):
importance: Undecided → High
Revision history for this message
Chris J Arges (arges) wrote :

Before this can go through the SRU process, please indicate if the Zesty version of tomcat7 (7.0.75-1) already has this bug fixed (Fix Released) or is unaffected (Invalid).

Revision history for this message
Joshua Powers (powersj) wrote :

@arges because the package is source only in zesty I am marking the primary task as invalid.

Changed in tomcat7 (Ubuntu):
status: Fix Committed → Invalid
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Yury, or anyone else affected,

Accepted tomcat7 into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tomcat7/7.0.72-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in tomcat7 (Ubuntu Yakkety):
status: In Progress → Fix Committed
tags: added: verification-needed
Changed in tomcat7 (Ubuntu Xenial):
status: In Progress → Fix Committed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Yury, or anyone else affected,

Accepted tomcat7 into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tomcat7/7.0.68-1ubuntu0.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Yury, or anyone else affected,

Accepted tomcat7 into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tomcat7/7.0.52-1ubuntu0.11 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in tomcat7 (Ubuntu Trusty):
status: In Progress → Fix Committed
Joshua Powers (powersj)
description: updated
Revision history for this message
Joshua Powers (powersj) wrote :

@sru-team

Verified tomcat7 trusty (7.0.52-1ubuntu0.11) based on the test case described in the SRU template. The build completed without error. Marking as verification-done-trusty.

I will do Xenial and Yakkety once I have binaries.

tags: added: verification-done-trusty
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tomcat7 - 7.0.52-1ubuntu0.11

---------------
tomcat7 (7.0.52-1ubuntu0.11) trusty; urgency=medium

  * Fix an upgrade error when JAVA_OPTS in /etc/default/tomcat7 contains
    the '%' character (LP: #1666570).
  * Fix javax.servlet.jsp POM to use servlet-api version 3.0 instead of
    2.2 (LP: #1664179).

 -- Joshua Powers <email address hidden> Wed, 22 Mar 2017 13:42:56 -0600

Changed in tomcat7 (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Change of SRU verification policy

As part of a recent change in the Stable Release Update verification policy we would like to inform that for a bug to be considered verified for a given release a verification-done-$RELEASE tag needs to be added to the bug where $RELEASE is the name of the series the package that was tested (e.g. verification-done-xenial). Please note that the global 'verification-done' tag can no longer be used for this purpose.

Thank you!

Revision history for this message
Joshua Powers (powersj) wrote :

Marking yakkety as won't fix due to EOL status.

Changed in tomcat7 (Ubuntu Yakkety):
status: Fix Committed → Won't Fix
Revision history for this message
Mathew Hodson (mhodson) wrote :

tomcat7 in xenial-proposed failed to build.

no longer affects: tomcat7 (Ubuntu)
Changed in tomcat7 (Ubuntu Xenial):
status: Fix Committed → In Progress
tags: removed: verification-needed
Changed in tomcat7 (Ubuntu Xenial):
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.