首页 > 代码库 > spring项目报org.apache.tiles.definition.DefinitionsFactoryException: I/O错误原因及解决办法。

spring项目报org.apache.tiles.definition.DefinitionsFactoryException: I/O错误原因及解决办法。

今天升级一个spring项目遇到如下错:

HTTP Status 500 - Request processing failed; nested exception is org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading definitions.

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading definitions.    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:139)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

 

想起再刚刚学习spring的时候也遇到类似的错,记得是模板定义文件中

<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD client Configuration 2.1//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">

其中http://tiles.apache.org/dtds/tiles-config_2_1.dtd这个地址容器需要访问一下,容器需要获得这个dtd文件,于是在阿里云服务器上ping tiles.apache.org,结果得到timeout,在其他另外的阿里云服务器上ping tiles.apache.org确可以通,看看两台机器的DNS解析地址是一样的。于是修改/etc/hosts,增加了192.87.106.229 tiles.apache.org。保存后重新访问项目一切正常。

spring项目报org.apache.tiles.definition.DefinitionsFactoryException: I/O错误原因及解决办法。