java.lang.NoClassDefFoundError: scala/collection/convert/DecorateAsScala but scala-library in pom.xml to use swagger with JBoss servlet
java.lang.NoClassDefFoundError: scala/collection/convert/DecorateAsScala but scala-library in pom.xml to use swagger with JBoss servlet
我正在将我的第一个 Swagger 描述添加到一个使用 RestEasy 构建并使用当前版本的 JBoss EAP 部署到服务器的普通工作 servlet。添加示例 pom.xml 中的许多依赖项后,包括
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.13.7</version>
</dependency>
我得到以下堆栈跟踪。请注意,我也尝试过其他版本的 scala,结果相同
1:17:18,353 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 100) MSC000001: Failed to start service jboss.deployment.unit."PamHelper.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."PamHelper.war".undertow-deployment: java.lang.NoClassDefFoundError: scala/collection/convert/DecorateAsScala
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:81)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.NoClassDefFoundError: scala/collection/convert/DecorateAsScala
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3191)
at java.base/java.lang.Class.getMethods(Class.java:1904)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.metadata.ResourceBuilder.fromAnnotations(ResourceBuilder.java:861)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.metadata.ResourceBuilder.getRootResourceFromAnnotations(ResourceBuilder.java:830)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.<init>(POJOResourceFactory.java:38)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:79)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:485)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.ResteasyDeployment.startInternal(ResteasyDeployment.java:282)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:89)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:25)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:217)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:186)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create[=11=](SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:78)
... 8 more
Caused by: java.lang.ClassNotFoundException: scala.collection.convert.DecorateAsScala from [Module "deployment.PamHelper.war" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 33 more
我从 JBoss 下讨论使用 Swagger 和 RestEasy 的帖子中获取我的依赖项,但这似乎仍然是一个依赖项问题。我没有看到另一个 Scala 依赖项 - DecorateAsScala 还需要什么其他依赖项?
scala.collection.convert.DecorateAsScala
在 Scala 2.13.7 中不存在。您可能想尝试 2.12.15。或者甚至 2.11.12,如果你 运行 遇到类似的错误。
我想知道您是否真的需要 Scala 依赖项。 None 你提到的东西似乎需要 Scala。除非您想为 Scala 使用 Swagger,但我想情况并非如此。无论哪种方式,如果它是一个传递依赖,如果你没有自己声明它,Maven 应该自动下载正确的版本。
我正在将我的第一个 Swagger 描述添加到一个使用 RestEasy 构建并使用当前版本的 JBoss EAP 部署到服务器的普通工作 servlet。添加示例 pom.xml 中的许多依赖项后,包括
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.13.7</version>
</dependency>
我得到以下堆栈跟踪。请注意,我也尝试过其他版本的 scala,结果相同
1:17:18,353 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 100) MSC000001: Failed to start service jboss.deployment.unit."PamHelper.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."PamHelper.war".undertow-deployment: java.lang.NoClassDefFoundError: scala/collection/convert/DecorateAsScala
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:81)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.NoClassDefFoundError: scala/collection/convert/DecorateAsScala
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3191)
at java.base/java.lang.Class.getMethods(Class.java:1904)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.metadata.ResourceBuilder.fromAnnotations(ResourceBuilder.java:861)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.metadata.ResourceBuilder.getRootResourceFromAnnotations(ResourceBuilder.java:830)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.<init>(POJOResourceFactory.java:38)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:79)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:485)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.ResteasyDeployment.startInternal(ResteasyDeployment.java:282)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:89)
at org.jboss.resteasy.resteasy-jaxrs@3.9.3.SP1-redhat-00001//org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:25)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:217)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.call(DeploymentManagerImpl.java:186)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create[=11=](SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create[=11=](UndertowDeploymentInfoService.java:1504)
at io.undertow.servlet@2.0.28.SP1-redhat-00001//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
at org.wildfly.extension.undertow@7.3.0.GA-redhat-00004//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:78)
... 8 more
Caused by: java.lang.ClassNotFoundException: scala.collection.convert.DecorateAsScala from [Module "deployment.PamHelper.war" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 33 more
我从 JBoss 下讨论使用 Swagger 和 RestEasy 的帖子中获取我的依赖项,但这似乎仍然是一个依赖项问题。我没有看到另一个 Scala 依赖项 - DecorateAsScala 还需要什么其他依赖项?
scala.collection.convert.DecorateAsScala
在 Scala 2.13.7 中不存在。您可能想尝试 2.12.15。或者甚至 2.11.12,如果你 运行 遇到类似的错误。
我想知道您是否真的需要 Scala 依赖项。 None 你提到的东西似乎需要 Scala。除非您想为 Scala 使用 Swagger,但我想情况并非如此。无论哪种方式,如果它是一个传递依赖,如果你没有自己声明它,Maven 应该自动下载正确的版本。