java—尝试在GlassFish5.0上运行spring引导应用程序

rlcwz9us  于 2021-07-16  发布在  Java
关注(0)|答案(0)|浏览(295)

我试图使用glassfish 5.0服务器运行spring引导应用程序,但出现以下错误:

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>

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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题