Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Spring Batch Admin UI with Grails?

  1. #11

    Default

    Hey mminella,

    I generated the web.xml using the install-templates command. It's at src/war/web.xml

    The only other servlet mapping in there besides the one I put in for my batch servlet is the gsp one. There doesn't seem to be any for the grails servlet:

    Code:
        <servlet-mapping>
            <servlet-name>gsp</servlet-name>
            <url-pattern>*.gsp</url-pattern>
        </servlet-mapping>
    The actual servlets are defined above it then:

    Code:
        <!-- 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>
    Maybe I should add one for the grails servlet? A simple "/"? But I woulda thought my Batch pattern of "/batch/*" would still work.

    I'll add in another mapping and see what happens. If you think of anything else, let me know, and thanks for your help so far, too.

    Tony

  2. #12

    Default

    I added in the following servlet mapping to the web.xml:

    Code:
            <servlet-mapping>
    		<servlet-name>grails</servlet-name>
    		<url-pattern>/*</url-pattern>
    	</servlet-mapping>
    Now it doesn't seem to be going to /grails-app/views/ anymore but I still get a 404 just saying that "the requested resource () is not available" when I hit any of the links at the top of the batch admin pages:

    Code:
    <li><a href="/myapp/batch">Home</a></li>
    <li><a href="/myapp/batch/jobs">Jobs</a></li>
    <li><a href="/myapp/batch/jobs/executions">Executions</a></li>
    <li><a href="/myapp/batch/files">Files</a></li>
    So it's like the pages are actually missing.

    Does anyone know what page it should redirect to when it goes to, say: /myapp/batch/jobs? Like, is it /myapp/batch/jobs/index.jsp? Or /myapp/batch/jobs/home.jsp?

    What's also strange is that if I go to /myapp/batch I get a 404 (this is the "Home" link above), but /myapp/batch/ works fine!

    Cheers,
    Tony

  3. #13

    Default

    I turned on extra logging and it does look like the grails servlet is still having an effect.

    Here is the stack trace for the sample batch admin project when the jobs page is rendered correctly:

    Code:
    15:04:59,191 DEBUG tomcat-http--5 datasource.DataSourceUtils:110 - Fetching JDBC Connection from DataSource
    15:04:59,192 DEBUG tomcat-http--5 datasource.DataSourceUtils:332 - Returning JDBC Connection to DataSource
    15:04:59,193 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'body' of type [java.lang.String] to request in view with name 'jobs'
    15:04:59,194 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'titleText' of type [java.lang.String] to request in view with name 'jobs'
    15:04:59,194 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'jobs' of type [java.util.ArrayList] to request in view with name 'jobs'
    15:04:59,194 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'titleCode' of type [java.lang.String] to request in view with name 'jobs'
    15:04:59,195 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'totalJobs' of type [java.lang.Integer] to request in view with name 'jobs'
    15:04:59,195 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'endJob' of type [java.lang.Integer] to request in view with name 'jobs'
    15:04:59,196 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'startJob' of type [java.lang.Integer] to request in view with name 'jobs'
    15:04:59,196 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'springMacroRequestContext' of type [org.springframework.web.servlet.support.RequestContext] to request in view with name 'jobs'
    15:04:59,196 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'jobName' of type [java.lang.String] to request in view with name 'jobs'
    15:04:59,197 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:328 - Added model object 'servletPath' of type [java.lang.String] to request in view with name 'jobs'
    15:04:59,197 DEBUG tomcat-http--5 freemarker.AjaxFreeMarkerView:279 - Rendering FreeMarker template [/layouts/html/standard.ftl] in FreeMarkerView 'jobs'
    And here is the output from myapp when I try to access the jobs page. Note that the Freemarker output is looking for a view with name 'null' now instead of a view with name 'jobs':

    Code:
    2012-12-04 14:57:57,182 ["http-bio-8080"-exec-4] DEBUG datasource.DataSourceUtils  - Fetching JDBC Connection from DataSource
    2012-12-04 14:57:57,185 ["http-bio-8080"-exec-4] DEBUG datasource.DataSourceUtils  - Returning JDBC Connection to DataSource
    2012-12-04 14:57:57,203 ["http-bio-8080"-exec-4] DEBUG servlet.DispatcherServlet  - Rendering view [org.springframework.web.servlet.view.JstlView: unnamed; URL [/WEB-INF/grails-app/views//jobs.jsp]] in DispatcherServlet with name 'Batch Servlet'
    2012-12-04 14:57:57,204 ["http-bio-8080"-exec-4] DEBUG view.JstlView  - Added model object 'jobs' of type [java.util.ArrayList] to request in view with name 'null'
    2012-12-04 14:57:57,204 ["http-bio-8080"-exec-4] DEBUG view.JstlView  - Added model object 'totalJobs' of type [java.lang.Integer] to request in view with name 'null'
    2012-12-04 14:57:57,204 ["http-bio-8080"-exec-4] DEBUG view.JstlView  - Added model object 'jobName' of type [java.lang.String] to request in view with name 'null'
    2012-12-04 14:57:57,204 ["http-bio-8080"-exec-4] DEBUG view.JstlView  - Added model object 'endJob' of type [java.lang.Integer] to request in view with name 'null'
    2012-12-04 14:57:57,204 ["http-bio-8080"-exec-4] DEBUG view.JstlView  - Added model object 'startJob' of type [java.lang.Integer] to request in view with name 'null'
    2012-12-04 14:57:57,209 ["http-bio-8080"-exec-4] DEBUG view.JstlView  - Forwarding to resource [/WEB-INF/grails-app/views//jobs.jsp] in InternalResourceView 'null'
    2012-12-04 14:57:57,212 ["http-bio-8080"-exec-4] DEBUG support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'pluginManager'
    2012-12-04 14:57:57,212 ["http-bio-8080"-exec-4] DEBUG support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'grailsApplication'
    2012-12-04 14:57:57,214 ["http-bio-8080"-exec-4] DEBUG annotation.RequestMappingHandlerMapping  - Looking up handler method for path /WEB-INF/grails-app/views/jobs.jsp
    2012-12-04 14:57:57,214 ["http-bio-8080"-exec-4] DEBUG annotation.RequestMappingHandlerMapping  - Did not find handler method for [/WEB-INF/grails-app/views/jobs.jsp]
    2012-12-04 14:57:57,214 ["http-bio-8080"-exec-4] WARN  servlet.PageNotFound  - No mapping found for HTTP request with URI [/myapp/WEB-INF/grails-app/views/jobs.jsp] in DispatcherServlet with name 'grails'
    2012-12-04 14:57:57,215 ["http-bio-8080"-exec-4] DEBUG servlet.DispatcherServlet  - Successfully completed request
    It is trying to render /WEB-INF/grails-app/views/jobs.jsp (even tho the servlet mentioned is the Batch Servlet and not the grails one) instead of the normal jobs.ftl freemarker layout page.

    I think I'm close to giving up on this. Btw, I also explicitly added freemarker version 2.3.19 to my buildconfig but no dice.

    Tony

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •