I think Jersey uses the Jackson JSON library, like Avro does. The Schema class
is the first class in the chain that references jackson classes. If the
version of Jackson that Jersey uses is old enough, that might be the problem.
Its version likely comes first in the classpath. Some of the 1.0.x Jackson
versions are known to be incompatible with later Jackson 1.x versions.
The trace below is cryptic, but the first place I would look would be a jar
file conflict in a common dependeny.
On Sep 29, 2010, at 7:30 PM, Ta-Chung Tsai wrote:
We've developed a web service using Jersey and used Avro HTTPTransceiver as a
RPC to fetch some status from a server.
However, after deploying on Tomcat6, I got the following error, no matter what
protocols I used.
java.lang.VerifyError: (class: org/apache/avro/Schema, method: <clinit>
signature: ()V) Incompatible argument to function
at org.apache.avro.ipc.Requestor.<clinit>(Requestor.java:50)
at main.com.trendmicro.wrs.region_ptn.TestResource.getRes(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:165)
at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
at
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276)
at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171)
at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043)
at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406)
at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477)
at
com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:833)
at
com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:806)
at
com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:767)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
My test program is as follows:
@Path("/testavro")
public class TestResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getRes()
{
try {
HttpTransceiver client = new HttpTransceiver(new
URL("http://serverURL:10080<http://10.1.112.159:10080/>"));
Region proxy = (Region) SpecificRequestor.getClient(Region.class, client);
Stat ret = proxy.getTest("id");
return "ok";
} catch (MalformedURLException e) {
return "malformedURL:" + e;
} catch (IOException e) {
return "ioException: " + e;
}
}
}
If I put the same program in main(), it can be executed smoothly without
exception. I am sure the classpath is correct by deleting avro-1.3.3.jar.
The same problem occurs in both avro-1.3.3 and avro-1.4.0.
Do I miss something here?
---
Terry Tsai