项目

一般

简介

v10部署报错(jdk17),异常为Could not initialize class sun.misc.Unsafe

刘 亚平超过一年 之前添加

[2023-09-19T09:48:38] [] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=2363 _ThreadName=ApusicLogManager] [timeMillis: 1695088118510] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NoClassDefFoundError: Could not initialize class sun.misc.Unsafe
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:112)
    at com.apusic.aas.internal.data.EngineRef.start(EngineRef.java:98)
    at com.apusic.aas.internal.data.ModuleInfo.start(ModuleInfo.java:267)
    at com.apusic.aas.internal.data.ApplicationInfo.start(ApplicationInfo.java:358)
    at com.apusic.enterprise.v10.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:479)
    at com.apusic.enterprise.v10.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:197)
    at com.apusic.aas.deployment.admin.DeployCommand.execute(DeployCommand.java:489)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:575)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:571)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/javax.security.auth.Subject.doAs(Subject.java:376)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:570)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:601)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:593)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/javax.security.auth.Subject.doAs(Subject.java:376)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:592)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1500)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:94)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1894)
    at com.apusic.enterprise.v10.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1770)
    at com.apusic.aas.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:230)
    at com.apusic.aas.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:208)
    at com.apusic.aas.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:252)
    at com.apusic.aas.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:110)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:253)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:232)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:679)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:353)
    at com.apusic.aas.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:994)
    at com.apusic.aas.admin.rest.adapter.RestAdapter.service(RestAdapter.java:163)
    at com.apusic.enterprise.v10.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:439)
    at com.apusic.enterprise.v10.services.impl.ContainerMapper.service(ContainerMapper.java:144)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:177)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:154)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:263)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:261)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:110)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:89)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
    at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:208)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:261)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:110)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:89)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
    at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:208)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:261)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:110)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:89)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:549)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
    at java.base/java.lang.Thread.run(Thread.java:833)

主要是由于客户使用的jdk版本较高,在高版本的jdk中,jdk默认关闭了一些不建议使用的、内部或不稳定的API

解决办法:1.在domain.xml下的<java-config>标签中添加两条jvm配置  <jvm-options>--add-modules=jdk.unsupported</jvm-options> <jvm-options>--add-opens=java.base/sun.nio.ch=ALL-UNNAMED</jvm-options>

2.删除 domain.xml 中的<jvm-options>中所有文字[9|][1.8.0_251|]去掉,例如:修改前<jvm-options>[9|]--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED</jvm-options> 修改后 <jvm-options>--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED</jvm-options>