Java : Deploy restful web service without jersey -
thanks in advance. new in web services , when try deploy restful web service using java , generate exception. follow restful java jax-rs learn web services, according book chapter 3 ,i try build example , after deploying example generate exception , know , miss , don't know missing. following code of example .
<?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_3_0.xsd" id="webapp_id" version="3.0"> <display-name>restfultest</display-name> <servlet> <servlet-name>rest</servlet-name> <servlet-class>com.restfultest.controller.shoppingapplication</servlet-class> </servlet> <servlet-mapping> <servlet-name>rest</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
following class
public class shoppingapplication extends application { private set<object> singletons = new hashset<object>(); private set<class<?>> empty = new hashset<class<?>>(); public shoppingapplication() { singletons.add(new customerresources()); } @override public set<class<?>> getclasses() { return empty; } @override public set<object> getsingletons() { return singletons; } }
when try deploy application following exception occur.
java.lang.classcastexception: com.restfultest.controller.shoppingapplication cannot cast javax.servlet.servlet @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1144)
this silly question know , shoppingapplication
not servlet class accordin book ,it servlet class. call services , use chrome
restful client. please suggest me how use chrome restful client , how send xml
or json
request using client.
the problem telling class servlet not true. thre must problem in documentation following. take @ http://www.ibm.com/developerworks/library/wa-aj-tomcat/
Comments
Post a Comment