0

我正在尝试使用 Glassfish 5.0 服务器运行 Spring Boot 应用程序并收到此错误:

java.lang.InstantiationException
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:86)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4941)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5585)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:516)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:877)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:860)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2020)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1666)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:83)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:98)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:267)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:328)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:476)
    at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:382)
    at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)
    at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:303)
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:351)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
    at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
    at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:92)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:66)
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to org.glassfish.tyrus.server.TyrusServerContainer
    at org.glassfish.tyrus.servlet.TyrusServletFilter.init(TyrusServletFilter.java:97)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:226)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:82)
    ... 28 more

即使它启动正常但不能正常工作,一些以前使用 Tomcat 工作的请求不再工作,即使有适当的权限也会给出 403 错误

这是我对 Tomcat 的 pom.xml 排除,以防你想知道我是否这样做

            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

我是否需要其他配置才能使我的应用程序正常工作?

4

0 回答 0