Announcement Announcement Module
Collapse
No announcement yet.
SpringBatch Admin Deployed with custom DB details Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SpringBatch Admin Deployed with custom DB details

    hi Team,

    My motive is to monitor SpringBatch Jobs using SPringBatch Admin Web UI.

    i have deployed SpringBatch Admin on tomcat with oracle DB details.

    SpringBatch Admin version : 1.2.1
    Tomcat version : Tomcat6

    We already have springbatch jobs and admin is deployed with same DB details, it gets deployed succesfully, but when i go to the URL, it says:

    type: Status report

    message: /spring-batch-admin-sample-1.2.2.BUILD-SNAPSHOT/home

    description: The requested resource (/spring-batch-admin-sample-1.2.2.BUILD-SNAPSHOT/home) is not available.


    I followed the process of customizing Batch Admin to point to different DB.
    Pleasw would request your help.
    Thanks.

  • #2
    How do you tell SB Admin to take the Oracle source? Are you passing the -DENVIRONMENT=oracle to the Tomcat JVM process?
    Do you have batch-oracle.properties file in the application's classpath root folder (like /WEB-INF/classes)?
    Are you sure that the application is mapped to the /spring-batch-admin-sample-1.2.2.BUILD-SNAPSHOT ?
    Have you tried the
    /spring-batch-admin-sample-1.2.2.BUILD-SNAPSHOT/batch/home
    address instead?

    Comment


    • #3
      in the last URL you should replace "batch" with the mapping from your application's web.xml file:
      <servlet>
      <servlet-name>Batch Servlet</servlet-name>
      <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</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>
      ...
      <servlet-mapping>
      <servlet-name>Batch Servlet</servlet-name>
      <url-pattern>/batch/*</url-pattern>
      </servlet-mapping>

      Comment


      • #4
        hi,
        Yes i am passing -DEnvironment=oracle to tomcat. also have created file batch-oracle.properties and put it in classpath.
        This is how web.xml looks:


        <servlet>
        <servlet-name>Batch Servlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</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>

        <servlet-mapping>
        <servlet-name>Batch Servlet</servlet-name>
        <url-pattern>/batch/*</url-pattern>
        </servlet-mapping>

        Comment


        • #5
          well then you should really try using
          /spring-batch-admin-sample-1.2.2.BUILD-SNAPSHOT/batch/home
          url instead of the posted initially

          Comment


          • #6
            The web application and SB Admin actually needs a little bit more content in the web.xml than you've posted.
            The SB Admin specific part additionally is
            Code:
            	<context-param>
            		<param-name>contextConfigLocation</param-name>
            		<param-value>classpath*:/org/springframework/batch/admin/web/resources/webapp-config.xml</param-value>
            	</context-param>
            
            	<servlet>
            		<servlet-name>Resources Servlet</servlet-name>
            		<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
            		<load-on-startup>0</load-on-startup>
            	</servlet>
            
            	<servlet-mapping>
            		<servlet-name>Resources Servlet</servlet-name>
            		<url-pattern>/resources/*</url-pattern>
            	</servlet-mapping>
            A detailed example you can find in the "Spring Batch Admin Webapp" Spring Batch template project, which is available through the default Spring Tool Suite distribution.

            Comment


            • #7
              what the heck.. here is the full web.xml version that is working on my machine:
              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>

              Comment


              • #8
                thanks Smollet..
                I am able to view the page.
                Now when i click on hyperlink /jobs it goes to /batch/jobs which is correct. and i see list of all the jobs configured.
                Then when i click on any of the jobs it goes to /job/<jobName> and gives again error: resource is not available, but when i manually add /batch i.e
                /batch/job/<jobName> it works fine.
                Where would the change be required so that everywhere it prefix /batch/ to access any of the hyperlinks inside.

                Comment


                • #9
                  ha, I've seen that issue too when running it within an embedded jetty container..
                  didn't find the real reason that time.
                  in the STS tcServer with the web.xml as above it works fine.

                  Comment


                  • #10
                    Is JIRA needs to be raised for that..? i am not sure..

                    Thanx Smollet for your quick replies..

                    Comment

                    Working...
                    X