1, myresource. properties should be placed under the WEB-INF's classes,
2. If jar is used to read the resource file, the jar must be added under Lib, not just the classpath configured by IED (eclipse ).
Explanation: When the getbundle loads the resource file, it will read the classloader of the current application, traverse the current classloader to find the classpath, and bind the resource file. If it cannot be found, it will report
Java. util. missingresourceexception.
The key is that if you use eclipse to configure the application and host lib to Elipse for loading, when Tomcat is started in eclipse, the classloader and
Tomcat does not load the same class after reading the application.
When Tomcat is started, load the application according to the JRE configured by Tomcat. In addition, the application Lib is hosted on eclipse, and the jar under Lib is loaded by the JRE set by Elipse. There will be two JRE environments.
Solution: put all the jar files under the Lib of the WEB-INF and load them by the container. Of course, it is also required to load it to classpath.