Spring 4 RESTful webservice Hello World & JSON response example

In this tutorial, let us see how to create Hello World Restful webservice in Spring 4 in eclipse without using Maven. Spring provides a built-in support for restful service. It is very simple to create restful webservice in Spring. In this tutorial, let us create two services

1. HelloWorldService: this service accepts request parameter “name” and returns a response “Hello<name> ” as String. The name can be passed as request parameter or path variable.

2. GetProductDetailsService : this service accepts “itemcode” and returns  response with item details and price as JSON. For returning JSON, we will use Jackson java library in this example which converts Object (POJO) to JSON and Vice versa. The itemcode is passed as request parameter or path variable.

Technology & Jars Used:

JDK 1.8

Spring 4.0 or above

jackson-annotations-2.5.4.jar

jackson-core-2.2.0.jar

jackson-databind-2.1.4.jar

Eclipse IDE

Tomcat v7.0

Annotations used :

i) @RestController:

In Spring RESTful web services, HTTP requests are handled by a controller. To make a java class as controller for handling restful webservice, just add @RestController annotation just above the class definition.

@RequestMapping:

The @RequestMapping annotation maps the HTTP requests with a java class ( controller i.e handler classes) and/or any java methods.

@PathVariable: Retrieves some value from the uri (excludes base URI i.e.  http://localhost:8080/SpringRestService/hello)  and maps to the path variable.  The below code explains about @PathVariable annotation.

http://localhost:8080/SpringRestService/hello/John/Paul

@RestController
@RequestMapping("/hello")
public class HelloWorldService {
   @RequestMapping(value = "/{firstName}/{lastName}", method = RequestMethod.GET)
   	public String helloMethod2(@PathVariable String firstName, @PathVariable String lastName)    {
    ...
    ..}
   }

In the above url, the value John is mapped to path variable firstName and Paul is mapped to lastName

@RequestParam: The @RequestParam binds request parameter to the corresponding method parameter in the controller.

http://localhost:8080/SpringRestService/getProduct?itemcode=1

@ResponseBody: To convert any method’s returned object to JSON or any other formats like XML, text, etc.., the method may be annotated with @ResponseBody. Spring converts the returned object to other formats (i.e JSON,etc..) by using an HttpMessageConverter. @ResponseBody also indicates that the return data is written to the body of response.

In this example, HttpMessageConverter is implemented by Jackson2MessageConvertor that can convert return object to JSON and vice versa using Jackson 2.x’s ObjectMapper.

To configure bean to convert JSON to Object and vice versa, the following lines are used in the rest-servlet.xml which will have REST related configuration.  rest is the servlet name  of servlet class of org.springframework.web.servlet.DispatcherServlet in web.xml

   <!-- for processing requests with annotated controller methods and set Message Convertors from the list of convertors -->
    <beans:bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
        <beans:property name="messageConverters">
            <beans:list>
                <beans:ref bean="jsonMessageConverter"/>
            </beans:list>
        </beans:property>
    </beans:bean>

    <!-- To  convert JSON to Object and vice versa -->
    <beans:bean id="jsonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
    </beans:bean>

Complete rest-servlet.xml is given at the end of this tutorial.

Now let us create two restful web services (HelloWorldService & GetProductDetailsService) with Spring 4 in Eclipse without maven.

1. Create a Dynamic Web Project (SpringRestService)

spring rest ws1 spring rest ws2 spring rest ws3

Final Project Directory Structure:

Spring Restful service directory structure Spring Restful service directory structure1

2. Create model (POJO) for ProductDetails


 package net.javaonline.spring.restful.model;

public class ProductDetails {

	String itemcode="";
	String description="";
	float MRP=0;
	float itemprice=0;
	float discount=0;

	public ProductDetails(String itemcode,String description, float MRP,  float discount)
		{
			this.itemcode=itemcode;

			this.description=description;

			this.MRP=MRP;

			this.itemprice=MRP-discount;

			this.discount=discount;

		}

	public String getItemcode() {
		return itemcode;
	}
	public void setItemcode(String itemcode) {
		this.itemcode = itemcode;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public float getMRP() {
		return MRP;
	}
	public void setMRP(float mRP) {
		MRP = mRP;
	}
	public float getItemprice() {
		return itemprice;
	}
	public void setItemprice(float itemprice) {
		this.itemprice = itemprice;
	}
	public float getDiscount() {
		return discount;
	}
	public void setDiscount(float discount) {
		this.discount = discount;
	}

}

3. Create HelloWorldService and GetProductService controller

HelloWorldService.java

package net.javaonline.spring.restful.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hello")
public class HelloWorldService {

	@RequestMapping
    public String helloMethod1(@RequestParam(value="name", defaultValue="World") String name) {

    	  return   "Hello  "+ name;
    }

	@RequestMapping(value = "/{firstName}/{lastName}", method = RequestMethod.GET)
   	public String helloMethod2(@PathVariable String firstName, @PathVariable String lastName) {
   		return "Hello "+ firstName + " " + lastName;
    	}    

}

GetProductService.java

package net.javaonline.spring.restful.controller;

import net.javaonline.spring.restful.dao.GetProductDetailsDAO;
import net.javaonline.spring.restful.model.ProductDetails;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GetProductDetailsService {

    @RequestMapping("/getProduct")
    public @ResponseBody ProductDetails getProductMethod1(@RequestParam(value="itemcode", defaultValue="1") String itemcode) {
    	GetProductDetailsDAO pdDao=new GetProductDetailsDAO();
    	  return  pdDao.getProductDetails(itemcode);
    }

    @RequestMapping("/getProduct/{itemcode}")
    public @ResponseBody ProductDetails getProductMethod2(@PathVariable(value="itemcode")  String itemcode) {
    	GetProductDetailsDAO pdDao=new GetProductDetailsDAO();
    	  return  pdDao.getProductDetails(itemcode);
    }

}

GetProductDetailsDAO.java //to retrieve item details

package net.javaonline.spring.restful.dao;

import java.util.HashMap;
import java.util.Map;

import net.javaonline.spring.restful.model.ProductDetails;

public class GetProductDetailsDAO {

	Map<String, ProductDetails> products = new HashMap<String, ProductDetails>();

	public GetProductDetailsDAO()
	{

		//product details to be retrieved from the database. 

		products.put("1", new ProductDetails("1", "LCD TV", 60000, 4000));
		products.put("2", new ProductDetails("2", "LED TV", 70000, 5000));
		products.put("3", new ProductDetails("3", "AC", 40000, 3000));
		products.put("4", new ProductDetails("4", "Laptop", 50000, 1000));

	}

	public ProductDetails getProductDetails(String itemcode)
	{

		return products.get(itemcode);

	}

}

In the second example i.e GetProductDetails service accepts itemcode and returns JSON as response.

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>SpringRestFulService</display-name>

<servlet>
	<servlet-name>rest</servlet-name>
	<servlet-class>
		org.springframework.web.servlet.DispatcherServlet
	</servlet-class>
	<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
	<servlet-name>rest</servlet-name>
	<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>

rest-servlet.xml

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

    <!-- Enables the Spring MVC @Controller programming model -->
    <annotation-driven />

   <!-- for processing requests with annotated controller methods and set Message Convertors from the list of convertors -->
    <beans:bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
        <beans:property name="messageConverters">
            <beans:list>
                <beans:ref bean="jsonMessageConverter"/>
            </beans:list>
        </beans:property>
    </beans:bean>

    <!-- To  convert JSON to Object and vice versa -->
    <beans:bean id="jsonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
    </beans:bean> 

    <context:component-scan base-package="net.javaonline.spring.restful" />

</beans:beans>

For accessing the services :

HelloWorldService

http://localhost:8080/SpringRestService/hello?name=Jegan%20kumar

http://localhost:8080/SpringRestService/hello/Jegan/kumar

Output:

spring rest ws output1

GetProductDetailsService

http://localhost:8080/SpringRestService/getProduct

http://localhost:8080/SpringRestService/getProduct?itemcode=1

Output JSON:

spring rest ws output2

Default value for itemcode is 1 if it is not passed.

 

http://localhost:8080/SpringRestService/getProduct/4/

spring rest ws output3

Reference :  Building a RESTful Web Service in Spring

You can download the above spring webservice application including jar files at

Leave a Reply

23 Comments on "Spring 4 RESTful webservice Hello World & JSON response example"


Guest
sam
16 days 22 hours ago

hi after reading the below comments and i tried got the below error
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 4.0.30319.42000
System.Deployment.dll : 4.6.1087.0 built by: NETFXREL4STAGE
clr.dll : 4.6.1087.0 built by: NETFXREL4STAGE
dfdll.dll : 4.6.1087.0 built by: NETFXREL4STAGE
dfshim.dll : 4.0.41209.0 (Main.041209-0000)

SOURCES
Deployment url : http://localhost:8080/springrestservice/hello/sam/jack

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of http://localhost:8080/springrestservice/hello/sam/jack resulted in exception. Following failure messages were detected:
+ Exception reading manifest from http://localhost:8080/springrestservice/hello/sam/jack: the manifest may not be valid or the file could not be opened.
+ Data at the root level is invalid. Line 1, position 1.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.

WARNINGS
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [5/12/2017 6:14:16 PM] : Activation of http://localhost:8080/springrestservice/hello/sam/jack has started.

ERROR DETAILS
Following errors were detected during this operation.
* [5/12/2017 6:14:16 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
– Exception reading manifest from http://localhost:8080/springrestservice/hello/sam/jack: the manifest may not be valid or the file could not be opened.
– Source: System.Deployment
– Stack trace:
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
— Inner Exception —
System.Xml.XmlException
– Data at the root level is invalid. Line 1, position 1.
– Source: System.Xml
– Stack trace:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read()
at System.Xml.XsdValidatingReader.Read()
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

Guest
sam
16 days 23 hours ago

i am always getting 404 the requested resources is not avaliable .below is what i get

May 12, 2017 5:29:05 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:springrestservice’ did not find a matching property.
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.43
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Mar 28 2017 14:42:59 UTC
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.43.0
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:Program FilesJavajre7
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_79-b15
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:Usersksadag200Desktopworkspace-sample.metadata.pluginsorg.eclipse.wst.server.coretmp0
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:Usersksadag200Downloadsapache-tomcat-8.0.43-windows-x64apache-tomcat-8.0.43
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:Usersksadag200Desktopworkspace-sample.metadata.pluginsorg.eclipse.wst.server.coretmp0
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:Usersksadag200Downloadsapache-tomcat-8.0.43-windows-x64apache-tomcat-8.0.43
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:Usersksadag200Desktopworkspace-sample.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebapps
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:Usersksadag200Downloadsapache-tomcat-8.0.43-windows-x64apache-tomcat-8.0.43endorsed
May 12, 2017 5:29:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 12, 2017 5:29:05 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:Program FilesJavajre7bin;C:windowsSunJavabin;C:windowssystem32;C:windows;C:/Program Files (x86)/Java/jre1.8.0_91/bin/client;C:/Program Files (x86)/Java/jre1.8.0_91/bin;C:/Program Files (x86)/Java/jre1.8.0_91/lib/i386;C:Program Files (x86)RSA SecurID Token Common;C:ProgramDataOracleJavajavapath;C:windowssystem32;C:windows;C:windowsSystem32Wbem;C:windowsSystem32WindowsPowerShellv1.0;C:windowsSystem32WindowsPowerShellv1.0;C:Program Files (x86)SymantecVIP Access Client;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Usersksadag200Downloadsspring-tool-suite-3.8.4.RELEASE-e4.6.3-win32sts-bundlests-3.8.4.RELEASE;;.
May 12, 2017 5:29:05 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [“http-nio-8080”]
May 12, 2017 5:29:05 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 12, 2017 5:29:05 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [“ajp-nio-8009”]
May 12, 2017 5:29:05 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 12, 2017 5:29:05 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 809 ms
May 12, 2017 5:29:05 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 12, 2017 5:29:05 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.43
May 12, 2017 5:29:06 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [360] milliseconds.
May 12, 2017 5:29:10 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 12, 2017 5:29:10 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 12, 2017 5:29:11 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet ‘rest’
May 12, 2017 5:29:11 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet ‘rest’: initialization started
May 12, 2017 5:29:11 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace ‘rest-servlet’: startup date [Fri May 12 17:29:11 EDT 2017]; root of context hierarchy
May 12, 2017 5:29:11 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/rest-servlet.xml]
May 12, 2017 5:29:13 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped “{[/getProduct],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}” onto public net.javaonline.spring.restful.model.ProductDetails net.javaonline.spring.restful.controller.GetProductDetailsService.getProductMethod1(java.lang.String)
May 12, 2017 5:29:13 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped “{[/getProduct/{itemcode}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}” onto public net.javaonline.spring.restful.model.ProductDetails net.javaonline.spring.restful.controller.GetProductDetailsService.getProductMethod2(java.lang.String)
May 12, 2017 5:29:13 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped “{[/hello],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}” onto public java.lang.String net.javaonline.spring.restful.controller.HelloWorldService.helloMethod1(java.lang.String)
May 12, 2017 5:29:13 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped “{[/hello/{firstName}/{lastName}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}” onto public java.lang.String net.javaonline.spring.restful.controller.HelloWorldService.helloMethod2(java.lang.String,java.lang.String)
May 12, 2017 5:29:13 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped “{[/myservice/{name}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}” onto public java.lang.String net.javaonline.spring.restful.controller.SpringServiceController.getGreeting(java.lang.String)
May 12, 2017 5:29:15 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet ‘rest’: initialization completed in 4080 ms
May 12, 2017 5:29:15 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [“http-nio-8080”]
May 12, 2017 5:29:15 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [“ajp-nio-8009”]
May 12, 2017 5:29:15 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9646 ms
May 12, 2017 5:29:16 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/springrestservice/] in DispatcherServlet with name ‘rest’

Guest
Oleg
1 month 23 days ago

Hi VK.

Your blog looks exactly as what I need, would be very useful for me.
The only thing is that I can’t download the source code (maybe firewall issues or service is down).
Could please verify / fix it?

TIA,
Oleg.

Guest
Priyanka
5 months 29 days ago

Hi VK,
I imported the war which you provided, Iam getting the error as

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RestSpingWS]]
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:915)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RestSpingWS]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
… 6 more

Can you please help me to solve this. Thanks in advance

Guest
Vinod
9 months 4 days ago

Thanks for this startup example .