Announcement Announcement Module
Collapse
No announcement yet.
Problems extending the Spring Batch Admin UI Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems extending the Spring Batch Admin UI

    Hi,

    I am trying to add a menu and a new page to the Admin UI. I have tried to follow the instructions and added a Controller and Menu component in META-INF/spring/batch/servlet/controller-context.xml, but files I add here are not read during startup.

    My web.xml:
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="
    			http://java.sun.com/xml/ns/j2ee
    			http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>classpath*:/org/springframework/batch/admin/web/resources/webapp-config.xml</param-value>
    	</context-param>
    
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<filter>
    		<filter-name>shallowEtagHeaderFilter</filter-name>
    		<filter-class>org.springframework.web.filter.ShallowEtagHeaderFilter</filter-class>
    	</filter>
    
    	<filter>
    		<filter-name>hiddenHttpMethodFilter</filter-name>
    		<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
    	</filter>
    
    	<filter-mapping>
    		<filter-name>shallowEtagHeaderFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<filter-mapping>
    		<filter-name>hiddenHttpMethodFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    	<servlet>
    		<servlet-name>Batch Servlet</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>classpath*:/org/springframework/batch/admin/web/resources/servlet-config.xml</param-value>
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<!-- Serves static resource content from .jar files such as spring-faces.jar -->
    	<servlet>
    		<servlet-name>Resources Servlet</servlet-name>
    		<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
    		<load-on-startup>0</load-on-startup>
    	</servlet>
    
    	<!-- Map all /resources requests to the Resource Servlet for handling -->
    	<servlet-mapping>
    		<servlet-name>Resources Servlet</servlet-name>
    		<url-pattern>/resources/*</url-pattern>
    	</servlet-mapping>
    
    	<servlet-mapping>
    		<servlet-name>Batch Servlet</servlet-name>
    		<url-pattern>/batch/*</url-pattern>
    	</servlet-mapping>
    
    </web-app>
    (This is the one from the sample). As far as I see the servlet-config.xml in the parent includes the files from the child UI context, but nothing happens and there is no indication in the logs that my files are read. What is going wrong here?

    Thanks in advance

  • #2
    Sorry, I think the docs are slightly wrong. If you look at the servlet config file /org/springframework/batch/admin/web/resources/servlet-config.xml you will see that it only loads from a fixed set of directories (this has to be done to ensure ordering). Put your config file in META-INF/spring/batch/servlet/override/*.xml and it should work.

    Comment


    • #3
      Hi Dave, thanks for your answer and for a good product.

      I have tried to move my xml config file to the override directory, but it did not change anything. I am quite certain the files are not picked up as the bean classes defined in them do not yet exist and so an exception should be thrown at load time.

      Comment


      • #4
        You are using 1.0.0.RELEASE right? Check the contents of /org/springframework/batch/admin/web/resources/servlet-config.xml and look at what files should be loaded.

        Comment


        • #5
          Yes, I am using the 1.0.0.RELEASE version.

          The content of the parent servlet-config.xml is

          Code:
          <import resource="classpath*:/META-INF/spring/batch/servlet/resources/*.xml" />
          <import resource="classpath*:/META-INF/spring/batch/servlet/manager/*.xml" />
          <import resource="classpath*:/META-INF/spring/batch/servlet/override/*.xml" />
          And I have put my files in my webapp´s META-INF/spring/batch/servlet/override/. Still no success

          Comment


          • #6
            Then I guess that META-INF is not getting onto the classpath. I you are using Maven put it in src/main/resources.

            Comment


            • #7
              Hi,

              You can find a tutorial and the source code. It explains how to add a menu item into spring batch admin:

              http://alain-cieslik.com/2011/07/04/...g-batch-admin/

              Alain

              Comment

              Working...
              X