Could not initialize class javax.imageio.ImageIO

前端 未结 3 1757
执念已碎
执念已碎 2020-12-20 15:54

I\'m trying to deploy a Spring web app to a Tomcat 7 running on a production environment on Windows Azure (tried Ubuntu and Windows Datacenter VM). Sadly, I get an error whi

3条回答
  •  心在旅途
    2020-12-20 16:46

    Ok so I fixed this issue =)

    1. I removed OpenJDK from Linux distribution and installed Oracle Java 7 > u25 by hand. (Good tutorial: http://de.wikihow.com/Installation-von-Oracle-Java-unter-Ubuntu-Linux)

    2. Then I added an ApplicationListener which loads the sunToolkit by hand (because AppContext is always null for some reason)

      @SuppressWarnings("restriction")
      public class ContextConfiguration implements ApplicationListener {
          @Override
          public void onApplicationEvent(ContextRefreshedEvent arg0) {
              //refresh awt context
              if(AppContext.getAppContext() == null) {
                  SunToolkit.createNewAppContext();
              }
          }
      }
      

    Thanks at haraldK =)

提交回复
热议问题