Skip to content
Advertisement

Running a Java configured Spring MVC Application fails to load ApplicationContext, raises java.lang.reflect.InaccessibleObjectException

Environment

  • Eclipse IDE for Enterprise Web applications
  • Tomcat 9 Server

Code

I started learning spring, following a Udemy course (by Chad Darby). In it, a spring mvc app is configured in java. Relevant files are given below:

DemoAppConfig.java

JavaScript

MySpringMvcDispatcherServletInitializer.java

JavaScript

pom.xml

JavaScript

Error

While running the web app on tomcat 9 server from eclipse, the following exception is raised:

JavaScript

Why is it happening?

Note

Despite the error, the web app loaded, and I can access a get endpoint specified in one mvc controller. Here is the logs after the exception.

JavaScript

Advertisement

Answer

Make sure you change your java in the compiler, build path and project facets to JDK8 since this exception is related to JDK9, therefore your JDK versions are not synced.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement