Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServletListener not running after upgrade to "jakarta" servlet packages #2298

Closed
Toukite opened this issue Dec 24, 2021 · 3 comments · Fixed by #2339
Closed

ServletListener not running after upgrade to "jakarta" servlet packages #2298

Toukite opened this issue Dec 24, 2021 · 3 comments · Fixed by #2339
Assignees

Comments

@Toukite
Copy link

Toukite commented Dec 24, 2021

Environment

Liquibase Version: 4.6.2

Liquibase Integration & Version: servlet

Liquibase Extension(s) & Version: N/A

Database Vendor & Version: N/A

Operating System Type & Version: N/A

Description

We have been using an adaptation of this https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/integration/servlet/LiquibaseServletListener.java with a tomcat 8 + jdk8 web application and it was working fine.
After migrating to tomcat 10 + jdk17, webapp has been adapted to follow the breaking changes (the fact that Java EE was migrated from Oracle to the Eclipse Foundation, and that is now called Jakarta EE, which implied a changed in the libraries of the project and a renaming of all javax.xxx imports to jakarta.xxx imports)
Unfortunately, this Liquibase servlet does not like the change.

Steps To Reproduce

List the steps to reproduce the behavior.
Just try to use the https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/integration/servlet/LiquibaseServletListener.java with tomcat 10 and jdk 17

Actual Behavior

Does not compile
And if we add javax.servlet-api-4.0.1.jar to the project so that this servlet can compile, then it is not executed at startup (no issue with the other listeners of the project which run the same way)
No change in web.xml regarding this:

	<context-param>
		<param-name>liquibase.changelog</param-name>
		<param-value>liquibase/db.changelog-master.xml</param-value>
	</context-param>
	<context-param>
		<param-name>liquibase.onerror.fail</param-name>
		<param-value>true</param-value>
	</context-param>
	<listener>
		<listener-class>LiquibaseServletListener</listener-class>
	</listener>

Expected/Desired Behavior

We would like the LiquibaseServletListener to be able to run at startup using tomcat 10 + jdk17

@kataggart
Copy link
Contributor

Thanks @Toukite for the details provided here. We will take a look at this in more detail after the holiday break.

Also, wanted to make sure you knew about Liquibase Forum -- it is turning into a pretty solid resource for users and contributors.

@kataggart kataggart added this to To Do in Conditioning++ via automation Dec 27, 2021
@kataggart kataggart moved this from To Do to In discussion in Conditioning++ Dec 27, 2021
@kataggart kataggart moved this from In discussion to To Do in Conditioning++ Jan 5, 2022
@nvoxland
Copy link
Contributor

nvoxland commented Jan 6, 2022

So, it's going to take having a separate implementation of LiquibaseServletListener that uses

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
        </dependency>

instead of

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

which will mean creating an alternative LiquibaseServletListener, LiquibaseStatusServlet, and ServletConfigurationValueProvider to use jakarta.servlet.* instead of javax.servlet. *.

Since we need to support both, it will be a question of extracting base classes with the logic and then subclasses with the version-specific methods and implementations in it

@nvoxland
Copy link
Contributor

nvoxland commented Jan 6, 2022

@Toukite would you be able to test the build from #2339 to see if it works for you? I don't use Tomcat 10 enough to have a great test environment for it. You can get the build artifacts from the "Checks" tab.

You will have to change your listener class to:

	<listener>
		<listener-class>LiquibaseJakartaServletListener</listener-class>
	</listener>

@nvoxland nvoxland moved this from To Do to In discussion in Conditioning++ Jan 6, 2022
@nvoxland nvoxland changed the title ServletListener not running after upgrade to Tomcat 10 / JDK17 ServletListener not running after upgrade to "jakarta" servlet packages Mar 7, 2022
@XDelphiGrl XDelphiGrl self-assigned this Mar 9, 2022
Conditioning++ automation moved this from In discussion to Done Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants