Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Running Spring Batch Admin in Jetty Embedded Container

Hi,

 

I am trying to run existing Spring Batch Admin (Spring MVC) WAR application by using Jetty 9  embedded container.

My whole idea is to be able to run either of the following command line form.

 

java –jar my_spring_batch_admin.war

Or

java –jar my_spring_batch_admin.jar (by using onejar to add all the dependencies)

 

I tried to follow the approach to bootstrap jar container my simulating web.xml (as attached) configuration within MyEmbeddedJetty.java but I am getting the following start up exceptions for the XSD validation of existing spring xml configuration

 

14:42:16,958  INFO main xml.XmlBeanDefinitionReader:317 - Loading XML bean definitions from URL [jar:file:/C:/Deha/spring-batch-admin-2.0.0.M1/spring-batch-admin-sample/target/spring-batch-admin-sample-2.0.0.M1.jar!/org/springframework/batch/admin/web/resources/servlet-config.xml]

14:42:17,055  WARN main xml.XmlBeanDefinitionReader:48 - Ignored XML validation warning

org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 132; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-2.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

       at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)

       at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99)

 

I created some simplere sample apps that I can run Spring MVC web application using embedded Jetty bundling up as JAR file but those didn’t involve any third party libs such as spring-batch-admin-XXX.jar dependencies that has predefined Spring configuration files.

I am newbie  to Jetty,  is there any sample  code (Embedded Jetty with spring-batch-admin or spring MVC WAR that has legacy spring IOC configuration )that I could follow the similar approach so that I would be able to run my application from command line (as shown above) by adding a bootstrap main java class.

 

Thanks much in advance for your help.

Deha

<?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>

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

</web-app>

Back to the top