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

Undertow: ServletContainerInitializer not loading #32625

Closed
melloware opened this issue Apr 13, 2023 · 5 comments
Closed

Undertow: ServletContainerInitializer not loading #32625

melloware opened this issue Apr 13, 2023 · 5 comments
Labels
area/undertow kind/bug Something isn't working

Comments

@melloware
Copy link
Contributor

melloware commented Apr 13, 2023

Describe the bug

Same code in 2.16.6 and 3.0.0.Final I am not seeing the output from ServletContainerInitializer.

2.x Reproducer:
quarkus-servlet-2x.zip

3.0.0 Reproducer:
quarkus-servlet-3x.zip

run mvn quarkus:dev and watch the output.

2.x you see the ServletInitializer output:
image

3.x you see nothing:
image

Expected behavior

ServletContainerInitializer initializes and log messages appear.

Actual behavior

Nothing appears to be happening

How to Reproduce?

Run mvn quarkus:dev on both attached reproducers.

Output of uname -a or ver

Microsoft Windows [Version 10.0.22621.1555]

Output of java -version

Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: C:\tools\jdk-17.0.6+10

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.0.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)

Additional information

package org.acme;

import java.util.Set;
import java.util.logging.Logger;

import jakarta.servlet.ServletContainerInitializer;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;

import lombok.extern.jbosslog.JBossLog;

@JBossLog
public class ApplicationInitializer implements ServletContainerInitializer {

	@Override
	public void onStartup(Set<Class<?>> c, ServletContext servletContext) throws ServletException {
		log.info("Checking servlet resource paths...");

		Set<String> resourcePaths = servletContext.getResourcePaths("/");
		for (String resourcePath : resourcePaths) {
			log.info("Resource: " + resourcePath);
		}
		
		if (resourcePaths.isEmpty()) {
			log.warn("NO servlet resource paths found!");
		}
	}
}
@melloware melloware added the kind/bug Something isn't working label Apr 13, 2023
@quarkus-bot quarkus-bot bot added env/windows Impacts Windows machines triage/needs-triage labels Apr 13, 2023
@melloware
Copy link
Contributor Author

Note I was just testing this bug in 3.0.0 to see behavior and its how I noticed this: #28028

@melloware
Copy link
Contributor Author

I tested on Windows and Linux and the behavior is the same on both. so this can be untagged Windows it should be marked for Undertow.

@gsmet
Copy link
Member

gsmet commented Apr 13, 2023

Did you rename your service file? It should be META-INF/services/jakarta.servlet.ServletContainerInitializer. It's probably something we need to include in the migration recipe.

@gsmet gsmet added area/undertow and removed env/windows Impacts Windows machines triage/needs-triage labels Apr 13, 2023
@melloware
Copy link
Contributor Author

Yep that was it. Closing :)

@melloware melloware closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2023
@gsmet
Copy link
Member

gsmet commented Apr 13, 2023

I created https://github.com/quarkusio/quarkus-updates/pull/29/files .

It will be in the next version of the update (I have a few other tweaks planned).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/undertow kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants