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

WireMockHandlerDispatchingServlet is not a javax.servlet.Servlet #81

Open
imochurad opened this issue Jun 17, 2024 · 0 comments
Open

WireMockHandlerDispatchingServlet is not a javax.servlet.Servlet #81

imochurad opened this issue Jun 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@imochurad
Copy link

Proposal

I realize that this it must be some lib mismatch, cannot put a finger on what it is...

Failures (1):
  JUnit Jupiter:GrpcServiceComponentTest
    ClassSource [className = 'package.MetadataGrpcServiceComponentTest', filePosition = null]
    => com.github.tomakehurst.wiremock.common.FatalStartupException: java.lang.RuntimeException: MultiException[javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.NotMatchedServlet is not a javax.servlet.Servlet, javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet is not a javax.servlet.Servlet]
       com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:166)
       com.github.tomakehurst.wiremock.junit5.WireMockExtension.startServerIfRequired(WireMockExtension.java:163)
       com.github.tomakehurst.wiremock.junit5.WireMockExtension.beforeAll(WireMockExtension.java:228)
       org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
       org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
       [...]
       Suppressed: java.lang.NullPointerException
         com.github.tomakehurst.wiremock.junit5.WireMockExtension.stopServerIfRunning(WireMockExtension.java:216)
         com.github.tomakehurst.wiremock.junit5.WireMockExtension.afterAll(WireMockExtension.java:254)
         org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeAfterAllCallbacks$18(ClassBasedTestDescriptor.java:461)
         org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
         org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeAfterAllCallbacks$19(ClassBasedTestDescriptor.java:461)
         [...]
     Caused by: java.lang.RuntimeException: MultiException[javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.NotMatchedServlet is not a javax.servlet.Servlet, javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet is not a javax.servlet.Servlet]
       com.github.tomakehurst.wiremock.jetty.JettyHttpServer.start(JettyHttpServer.java:198)
       com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:164)
       [...]
     Caused by: MultiException[javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.NotMatchedServlet is not a javax.servlet.Servlet, javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet is not a javax.servlet.Servlet]
       org.eclipse.jetty.util.MultiException.ifExceptionThrow(MultiException.java:117)
       org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:751)
       org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:392)
       org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:901)
       org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306)
       [...]
       Suppressed: javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet is not a javax.servlet.Servlet
         org.eclipse.jetty.servlet.ServletHolder.checkServletType(ServletHolder.java:514)
         org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:386)
         org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
         org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$2(ServletHandler.java:724)
         java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
         [...]
     Caused by: javax.servlet.UnavailableException: Servlet class com.github.tomakehurst.wiremock.servlet.NotMatchedServlet is not a javax.servlet.Servlet
       org.eclipse.jetty.servlet.ServletHolder.checkServletType(ServletHolder.java:514)
       org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:386)
       org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
       org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$2(ServletHandler.java:724)
       java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
       [...]

Reproduction steps

package com.salesforce.fieldservice.metadatafeed

import com.github.tomakehurst.wiremock.client.WireMock
import com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig
import com.github.tomakehurst.wiremock.junit5.WireMockExtension
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.api.extension.RegisterExtension
import org.wiremock.grpc.GrpcExtensionFactory
import org.wiremock.grpc.dsl.WireMockGrpcService

@ExtendWith(WireMockExtension::class)
class GrpcServiceComponentTest {

companion object {
    @JvmField
    @RegisterExtension
    val wm: WireMockExtension = WireMockExtension.newInstance()
        .options(
            wireMockConfig()
                .dynamicPort()
                .withRootDirectory("src/test/resources/wiremock")
                .extensions(GrpcExtensionFactory())
        )
        .build()
}

private var mockJwtGenerationService: WireMockGrpcService? = null


@BeforeEach
fun init() {
    mockJwtGenerationService = WireMockGrpcService(WireMock(wm.port), "salesforce.cdp.authenticationservice.jwt.v1.JwtGenerationService")
}

@Test
fun dummyTest() {
    assertThat(5).isNotNull()
}

}

References

No response

@imochurad imochurad added the bug Something isn't working label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant