如何解决异常[部署war时由于[java.lang.ArrayIndexOutOfBoundsException]:0而加载application.groovy时出错?

时间:2018-03-19 04:30:46

标签: java linux tomcat grails centos7

如何解决战争部署到生产模式时发生的异常

Grails 3.1.8,Java 8中的开发

在Linux CentOS 7和Tomcat 8.5.9服务器上部署。

请从catalina.out

中找到错误日志
18-Mar-2018 20:29:21.953 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
     org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/application]]
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)        
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
    Caused by: org.grails.core.exceptions.GrailsConfigurationException: Error loading application.groovy due to [java.lang.ArrayIndexOutOfBoundsException]: 0
            at org.grails.core.cfg.GroovyConfigPropertySourceLoader.load(GroovyConfigPropertySourceLoader.groovy:72)
            at org.grails.core.cfg.GroovyConfigPropertySourceLoader.load(GroovyConfigPropertySourceLoader.groovy:45)
            at org.springframework.boot.env.PropertySourcesLoader.load(PropertySourcesLoader.java:127)
            at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadIntoGroup(ConfigFileApplicationListener.java:462)
            at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:449)    
            at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
            at grails.boot.GrailsApp.run(GrailsApp.groovy:55)
            at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149)
            at org.grails.boot.context.web.GrailsAppServletInitializer.createRootApplicationContext(GrailsAppServletInitializer.groovy:57)
            at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85)
            at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
            at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5292)
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
            ... 10 more
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
            at sun.font.CompositeFont.getSlotFont(CompositeFont.java:333)
            at sun.font.CompositeGlyphMapper.initMapper(CompositeGlyphMapper.java:81)
            at sun.font.CompositeGlyphMapper.<init>(CompositeGlyphMapper.java:62)
            at sun.font.CompositeFont.getMapper(CompositeFont.java:391)
            at sun.font.CompositeFont.canDisplay(CompositeFont.java:417)
            at java.awt.Font.canDisplay(Font.java:1980)
            at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.checkFontCanDisplayCharacters(RandomFontGenerator.java:207)
            at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.cleanFontList(RandomFontGenerator.java:163)
            at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.initializeFonts(RandomFontGenerator.java:79)
            at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.<init>(RandomFontGenerator.java:69)        
            at org.grails.core.cfg.GroovyConfigPropertySourceLoader.load(GroovyConfigPropertySourceLoader.groovy:61)
            ... 34 more

1 个答案:

答案 0 :(得分:0)

Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
  at sun.font.CompositeFont.getSlotFont(CompositeFont.java:333)

这看起来似乎缺少某些字体,或者可能没有安装任何字体。比较您的开发环境和生产环境之间fc-command的输出。默认情况下,此命令可能不在此处,您也需要安装它。 这post可能有所帮助,因为我们不知道您正在运行哪个发行版。