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

Configuring testing with Jetty 12 EE10 leads to an exception #185

Open
manovotn opened this issue Mar 11, 2024 · 3 comments
Open

Configuring testing with Jetty 12 EE10 leads to an exception #185

manovotn opened this issue Mar 11, 2024 · 3 comments

Comments

@manovotn
Copy link
Contributor

I was trying to migrate (or rather reinvigorate) Weld's Jetty servlet testing and see if I can make it work with Jetty 12 EE 10.
[Note that this module has been dead for some long time so I cannot say if this worked with previous versions of jetty.]

In the end I failed to pinpoint the issue and while I think it has to be some silly misconfiguration, I wasn't able to figure this one myself.
If I run any of those tests, I can see following output and exception:

[INFO] --- surefire:3.0.0-M5:test (default-test) @ weld-servlet-test-jetty ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Mar 11, 2024 4:23:05 PM org.jboss.arquillian.container.jetty.embedded_12_ee10.JettyEmbeddedContainer start
INFO: Starting Jetty Embedded Server 12.0.7 [id:702025003]
Mar 11, 2024 4:23:06 PM org.jboss.arquillian.container.jetty.embedded_12_ee10.ArquillianAppProvider createApp
INFO: Webapp archive location: file:/home/manovotn/GitRepo/core/environments/servlet/tests/jetty/target/arquillian-jetty-temp/export1759194290394713801e810e33b-48e1-47e4-bb71-c216da9be638.war
[INFO] Running org.jboss.weld.environment.servlet.test.discovery.scope.CustomNormalScopeDiscoveryTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.026 s <<< FAILURE! - in org.jboss.weld.environment.servlet.test.discovery.scope.CustomNormalScopeDiscoveryTest
[ERROR] org.jboss.weld.environment.servlet.test.discovery.scope.CustomNormalScopeDiscoveryTest.testCustomNormalScope  Time elapsed: 0.007 s  <<< ERROR!
java.lang.IllegalArgumentException: ArquillianServletRunnerEE9 not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.

Mar 11, 2024 4:23:06 PM org.jboss.arquillian.container.jetty.embedded_12_ee10.JettyEmbeddedContainer stop
INFO: Stopping Jetty Embedded Server [id:702025003]
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   CustomNormalScopeDiscoveryTest.testCustomNormalScope » IllegalArgument Arquill...

The good part is that I can see that Jetty is being started and the deployment is created as well.
The bad part is the exception which tells me pretty much nothing - my guess was missing dependencies but the deployment that gets created actually contains the lib/arquillian-jakarta-servlet-protocol.jar which is the dep that should contains the ArquillianServletRunnerEE9 implementation. Upon further browsing, I can see in the deployment that there is the XML mentioning the servlet as well as as the servlet impl.

How to reproduce:

Here's Weld branch that has the changes and can be used to reproduce with following steps.

  • Checkout https://github.com/manovotn/core/tree/weld2784
  • cd core
  • mvn clean install -DskipTests
  • Run any of the servlet tests under Jetty; below is an example of one of them
    • mvn clean verify -Dincontainer -Dtest=CustomNormalScopeDiscoveryTest#testCustomNormalScope -f environments/servlet/tests/jetty/pom.xml
  • If you want to inspect the deployment created for given test, it's the war file under core/environments/servlet/tests/jetty/target

Versions used:

  • Arquillian is 1.8.0.Final
  • Arq. container jetty is 2.0.0.Final
  • Jetty is 12.0.7

Any thoughts on what I missed and/or misconfigured? :)

@joakime
Copy link
Contributor

joakime commented Mar 11, 2024

Why is ArquillianServletRunnerEE9 being used for EE10 testing?

@manovotn
Copy link
Contributor Author

Why is ArquillianServletRunnerEE9 being used for EE10 testing?

I think that's just unfortunate naming.
See https://github.com/arquillian/arquillian-jakarta/blob/main/protocols/servlet-jakarta/src/main/resources/org/jboss/arquillian/protocol/servlet5/v_5/web-fragment.xml
This is used even for EE10 testing as far as I can tell.

@manovotn
Copy link
Contributor Author

@joakime Indeed the same artifact is used for Jetty embedded EE9 and EE10 as can be seen from this POM - https://github.com/arquillian/arquillian-container-jetty/blob/master/jetty-embedded-12-ee10/pom.xml#L69-L72
But like I said, that's just unfortunate naming; probably should have been ArquillianServletRunnerJakarta but I don't see a reason why this wouldn't work for EE10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants