简体   繁体   中英

How to solve exception [Error loading application.groovy due to [java.lang.ArrayIndexOutOfBoundsException]: 0] when deploying war?

How to solve exception occurred on war deployment to production mode

Development in Grails 3.1.8, Java 8

Deployment on Linux CentOS 7 and Tomcat 8.5.9 server.

Please find the error log from 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
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
  at sun.font.CompositeFont.getSlotFont(CompositeFont.java:333)

This looks like some fonts are missing, or maybe none is installed. Compare the output of fc-command between your dev environment and your prod. This command might not be here by default and you need to install it too. This post might help, as we don't know which distro you are running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM