Announcement Announcement Module
Collapse
No announcement yet.
XML error reading definition Exception while integrating tiles and velocity in Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML error reading definition Exception while integrating tiles and velocity in Spring

    Hello,
    I am getting this exception:

    Code:
    HTTP Status 500 - Request processing failed; nested exception is org.apache.tiles.definition.DefinitionsFactoryException: XML error reading definitions.
    
    type Exception report
    
    message Request processing failed; nested exception is org.apache.tiles.definition.DefinitionsFactoryException: XML error reading definitions.
    
    description The server encountered an internal error that prevented it from fulfilling this request.
    
    exception
    
     root cause
    
    org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 85; Attribute "type" with value "velocity" must have a value from the list "string template definition object ".
    	com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    	java:239)
    	org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
    	org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadParentDefinitions(ResolvingLocaleUrlDefinitionDAO.java:58)
    	org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:239)
    	org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
    	org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitions(CachingLocaleUrlDefinitionDAO.java:222)
    	org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.checkAndloadDefinitions(CachingLocaleUrlDefinitionDAO.java:204)
    	org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:154)
    	org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:123)
    	org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:54)
    	org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:105)
    	org.springframework.web.servlet.view.tiles2.TilesView.checkResource(TilesView.java:92)
    	org.springframework.web.servlet.view.UrlBasedViewResolver.loadView(UrlBasedViewResolver.java:438)
    	org.springframework.web.servlet.view.AbstractCachingViewResolver.createView(AbstractCachingViewResolver.java:186)
    	org.springframework.web.servlet.view.UrlBasedViewResolver.createView(UrlBasedViewResolver.java:401)
    	org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName(AbstractCachingViewResolver.java:103)
    	org.springframework.web.servlet.DispatcherServlet.resolveViewName(DispatcherServlet.java:1211)
    	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1160)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    note The full stack trace of the root cause is available in the Apache Tomcat/7.0.35 logs.
    
    Apache Tomcat/7.0.35
    my servlet-context.xml :

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/mvc"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    
    	<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
    	
    	<!-- Enables the Spring MVC @Controller programming model -->
    	<annotation-driven />
    
    	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
    	<resources mapping="/resources/**" location="/resources/" />
    
    	<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
    	<!-- 
    	<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<beans:property name="prefix" value="/WEB-INF/views/" />
    		<beans:property name="suffix" value=".jsp" />
    	</beans:bean>
    	 -->
    	<context:component-scan base-package="com.me.velo" />
    	
    	<!--  
    	<beans:bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
       		<beans:property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
    		<beans:property name="order" value="1"/>
    	</beans:bean>
    	
    	<beans:bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
            <beans:property name="resourceLoaderPath" value="/WEB-INF/views/" />
        </beans:bean>
     
        <beans:bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
            <beans:property name="cache" value="true"/>
            <beans:property name="prefix" value="/WEB-INF/views/"/>
            <beans:property name="suffix" value=".vm"/>
            <beans:property name="order" value="2"/>
        </beans:bean>
        -->
        <!--
        <beans:bean id="tilesConfigurer" 
    	class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <beans:property name="definitions">
            <beans:list>
                <beans:value>/WEB-INF/tiles.xml</beans:value>
            </beans:list>
       	</beans:property>
    	</beans:bean>
    	-->
    	<!-- velocity + tiles initializer -->
    <beans:bean id="velocityTilesInitializer" class="com.me.velo.VelocityTilesInitializer">
        <beans:property name="veolocityToolbox" value="/WEB-INF/tools.xml" />
        <beans:property name="veolocityProperties" value="/WEB-INF/velocity.properties" />
        <beans:property name="definitions">
            <beans:list>
                <beans:value>/WEB-INF/tiles.xml</beans:value>
            </beans:list>
        </beans:property>
    </beans:bean>
    
    <!-- tiles config with velocityTiles initializer-->
    
    
    <beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <beans:property name="tilesInitializer" ref="velocityTilesInitializer" />
    </beans:bean>
    
    <!-- tiles view -->
    <beans:bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <beans:property name="viewClass" value="com.me.velo.VelocityTilesView" />
        <beans:property name="contentType" value="text/html;charset=UTF-8" />
        <!-- default attributes for every view -->
        <!-- 
        <beans:property name="attributesMap">
            <beans:map>
                <beans:entry key="authentication" value-ref="authenticationService" />
            </beans:map>
            
        </beans:property>
         -->
    </beans:bean>
    </beans:beans>
    web.xml:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    
    	<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>/WEB-INF/spring/root-context.xml</param-value>
    	</context-param>
    	
    	<!-- Creates the Spring Container shared by all Servlets and Filters -->
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<!-- Processes application requests -->
    	<servlet>
    		<servlet-name>appServlet</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	
    <servlet>
      <servlet-name>velocity</servlet-name>
      <servlet-class>org.apache.velocity.tools.view.VelocityViewServlet</servlet-class>
    
      <init-param>
        <param-name>org.apache.velocity.toolbox</param-name>
        <param-value>/WEB-INF/tools.xml</param-value>
      </init-param>
    
      <init-param>
        <param-name>org.apache.velocity.properties</param-name>
        <param-value>/WEB-INF/velocity.properties</param-value>
      </init-param>
     
    </servlet>
    		
    	<servlet-mapping>
    		<servlet-name>appServlet</servlet-name>
    		<url-pattern>*.htm</url-pattern>
    	</servlet-mapping>
    
    	<servlet-mapping>
    		<servlet-name>velocity</servlet-name>
    		<url-pattern>*.vm</url-pattern>
    	</servlet-mapping>
    <welcome-file-list>
    <welcome-file>one.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    I am referring to link from github. I am facing these exceptions. please help.
Working...
X