Hibernate is used in the project and ehcache is used as the second-level cache. After the configuration is completed, the following error always occurs when Tomcat is started:
Severe: exception sending context initialized event to listener instance of class org. springframework. Web. Context. contextloaderlistener
Org. springframework. beans. factory. beancreationexception: Error creating bean with name 'entitymanagerfactory 'defined in class path resource [applicationcontext. XML]: Invocation of init method failed; Nested exception is net. SF. ehcache. cacheexception: error handling from file:/D:/tomcat % 206.0/webapps/root/WEB-INF/classes/ehcache. XML. initial cause was error processing from input stream. initial cause was content is not allowed in Prolog.
At org. springframework. Beans. Factory. Support. abstractautowirecapablebeanfactory. initializebean (abstractautowirecapablebeanfactory. Java: 1420)
.......
Caused by: net. SF. ehcache. cacheexception: error handling from file:/D:/tomcat % 206.0/webapps/root/WEB-INF/classes/ehcache. XML. initial cause was error processing from input stream. initial cause was content is not allowed in Prolog.
At net. SF. ehcache. config. configurationfactory. parseconfiguration (configurationfactory. Java: 101)
.......
Caused by: net. SF. ehcache. cacheexception: error handling from input stream. Initial cause was content is not allowed in Prolog.
At net. SF. ehcache. config. configurationfactory. parseconfiguration (configurationfactory. Java: 155)
At net. SF. ehcache. config. configurationfactory. parseconfiguration (configurationfactory. Java: 99)
... 52 more
Caused by: org. xml. Sax. saxparseexception: content is not allowed in Prolog.
At first, I saw the first error prompt, and thought it was a problem caused by spring or ehcache. After a long time, I found the solution from the content is not allowed in Prolog information:
Use NotePad to save the ehcache. xml configuration file as an Anis-encoded file.
It took a long time to find the cause and solution to a small problem.