Spring Boot 3迁移后JavaMailSender类型转换异常求助
Spring Boot 2.6.9 迁移至3.x版本后出现ArrayStoreException问题求助
项目从Spring Boot 2.6.9迁移至3.x版本后,触发如下错误:
错误栈信息
Caused by: java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, jakarta.activation.MimeTypeRegistry at java.base/java.lang.System.arraycopy(Native Method) at java.base/java.util.Vector.copyInto(Vector.java:205) at jakarta.activation.MimetypesFileTypeMap.<init>(MimetypesFileTypeMap.java:140) at jakarta.activation.MimetypesFileTypeMap.<init>(MimetypesFileTypeMap.java:312) at org.springframework.mail.javamail.ConfigurableMimeFileTypeMap.createFileTypeMap(ConfigurableMimeFileTypeMap.java:150) at org.springframework.mail.javamail.ConfigurableMimeFileTypeMap.getFileTypeMap(ConfigurableMimeFileTypeMap.java:123) at org.springframework.mail.javamail.ConfigurableMimeFileTypeMap.afterPropertiesSet(ConfigurableMimeFileTypeMap.java:110) at org.springframework.mail.javamail.JavaMailSenderImpl.<init>(JavaMailSenderImpl.java:115) at org.springframework.boot.autoconfigure.mail.MailSenderPropertiesConfiguration.mailSender(MailSenderPropertiesConfiguration.java:44) 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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) ... 74 common frames omitted
已尝试的无效解决方案
已根据相关方案添加以下两个Maven依赖,但问题未得到解决:
<dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>jaxb-runtime</artifactId> <version>${jaxb-runtime.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>jakarta.activation</groupId> <artifactId>jakarta.activation-api</artifactId> <version>2.1.1</version> <scope>runtime</scope> </dependency>
同时尝试过Stack Overflow相关帖子及Spring Boot官方Issue中的解决方案,均无效,寻求帮助。
内容的提问来源于stack exchange,提问作者Uday Patil
相关产品推荐
相关产品推荐

