This guide provides information about the migration from Tomcat 7 to Tomcat 9. This major update might cause migration efforts on custom source projects.
To support the usage of the newest Tomcat application, several libraries were updated, which can potentially break the implementation.
Library | Old Version | New Version |
---|---|---|
com.fasterxml.jackson.core.*:* | 2.9.10 | 2.12.1 |
com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer | r136 | 20200713.1 |
io.swagger.core.v3:* | 2.0.7 | 2.1.6 |
io.swagger.codegen.v3:swagger-codegen-cli | (new) | 3.0.24 |
javax.annotation:javax.annotation-api | 1.3 | (removed) |
javax.servlet:javax.servlet-api | 3.1.0 | 4.0.1 |
javax.servlet.jsp:jsp-api | (new) | 2.2.1-b03 |
org.apache.tomcat:* | 7.0.42 | 9.0.41 |
org.codehaus.janino:commons-compiler | 3.0.6 | 3.1.3 |
org.glassfish.hk2:* | 2.5.0-b32 | 2.6.1 |
org.glassfish.jersey.*:* | 2.25.1 | 2.33 |
jakarta.annotation:jakarta.annotation-api | (new) | 1.3.5 |
jakarta.inject:jakarta.inject-api | (new) | 2.0.0 |
jakarta.ws.rs:jakarta.ws.rs-api | (new) | 2.1.6 |
jakarta.servlet:jakarta.servlet-api | (new) | 5.0.0 |
jakarta.validation:jakarta.validation-api | (new) | 2.0.2 |
Unfortunately, templates located in the "sites" folder will not longer be processed. ISML templates are code artifacts and must not be modifiable in a runtime environment. Please move and adapt templates to your application cartridges, so you can provide different templates for different application types.
To minimize the declaration for each subproject, it is possible to apply steps for all subprojects
in the root build.gradle script.
Especially the usage of the tomcat-servlet-api
instead of the javax.servlet-api
needs to be considered. Please remove the javax.servlet-api
dependencies also from the build.gradle files of all sub-projects.
It is obligatory to adapt the source compatibility to 1.8 (otherwise errors like new java.util.HashMap<>() diamond operator are not compatible with your source version).
subprojects { apply plugin: 'com.intershop.gradle.buildinfo' if(! assemblyProjects.contains(it)) { // setup source and target compatibility for isml and add default dependencies plugins.withId('com.intershop.gradle.isml') { tasks.withType(com.intershop.gradle.isml.task.IsmlCompile) { sourceCompatibility = 1.8 targetCompatibility = 1.8 jspPackage = "org.apache.jsp.${project.name}" } dependencies { compile 'com.intershop.platform:servletengine' compile 'org.apache.tomcat:tomcat-jsp-api' } } dependencies { compile 'org.apache.tomcat:tomcat-el-api' // compile 'javax.servlet:javax.servlet-api' compile 'org.apache.tomcat:tomcat-servlet-api' } } }
Dependency Scope | Old Library | New Library | Comment |
---|---|---|---|
compile | javax.ws.rs:javax.ws.rs-api | jakarta.ws.rs:jakarta.ws.rs-api | |
compile | javax.servlet:javax.servlet-api | org.apache.tomcat:tomcat-servlet-api | |
compile | javax.validation:validation-api | jakarta.validation:jakarta.validation-api | |
compile | com.intershop.platform:servletengine | (can be moved to root build.gradle, because is used for all projects with isml) | |
exclude | compile org.glassfish.jersey.core:* { | compile org.glassfish.jersey.core:* { | The Jersey client contains many other dependencies. Please verify the usage. |
exclude | compile 'org.hibernate:hibernate-validator' | compile ('org.hibernate:hibernate-validator') { exclude group: 'javax.validation', module: 'validation-api' } | |
exclude | def jerseyExcludes = { exclude group:'org.glassfish.hk2.external', module:'javax.inject' exclude group:'org.glassfish.hk2.external', module:'aopalliance-repackaged' exclude group:'org.glassfish.hk2.external', module:'jakarta.inject' exclude group:'jakarta.annotation', module:'jakarta.annotation-api' exclude group:'jakarta.validation', module:'jakarta.validation-api' } compile 'org.glassfish.jersey.core:jersey-client', jerseyExcludes | The Jersey client contains many other dependencies. Please verify the usage. |
Include the generated sources for isml-jsp-class files.
apply plugin: 'cartridge-base' apply plugin: 'com.intershop.gradle.cartridge-resourcelist' apply plugin: 'com.intershop.gradle.isml' intershop { displayName = 'Contains isml templates' packages { cartridge { srcDir(isml2classMain) } } }
After applying the changes you may receive an error message, e.g. like this:
... Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.intershop.gradle.isml'] at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:153) at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112) ... Caused by: java.lang.IllegalArgumentException: Cannot add extension with name 'isml', as there is an extension already registered with that name. at org.gradle.api.internal.plugins.ExtensionsStorage.add(ExtensionsStorage.java:38) at org.gradle.api.internal.plugins.DefaultConvention.add(DefaultConvention.java:101) ... more
The error is thrown because the plugin 'static-cartridge' applies the deprecated 'isml' object extension. This conflicts with the ISML extension just added to the build.gradle file.
In order to solve the issue, you have to add the lines to your project-wide build.gradle file:
subprojects { // disable standard (old) ISML to avoid plugin conflicts project.ext.disableStandardISML = true }
The property will disable the old ISML plugin, so the newly added plugin can be applied without conflict.
Please exclude the groups org.eclipse.jdt
and org.apache.tomcat
to avoid any class collisions and unnecessary indirect dependencies.
compile ('org.apache.tomcat:tomcat-jasper') { exclude group:'org.eclipse.jdt' exclude group:'org.apache.tomcat' }
Since ISML-templates will be translated to Java source code with source level 1.8, some code in JSP-sections might cause an unexpected runtime exception. Of particular interest is String.valueOf(...)
. As this method has multiple overloads, the version String.valueOf(char[])
can get chosen by the compiler if generics are used, even if the passed object is not a character array.
The following code would cause a ClassCastException
, which can be avoided by using a cast, e.g. (Object)dict.get("name")
:
- // causes ClassCastException because of the generic return type of <T> T PipelineDictionary.get(String key); - String name = String.valueOf(dict.get("name")); + String name = String.valueOf((Object)dict.get("name"));
With the introduction of Tomcat 9, an "external" standard Tomcat installation is no longer required to run the Intershop Commerce Management application server. The new ICM application server can be started with the main()
class in com.intershop.beehive.startup.ServletEngineStartup
.
Therefore, the former tomcat.sh was split into two parts, one for
In case your deployment is manipulating the tomcat.sh, please validate that the customization (mostly defined at deploy.gradle files) is working with the new version.
The nodemanager is responsible for observing the application servers. The default configuration contains only the "process declaration" for tomcat.sh.
The (external) Tomcat application server will not be started by default.
Note
# The list of recognized process definitions (see below). process.list=icm-as,tomcat_ext # Process definitions - (reads appserver/config/appserver0.properties and writes logfile at appserver/log/icm-as.log) process.icm-as.command=tomcat.sh appserver0 -Xms2048m -Xmx3072m -Djava.net.preferIPv4Stack=true process.icm-as.autostart=true # Process definitions - (reads appserver/engine/tomcat/servers/appserver0/conf/ and writes logfile at appserver/log/tomcat_ext.log) process.tomcat_ext.command=tomcat_external.sh appserver0 -Xms2048m -Xmx3072m -Djava.net.preferIPv4Stack=true process.tomcat_ext.autostart=true
The package "javax.xml.bind" was added to the cp.ignoredClasses property.
cp.ignoredClasses = ^com[.]intershop[.]beehive[.]runtime[.].; ^com[.]sun[.]org[.]apache[.].; ^javax[.]xml[.]namespace[.].; ^javax[.]xml[.]stream[.].; ^javax[.]activation[.].; ^javax[.]transaction[.]xa.; ^javax[.]xml[.]bind[.].
TCC is disfunctional and will be removed in ICM11.
Projects with Solr Cloud require an additional update of the Solr Cloud Connector (release 3.0.0).