Excel export always fails in docker environment

Excel export always fails in docker environment

Excel export always fails in the docker environment. The most direct reason is that Chinese fonts are not installed. The solution is as follows:

Chinese fonts are not installed in the DOCKER environment and need to be installed

java.lang.NullPointerException: null
2020/5/29 8:40:11 AM at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
2020/5/29 8:40:11 AM at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
2020/5/29 8:40:11 AM at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
2020/5/29 8:40:11 AM at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:776)
2020/5/29 8:40:11 AM at sun.font.SunFontManager$2.run(SunFontManager.java:431)
2020/5/29 8:40:11 AM at java.security.AccessController.doPrivileged(Native Method)
2020/5/29 8:40:11 AM at sun.font.SunFontManager.<init>(SunFontManager.java:376)
2020/5/29 8:40:11 AM at sun.awt.X11FontManager.<init>(X11FontManager.java:57)
2020/5/29 8:40:11 AM at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2020/5/29 8:40:11 AM at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
2020/5/29 8:40:11 AM at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2020/5/29 8:40:11 AM at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
2020/5/29 8:40:11 AM at java.lang.Class.newInstance(Class.java:442)
2020/5/29 8:40:11 AM at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
2020/5/29 8:40:11 AM at java.security.AccessController.doPrivileged(Native Method)
2020/5/29 8:40:11 AM at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
2020/5/29 8:40:11 AM at java.awt.Font.getFont2D(Font.java:491)
2020/5/29 8:40:11 AM at java.awt.Font.canDisplayUpTo(Font.java:2060)
2020/5/29 8:40:11 AM at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
2020/5/29 8:40:11 AM at java.awt.font.TextLayout.<init>(TextLayout.java:531)
2020/5/29 8:40:11 AM at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:254)
2020/5/29 8:40:11 AM at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
2020/5/29 8:40:11 AM at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:77)
2020/5/29 8:40:11 AM at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:636)
2020/5/29 8:40:11 AM at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:657)
2020/5/29 8:40:11 AM at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:71)
2020/5/29 8:40:11 AM at com.chanjet.dsf.util.ExcelUtil.exportExcel(ExcelUtil.java:783)
2020/5/29 8:40:11 AM at com.chanjet.dsf.base.BaseService.uploadExcel(BaseService.java:89)
2020/5/29 8:40:11 AM at com.chanjet.dsf.goods.service.impl.GoodsServiceImpl.importExcel(GoodsServiceImpl.java:340)
2020/5/29 8:40:11 AM at com.chanjet.dsf.goods.service.impl.GoodsServiceImpl$$FastClassBySpringCGLIB$$d268cc51.invoke(<generated>)
2020/5/29 8:40:11 AM at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
2020/5/29 8:40:11 AM at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:685)
2020/5/29 8:40:11 AM at com.chanjet.dsf.goods.service.impl.GoodsServiceImpl$$EnhancerBySpringCGLIB$$a0a512ec.importExcel(<generated>)
2020/5/29 8:40:11 AM at com.chanjet.dsf.goods.controller.GoodsController.importExcel(GoodsController.java:105)
2020/5/29 8:40:11 AM at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020/5/29 8:40:11 AM at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2020/5/29 8:40:11 AM at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2020/5/29 8:40:11 AM at java.lang.reflect.Method.invoke(Method.java:497)
2020/5/29 8:40:11 AM at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
2020/5/29 8:40:11 AM at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
2020/5/29 8:40:11 AM at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
2020/5/29 8:40:11 AM at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
2020/5/29 8:40:11 AM at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2020/5/29 8:40:11 AM at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2020/5/29 8:40:11 AM at com.chanjet.dsf.filter.RefreshContextFilter.doFilter(RefreshContextFilter.java:29)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2020/5/29 8:40:11 AM at com.chanjet.dsf.filter.WebLogMDCFilter.doFilter(WebLogMDCFilter.java:27)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2020/5/29 8:40:11 AM at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
2020/5/29 8:40:11 AM at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
2020/5/29 8:40:11 AM at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
2020/5/29 8:40:11 AM at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
2020/5/29 8:40:11 AM at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
2020/5/29 8:40:11 AM at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
2020/5/29 8:40:11 AM at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
2020/5/29 8:40:11 AM at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
2020/5/29 8:40:11 AM at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
2020/5/29 8:40:11 AM at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:747)
2020/5/29 8:40:11 AM at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
2020/5/29 8:40:11 AM at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
2020/5/29 8:40:11 AM at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
2020/5/29 8:40:11 AM at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
2020/5/29 8:40:11 AM at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639)
2020/5/29 8:40:11 AM at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
2020/5/29 8:40:11 AM at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2020/5/29 8:40:11 AM at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2020/5/29 8:40:11 AM at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
2020/5/29 8:40:11 AM at java.lang.Thread.run(Thread.java:745)

This is the end of this article about the problem that excel export always fails in the docker environment. For more related docker excel failure content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • IDEA JetBrains Mono font introduction and installation tutorial (detailed explanation)
  • How to install fonts under Windows to Linux system
  • Detailed introduction to font installation in Linux system
  • How to install Chinese fonts in Centos6
  • Bat file to install fonts in batches using batch processing

<<:  Vue3 manual encapsulation pop-up box component message method

>>:  Solution to many line breaks and carriage returns in MySQL data

Recommend

Detailed analysis of SQL execution steps

Detailed analysis of SQL execution steps Let'...

CSS box hide/show and then the top layer implementation code

.imgbox{ width: 1200px; height: 612px; margin-rig...

Mini Program to Implement the Complete Shopping Cart

The mini program implements a complete shopping c...

Linux sar command usage and code example analysis

1. CPU utilization sar -p (view all day) sar -u 1...

Share some key interview questions about MySQL index

Preface An index is a data structure that sorts o...

Basic usage of UNION and UNION ALL in MySQL

In the database, both UNION and UNION ALL keyword...

Exploring the use of percentage values ​​in the background-position property

How background-position affects the display of ba...

Vue+axios sample code for uploading pictures and recognizing faces

Table of contents Axios Request Qs processing dat...

Detailed explanation of the process of building and running Docker containers

Simply pull the image, create a container and run...

Experience in solving tomcat memory overflow problem

Some time ago, I submitted a product version to t...

HTML Nine-grid Layout Implementation Method

Diversifying website layouts is our front-end spe...

Optimization methods when Mysql occupies too high CPU (must read)

When Mysql occupies too much CPU, where should we...

Configure VIM as a C++ development editor in Ubuntu

1. Copy the configuration file to the user enviro...

VMware Workstation 12 Pro Linux installation tutorial

This article records the VMware Workstation 12 Pr...