当前位置: 首页 > 知识库问答 >
问题:

从java 8迁移到11-jaxws-rt

殳自怡
2023-03-14

我已经从Java8迁移到Java11,我发现一些Java EE库不推荐使用,我不得不使用一些第三方依赖。

所以我将这些依赖项添加到maven pom.xml中

<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
</dependency>
<!-- JAXWS for Java 11 -->
<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>${com.sun.xml.ws.jaxws-rt.version}</version>
    <type>pom</type>
</dependency>
<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>rt</artifactId>
    <version>${com.sun.xml.ws.jaxws-rt.version}</version>
</dependency>

其中变量中的版本为2.3.2。但当我开始构建时,有很多类似的警告

编辑:

编辑2:

在我从两个QueryDsl工件(apt和jpa)中排除了inject依赖之后,我无法安装。下面是我得到的错误:

[ERROR] execute error
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/inject/Inject
    at java.util.concurrent.FutureTask.report (FutureTask.java:122)
    at java.util.concurrent.FutureTask.get (FutureTask.java:191)
    at com.mysema.maven.apt.AbstractProcessorMojo.execute (AbstractProcessorMojo.java:346)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/inject/Inject
    at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions (JavacTaskImpl.java:163)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:100)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:94)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:72)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: javax/inject/Inject
    at com.querydsl.codegen.AbstractModule.createInstance (AbstractModule.java:116)
    at com.querydsl.codegen.AbstractModule.get (AbstractModule.java:86)
    at com.querydsl.apt.DefaultConfiguration.getTypeMappings (DefaultConfiguration.java:410)
    at com.querydsl.apt.AbstractQuerydslProcessor.process (AbstractQuerydslProcessor.java:86)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor (JavacProcessingEnvironment.java:980)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs (JavacProcessingEnvironment.java:896)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run (JavacProcessingEnvironment.java:1222)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing (JavacProcessingEnvironment.java:1334)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations (JavaCompiler.java:1258)
    at com.sun.tools.javac.main.JavaCompiler.compile (JavaCompiler.java:936)
    at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0 (JavacTaskImpl.java:104)
    at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions (JavacTaskImpl.java:147)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:100)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:94)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:72)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.inject.Inject
    at java.net.URLClassLoader.findClass (URLClassLoader.java:471)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:588)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:521)
    at com.querydsl.codegen.AbstractModule.createInstance (AbstractModule.java:116)
    at com.querydsl.codegen.AbstractModule.get (AbstractModule.java:86)
    at com.querydsl.apt.DefaultConfiguration.getTypeMappings (DefaultConfiguration.java:410)
    at com.querydsl.apt.AbstractQuerydslProcessor.process (AbstractQuerydslProcessor.java:86)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor (JavacProcessingEnvironment.java:980)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs (JavacProcessingEnvironment.java:896)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run (JavacProcessingEnvironment.java:1222)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing (JavacProcessingEnvironment.java:1334)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations (JavaCompiler.java:1258)
    at com.sun.tools.javac.main.JavaCompiler.compile (JavaCompiler.java:936)
    at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0 (JavacTaskImpl.java:104)
    at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions (JavacTaskImpl.java:147)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:100)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:94)
    at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:72)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:834)
...
Failed to scan [file:/C:/Users/USER/.m2/repository/com/sun/xml/ws/jaxws-rt/2.3.1/javax.annotation-api.jar] from classloader hierarchy
Failed to scan [file:/C:/Users/USER/.m2/repository/com/sun/xml/ws/jaxws-rt/2.3.1/javax.jws-api.jar] from classloader hierarchy
Failed to scan [file:/C:/Users/USER/.m2/repository/com/sun/xml/ws/jaxws-rt/2.3.1/jaxb-api.jar] from classloader hierarchy
ailed to scan [file:/C:/Users/USER/.m2/repository/com/sun/xml/ws/jaxws-rt/2.3.1/jaxws-api.jar] from classloader hierarchy
Failed to scan [file:/C:/Users/USER/.m2/repository/com/sun/xml/ws/jaxws-rt/2.3.1/javax.xml.soap-api.jar] from classloader hierarchy
Failed to scan [file:/C:/Users/USER/.m2/repository/com/sun/xml/ws/jaxws-rt/2.3.1/FastInfoset.jar] from classloader hierarchy
...
...
Failed to scan [file:/C:/Users/USER/.m2/repository/org/glassfish/ha/ha-api/3.1.9/asm-all-repackaged.jar] from classloader hierarchy
Failed to scan [file:/C:/Users/USER/.m2/repository/org/glassfish/ha/ha-api/3.1.9/hk2-api.jar] from classloader hierarchy
Failed to scan [file:/C:/Users/USER/.m2/repository/org/glassfish/ha/ha-api/3.1.9/osgi-resource-locator.jar] from classloader hierarchy
...

共有1个答案

宇文飞羽
2023-03-14

Tomcat Servler Jar扫描出现问题

通过添加包含禁用扫描清单的tomcat配置的bean来解决问题

@Bean
public TomcatServletWebServerFactory tomcatFactory() {
    return new CustomTomcatServletWebServerFactory();
}

static class CustomTomcatServletWebServerFactory extends TomcatServletWebServerFactory {

    @Override
    protected void postProcessContext(Context context) {
        ((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
    }
}

bean也可以是非静态的,但如果您使用management.server.port属性(用于Spring Boot Admin应用程序等),则必须使Tomcat配置为静态的。

server.tomcat.additional-tld-skip-patterns=*.jar
 类似资料:
  • 我正在尝试将我的应用程序从Java8迁移到OpenJDK11。 在JDK 11中很少缺少导入。例如,我找不到以下导入 但是当我尝试为(w3c dom.jar)添加外部jar时,我们得到了以下错误 包组织。w3c。可以从多个模块访问dom:,java。xml 与上面一样,所有导入都会发生相同的错误 软件包org.xml.sax可从多个模块访问:、java.xml 请就上述错误提出您的看法。

  • 问题内容: 我们的Oracle数据库遇到了严重的性能问题,我们想尝试将其迁移到基于MySQL的数据库(直接使用MySQL,或者最好是Infobright)。 问题是,在我们实际上不知道新数据库的所有功能是否符合我们的需求之前,我们需要让旧系统和新系统至少重叠数周(如果不是几个月)。 因此,这是我们的情况: Oracle数据库由多个表组成,每百万行。白天,实际上有成千上万的语句,我们无法停止迁移。

  • 问题内容: 在我的应用程序中,我从UIWebView迁移到WKWebView,如何为WKWebView重写这些功能? 和 问题答案: UIWebView => WKWebView等效 关于您可以写: 对于:

  • 考虑: 为什么,我怎么才能让它起作用? 我的CPU是i5-10210u(支持AVX-256)。在X64版本/调试中运行。

  • TypeScript不是凭空存在的。 它从JavaScript生态系统和大量现存的JavaScript而来。 将JavaScript代码转换成TypeScript虽乏味却不是难事。 接下来这篇教程将教你怎么做。 在开始转换TypeScript之前,我们假设你已经理解了足够多本手册里的内容。 如果你打算要转换一个React工程,推荐你先阅读React转换指南。 如果你在写纯JavaScript,你大