Comments (10)
The problem was resolved after changing the JDK to Oracle
可以试试这里的几个方法,如果不行贴个testcase看看如何?
from dragonwell11.
我就是用的jdk11啊,切换回jdk8肯定是好了,但是我整个项目就要迁移回jdk8了,使用oracle则没有这个问题,你们阿里的easy-excel用你们的龙井JDK11也会报这个异常的
from dragonwell11.
Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Class.forName(Class.java:398) ~[na:na]
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:82) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74) ~[na:na]
at java.desktop/java.awt.Font.getFont2D(Font.java:497) ~[na:na]
at java.desktop/java.awt.Font.canDisplayUpTo(Font.java:2250) ~[na:na]
at java.desktop/java.awt.font.TextLayout.singleFont(TextLayout.java:469) ~[na:na]
at java.desktop/java.awt.font.TextLayout.(TextLayout.java:530) ~[na:na]
at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:275) ~[poi-3.17.jar!/:3.17]
at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.(AutoSizeColumnTracker.java:117) ~[poi-ooxml-3.17.jar!/:3.17]
at org.apache.poi.xssf.streaming.SXSSFSheet.(SXSSFSheet.java:82) ~[poi-ooxml-3.17.jar!/:3.17]
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:658) ~[poi-ooxml-3.17.jar!/:3.17]
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:679) ~[poi-ooxml-3.17.jar!/:3.17]
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:90) ~[poi-ooxml-3.17.jar!/:3.17]
at com.alibaba.excel.util.WorkBookUtil.createSheet(WorkBookUtil.java:66) ~[easyexcel-2.1.6.jar!/:na]
at com.alibaba.excel.context.WriteContextImpl.createSheet(WriteContextImpl.java:187) ~[easyexcel-2.1.6.jar!/:na]
at com.alibaba.excel.context.WriteContextImpl.initSheet(WriteContextImpl.java:167) ~[easyexcel-2.1.6.jar!/:na]
at com.alibaba.excel.context.WriteContextImpl.currentSheet(WriteContextImpl.java:114) ~[easyexcel-2.1.6.jar!/:na]
at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:56) ~[easyexcel-2.1.6.jar!/:na]
... 66 common frames omitted
from dragonwell11.
请尝试下 yum install fontconfig
from dragonwell11.
请尝试下 yum install fontconfig
我使用的是龙井的dockers镜像的,
FROM registry.cn-shanghai.aliyuncs.com/dragonwell/dragonwell11:11.0.5.1-preview_alpine_x86_64
RUN rm -f /etc/localtime \
&& ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
这怎么安装,如果我切换回oracle的jdk就不会出现这个问题了
from dragonwell11.
请尝试下 yum install fontconfig
我使用的是龙井的dockers镜像的,
FROM registry.cn-shanghai.aliyuncs.com/dragonwell/dragonwell11:11.0.5.1-preview_alpine_x86_64 RUN rm -f /etc/localtime \ && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone
这怎么安装,如果我切换回oracle的jdk就不会出现这个问题了
alpine 安装fontconfig可以在Dockerfile添加下面的代码,但是我不确定能不能解决你的问题,可以尝试下哈 :)
FROM registry.cn-shanghai.aliyuncs.com/dragonwell/dragonwell11:11.0.5.1-preview_alpine_x86_64
RUN apk update && apk add fontconfig
from dragonwell11.
请尝试下 yum install fontconfig
我使用的是龙井的dockers镜像的,
FROM registry.cn-shanghai.aliyuncs.com/dragonwell/dragonwell11:11.0.5.1-preview_alpine_x86_64 RUN rm -f /etc/localtime \ && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone
这怎么安装,如果我切换回oracle的jdk就不会出现这个问题了
alpine 安装fontconfig可以在Dockerfile添加下面的代码,但是我不确定能不能解决你的问题,可以尝试下哈 :)
FROM registry.cn-shanghai.aliyuncs.com/dragonwell/dragonwell11:11.0.5.1-preview_alpine_x86_64 RUN apk update && apk add fontconfig
我使用你的办法解决了这个NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager的异常,但是在使用easyExcel的情况下又出现了另一个异常
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.util.DocumentHelper (jar:file:/mat-user.jar!/BOOT-INF/lib/poi-ooxml-3.17.jar!/) to method com.sun.org.apache.xerces.internal.util.SecurityManager.setEntityExpansionLimit(int)
WARNING: Please consider reporting this to the maintainers of org.apache.poi.util.DocumentHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2020-11-25 10:57:46.165 ERROR 1 --- [nio-8081-exec-7] c.m.b.core.controllers.ErrorController : java.lang.InternalError: java.lang.reflect.InvocationTargetException
com.alibaba.excel.exception.ExcelGenerateException: java.lang.InternalError: java.lang.reflect.InvocationTargetException
at com.alibaba.excel.write.ExcelBuilderImpl.addContent(ExcelBuilderImpl.java:67) ~[easyexcel-2.1.6.jar!/:na]
at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:161) ~[easyexcel-2.1.6.jar!/:na]
at com.alibaba.excel.ExcelWriter.write(ExcelWriter.java:146) ~[easyexcel-2.1.6.jar!/:na]
at com.alibaba.excel.write.builder.ExcelWriterSheetBuilder.doWrite(ExcelWriterSheetBuilder.java:190) ~[easyexcel-2.1.6.jar!/:na]
at com.matcloud.user.controllers.TeamController.excelExport(TeamController.java:144) ~[classes!/:1.0]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.34.jar!/:9.0.34]
同样,使用OracleJDK也不会出现这个异常,只是会报
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.util.DocumentHelper (jar:file:/mat-user.jar!/BOOT-INF/lib/poi-ooxml-3.17.jar!/) to method com.sun.org.apache.xerces.internal.util.SecurityManager.setEntityExpansionLimit(int)
WARNING: Please consider reporting this to the maintainers of org.apache.poi.util.DocumentHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
这个警告
from dragonwell11.
你使用的Oracle JDK的完整版本号能方便发一下吗?($OracleJDK/bin/java -version 这个命令的输出)
from dragonwell11.
你使用的Oracle JDK的完整版本号能方便发一下吗?($OracleJDK/bin/java -version 这个命令的输出)
ORACLE-JDK:
java version "11.0.6" 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode, sharing)
Dragonwell-JDK
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (Alibaba Dragonwell) (build 11.0.8+9)
OpenJDK 64-Bit Server VM (Alibaba Dragonwell) (build 11.0.8+9, mixed mode)
from dragonwell11.
@yuleil 你那边有空试一下这些版本么?
from dragonwell11.
Related Issues (20)
- [riscv64][dragonwell11]com/sun/net/httpserver/bugs/6725892/Test.java intermittent fail
- [riscv64]gcc13编译报错java_md_common.c:124:43: error: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 2 and 4097 [-Werror=format-truncation=] HOT 2
- [riscv64]jdk/incubator/vector/AddTest.java等9个用例超时 HOT 2
- [GC] Add option G1BarrierSimple to reduce overhead of g1 post write barrier.
- [riscv64]src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/risv64 HOT 2
- [riscv64]java/net/MulticastSocket/Test.java report 'No such device' HOT 1
- [Misc]Delete extra file src/hotspot/share/utilities/.globalDefinitions.hpp.swp HOT 1
- [Misc]Add swp file type into gitignore HOT 1
- [upstream]SEPCjvm2008共4个子项运行报错
- [anolis]runtime/eagerappcds/TestClassLoaderWithJVMTIAgent.java fails Error: Could not find or load main class com.alibaba.jvm.cds.Classes4CDS HOT 1
- [anolis]jdk/javadoc/doclet/testIOException/TestIOException.java fails java.lang.Error: index is writable HOT 1
- GHA arm runner权限过高
- [JIT] Backport: 8331087: Move immutable nmethod data from CodeCache
- [GC] Add IO related size policy for Parallel GC HOT 1
- [Misc] optimize BigDecimal.divide HOT 1
- [Bug] assert(InlineCacheBuffer::is_empty()) failed: should have cleaned up ICBuffer
- [GC] Fix option type in IOPrioritySizePolicy HOT 1
- [fastdebug][nightly]compile error: 'emit_constraint_float' was not declared HOT 1
- [GC] Fix data type in IOPrioritySizePolicy HOT 1
- GHA 获取jtreg缓存失败
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dragonwell11.