grails hdiv integration - session succeeds but get HDIV_PARAMETER_NOT_EXISTS exception

1k views Asked by At

I am trying to integrate hdiv in a grails 2.0.3 application.

I have made all the changes mentioned in the hdiv-reference doc for spring mvc in my grails application. When the application starts up I can see that hdiv validatorfilter is initialized and Hdiv session is created.

Any help is appreciated

Bala

In my applicationcontext.xml I have

<bean id="requestDataValueProcessor" class="org.hdiv.web.servlet.support.HdivRequestDataValueProcessor" />

My web.xml is

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
         metadata-complete="true"
         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">

    <display-name>/@grails.project.key@</display-name>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/hdiv-config.xml,/WEB-INF/hdiv-validations.xml</param-value>
    </context-param>

    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>@grails.project.key@</param-value>
    </context-param>

  <!-- HDIV Validator Filter -->
    <filter>
        <filter-name>ValidatorFilter</filter-name>
        <filter-class>org.hdiv.filter.ValidatorFilter</filter-class>
    </filter>

    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class>
    </filter>

    <filter>
        <filter-name>charEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        <init-param>
            <param-name>targetBeanName</param-name>
            <param-value>characterEncodingFilter</param-value>
        </init-param>
        <init-param>
            <param-name>targetFilterLifecycle</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>charEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>ValidatorFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


    <listener>
        <listener-class>org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener</listener-class>
    </listener>

<!-- HDIV Listener class -->
    <listener>
        <listener-class>org.hdiv.listener.InitListener</listener-class>
    </listener>

    <!-- Grails dispatcher servlet -->
    <servlet>
        <servlet-name>grails</servlet-name>
        <servlet-class>org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- The Groovy Server Pages servlet -->
    <servlet>
        <servlet-name>gsp</servlet-name>
        <servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>gsp</servlet-name>
        <url-pattern>*.gsp</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <!--
        The order of the welcome pages is important.  JBoss deployment will
        break if index.gsp is first in the list.
        -->
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.gsp</welcome-file>
    </welcome-file-list>

    <jsp-config>
        <taglib>
            <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
            <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
            <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>http://www.springframework.org/tags</taglib-uri>
            <taglib-location>/WEB-INF/tld/spring.tld</taglib-location>
        </taglib>

        <taglib>
                    <taglib-uri>http://grails.codehaus.org/tags</taglib-uri>
                    <taglib-location>/WEB-INF/tld/grails.tld</taglib-location>
                </taglib>        
        <taglib>
            <taglib-uri>http://www.springframework.org/tags/form</taglib-uri>
            <taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
        </taglib>
    </jsp-config>

</web-app>

My hdiv-config.xml is

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hdiv="http://www.hdiv.org/schema/hdiv"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.hdiv.org/schema/hdiv http://www.hdiv.org/schema/hdiv/hdiv.xsd">

    <hdiv:config errorPage="/error.jsp">
        <hdiv:startPages>/,/attacks/.*,/index.gsp</hdiv:startPages>
    </hdiv:config>

</beans>

However I see an error

 2012-05-31 15:10:22,704 [pool-5-thread-1] DEBUG filter.ValidatorFilter  - Initializing filter 'ValidatorFilter'
    2012-05-31 15:10:22,705 [pool-5-thread-1] DEBUG filter.ValidatorFilter  - Filter 'ValidatorFilter' configured successfully
| Server running. 
2012-05-31 15:10:32,912 [http-bio-8080-exec-2] INFO  listener.InitListener  - HDIV's session created:39414F37F6E68615298D1B7B6FD4B3A0
2012-05-31 15:10:32,925 [http-bio-8080-exec-2] INFO  **logs.Logger  - HDIV_PARAMETER_NOT_EXISTS;/TestHdiv/author/index;_HDIV_STATE_;null;0:0:0:0:0:0:0:1;0:0:0:0:0:0:0:1;user**
2012-05-31 15:10:32,925 [http-bio-8080-exec-2] DEBUG dataComposer.DataComposerMemory  - The page [14] has no states, is not stored in session
2012-05-31 15:10:32,985 [http-bio-8080-exec-3] DEBUG dataComposer.DataComposerMemory  - The page [15] has no states, is not stored in session
1

There are 1 answers

0
fourgablesguy On

Per the installation documentation for HDIV maybe try this:

<filter-mapping>
    <filter-name>ValidatorFilter</filter-name>
    <!-- Grails dispatcher servlet -->
    <servlet-name>grails</servlet-name>
</filter-mapping>

You might also need to add gsp servlet mapping but I would try with just grails front controller first.

<filter-mapping>
    <filter-name>ValidatorFilter</filter-name>
    <!-- Grails dispatcher servlet -->
    <servlet-name>grails</servlet-name>
    <!-- Groovy Server Pages servlet -->
    <servlet-name>gsp</servlet-name>
</filter-mapping>