由于存在安全漏洞,我将log4j版本升级到了2.15.0。但在部署时,我在wildfly服务器中遇到了“空字节数组”错误。
波姆。xml:
<properties>
<java.version>1.8</java.version>
<log4j2.version>2.16.0</log4j2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<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>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Add Log4j2 Dependency -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<!-- Add Log4j2 Async Dependency -->
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis-wsdl4j</artifactId>
<version>1.5.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0-b04</version>
</dependency>
<dependency>
<groupId>javax.xml.rpc</groupId>
<artifactId>javax.xml.rpc-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
错误日志:
2021-12-14 15:45:52,957 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 95) MSC000001: Failed to start service jboss.deployment.unit."lojistikteminatlitasimacilik-0.0.1-SNAPSHOT.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."lojistikteminatlitasimacilik-0.0.1-SNAPSHOT.war".undertow-deployment: java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) at java.lang.Thread.run(Thread.java:748) at org.jboss.threads.JBossThread.run(JBossThread.java:513) Caused by: java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY at org.apache.logging.log4j.core.config.ConfigurationSource.(ConfigurationSource.java:56) at org.apache.logging.log4j.core.config.NullConfiguration.(NullConfiguration.java:32) at org.apache.logging.log4j.core.LoggerContext.(LoggerContext.java:85) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:140) at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:230) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47) at org.apache.logging.log4j.LogManager.getContext(LogManager.java:174) at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.getLoggerContext(Log4J2LoggingSystem.java:264) at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.beforeInitialize(Log4J2LoggingSystem.java:131) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:220) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:199) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69) at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48) at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:204) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:187) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530) at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:255) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) ... 8 more 2021-12-14 15:45:52,967 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 3) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "lojistikteminatlitasimacilik-0.0.1-SNAPSHOT.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"lojistikteminatlitasimacilik-0.0.1-SNAPSHOT.war\".undertow-deployment" => "java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY Caused by: java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY"}} 2021-12-14 15:45:52,968 ERROR [org.jboss.as.server] (External Management Request Threads -- 3) WFLYSRV0021: Deploy of deployment "lojistikteminatlitasimacilik-0.0.1-SNAPSHOT.war" was rolled back with the following failure message: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"lojistikteminatlitasimacilik-0.0.1-SNAPSHOT.war\".undertow-deployment" => "java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY Caused by: java.lang.NoSuchFieldError: EMPTY_BYTE_ARRAY"}}
所以我今天早上在将log4j更新到2.15.0版时遇到了这个问题。我发现的问题是maven依赖项引入了一个较旧版本的log4j(在我的例子中是2.14.1),它将返回错误常量“EMPTY_BYTE_ARRAY”。在2.15.0中,空字节数组不存在,并给出此错误。
我建议查看您的maven依赖关系树,看看是否正在引入一个较旧版本的log4j api、log4j core或另一个log4j库,它不是您正在使用的版本,看起来是2.16.0。
我通过eclipse将我的maven目标设置为“dependency:tree”来实现这一点。
我必须做两件事才能让它工作:
>
如果还没有,请创建src/main/webapp/WEB-INF/jboss部署结构。xml。里面加
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.logging.log4j.api"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
在我的例子中,war文件在WEB-INF/lib中仍然有2.11.0和新的2.16.0版本。我打开了战争,删除了2.11.0版本。
Wildfly使用log4j api工件(可能是比2.16.0更旧的版本),log4j api和log4j核心之间的版本不匹配将导致问题。有关如何在应用程序中合并log4j core的文档
更多信息请查看:https://www.wildfly.org/news/2021/12/13/Log4j-CVEs/
根据这个SO线程,我知道存在版本冲突,但在谷歌发布新版本后,问题仍然存在。 错误:任务': app: Process DebugGoogleServices'执行失败。请通过更新google-service插件的版本(有关最新版本的信息可在https://bintray.com/android/android-tools/com.google.gms.google-services/获得)或将co
问题内容: 由于我刚刚将Docker更新到1.1.0,所以我得到了: 来自守护程序的错误响应:客户端和服务器没有相同的版本(客户端:1.13,服务器:1.12) 你知道如何解决这个问题吗? 我切换回1.0.1,一切又恢复正常了。 问题答案: 看起来您需要在安装boot2docker之后升级虚拟机: 如果要从boot2docker 0.12或更高版本进行升级,则可以使用boot2docker sto
我正在我的nginx服务器上使用laravel5.8,带有laravelecho服务器socket。伊奥和雷迪斯。 我的网站一直工作到昨天没有错误,但今天它一直给我套接字错误,如: 这是我的laravel-echo-server.json文件: 首先我遇到了错误,但后来。 我已经重新启动的echo工作者使用但仍然是相同的问题。
我在wildfly启动期间收到一个错误,并显示以下消息: NoSuchFieldError:空字节数组 该消息还指出,此错误发生在拖航部署中。有谁能告诉我这里发生了什么以及如何解决这个问题? 下面是堆栈跟踪的开始。 造成原因:java.lang.NoSuchFieldError:EMPTY_BYTE_ARRAYdeployment.taggable-server.war//org.apache.l
问题内容: 如何解决此错误? 原因:java.lang.illegalargumentexception 11-01 11:08:12.845:E / AndroidRuntime(28885):原因:java.lang.IllegalStateException:应用程序的AndroidManifest.xml中的元数据标记的值不正确。预期为4030500,但发现为0。元素中必须具有以下声明:
我已经在我的Ubuntu16.04上安装了JDK1.8,为了完成一些我必须安装JDK1.7的工作,我没有对旧版本做任何操作就安装了它,并且更改了$JAVA_HOME以指向新安装的位置。 echo运行良好,显示新安装的版本为1.7 但当我执行时,它显示的是较早安装的版本,即1.8。 如果我错在什么地方,请纠正我,我需要很好的解释这一点。 谢谢你。这是我的终端机