今天一个简单的xls导出功能 , dat环境测试通过 , 发到vir居然报错了 .
报错信息云云~~
17:58:46 DEBUG com.alibaba.dubbo.remoting.transport.DecodeHandler - [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult, dubbo version: 2.8.3, current host: 10.159.161.197
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at sun.awt.X11FontManager.isHeadless(X11FontManager.java:488)
at sun.awt.X11FontManager.getFileNameFromPlatformName(X11FontManager.java:168)
at sun.font.SunFontManager.initCompositeFonts(SunFontManager.java:3481)
at sun.font.SunFontManager.access$700(SunFontManager.java:65)
at sun.font.SunFontManager$2.run(SunFontManager.java:545)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<init>(SunFontManager.java:376)
at sun.awt.X11FontManager.<init>(X11FontManager.java:32)
at sun.reflect.GeneratedConstructorAccessor62.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:433)
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.awt.Font.getFont2D(Font.java:491)
at java.awt.Font.canDisplayUpTo(Font.java:2060)
at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
at java.awt.font.TextLayout.<init>(TextLayout.java:531)
at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:208)
at org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1954)
at org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1937)
at cn.gooday.logistics.web.util.poi.ExportUtil.exportIntoExcel(ExportUtil.java:147)
网上一搜 , 出现这问题多还挺多 , 破玩意儿 , 不知道用jxl有没有这个问题 .
解决办法 :
修改${TOMCAT_HOME}/bin/catalina.sh (windows修改catalina.bat)
查到-Djava.io.tmpdir="$CATALINA_TMPDIR"这行,并在这一行下加入:
-Djava.awt.headless=true \