web services - Facing java.lang.IncompatibleClassChangeError -
trying make simple restful service.
i used tutorial link
here link of jar using in program
after follow each , every step ..... face error.
please ...
pom.xml
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.javacodegeeks.enterprise.rest.jersey</groupid> <artifactid>jaxrs-helloworld</artifactid> <version>0.0.1-snapshot</version> <repositories> <repository> <id>maven2-repository.java.net</id> <name>java.net repository maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> </repository> </repositories> <dependencies> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-server</artifactid> <version>1.9</version> </dependency> </dependencies> </project>
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" 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>restful web application</display-name> <servlet> <servlet-name>jersey-helloworld-serlvet</servlet-name> <servlet-class> com.sun.jersey.spi.container.servlet.servletcontainer </servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.javacodegeeks.enterprise.rest.jersey</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-helloworld-serlvet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping>
java file
package com.javacodegeeks.enterprise.rest.jersey; import javax.ws.rs.defaultvalue; import javax.ws.rs.get; import javax.ws.rs.path; import javax.ws.rs.pathparam; import javax.ws.rs.queryparam; import javax.ws.rs.core.response; @path("/helloworldrest") public class helloworldrest { @get @path("/{parameter}") public response responsemsg( @pathparam("parameter") string parameter, @defaultvalue("nothing say") @queryparam("value") string value) { string output = "hello from: " + parameter + " : " + value; return response.status(200).entity(output).build(); }
}
error
mar 28, 2015 6:51:17 pm org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [jersey-helloworld-serlvet] in context path [/jaxrs-helloworld] threw exception [servlet execution threw exception] root cause java.lang.incompatibleclasschangeerror: class javax.ws.rs.core.response$status not implement requested interface javax.ws.rs.core.response$statustype @ com.sun.jersey.spi.container.containerresponse.getstatus(containerresponse.java:599) @ com.sun.jersey.spi.container.containerresponse$committingoutputstream.commitwrite(containerresponse.java:157) @ com.sun.jersey.spi.container.containerresponse$committingoutputstream.write(containerresponse.java:134) @ sun.nio.cs.streamencoder.writebytes(unknown source) @ sun.nio.cs.streamencoder.implflushbuffer(unknown source) @ sun.nio.cs.streamencoder.implflush(unknown source) @ sun.nio.cs.streamencoder.flush(unknown source) @ java.io.outputstreamwriter.flush(unknown source) @ java.io.bufferedwriter.flush(unknown source) @ com.sun.jersey.core.util.readerwriter.writetoasstring(readerwriter.java:191) @ com.sun.jersey.core.provider.abstractmessagereaderwriterprovider.writetoasstring(abstractmessagereaderwriterprovider.java:128) @ com.sun.jersey.core.impl.provider.entity.stringprovider.writeto(stringprovider.java:88) @ com.sun.jersey.core.impl.provider.entity.stringprovider.writeto(stringprovider.java:58) @ com.sun.jersey.spi.container.containerresponse.write(containerresponse.java:302) @ com.sun.jersey.server.impl.application.webapplicationimpl._handlerequest(webapplicationimpl.java:1510) @ com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1419) @ com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1409) @ com.sun.jersey.spi.container.servlet.webcomponent.service(webcomponent.java:409) @ com.sun.jersey.spi.container.servlet.servletcontainer.service(servletcontainer.java:558) @ com.sun.jersey.spi.container.servlet.servletcontainer.service(servletcontainer.java:733) @ javax.servlet.http.httpservlet.service(httpservlet.java:728) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:305) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:222) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:123) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:472) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:99) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:947) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1009) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:589) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:310) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source)
Comments
Post a Comment