|
From: Erki M. <sup...@gm...> - 2014-10-08 12:31:08
|
Hi
I created a rest client that gets the data from service and writes them to
JAXB annotated classes. To get that working I had to add
resteasy-jaxb-provider to dependencies. Anyway, now that I have packaged the
code into jar file, when I run it, I still get the error as if it was not
there (in the IDE works).
Exception in thread "main" javax.ws.rs.ProcessingException: Unable to find a
MessageBodyReader of content-type application/xml and type interface
java.util.List
at
org.jboss.resteasy.core.interception.ClientReaderInterceptorContext.throwRea
derNotFound(ClientReaderInterceptorContext.java:39)
at
org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getRea
der(AbstractReaderInterceptorContext.java:73)
Jar is generated with maven-assembly-plugin. All other things I have tested
so far seem to be working with the jar. Relevant code is:
<T> List<T> getList(String path, List<String[]> params, final Class<T>
clazz) {
GenericType<List<T>> type = getListType(clazz);
Response entity = getEntity(path, params);
return entity.readEntity(type);
}
private <T> GenericType<List<T>> getListType(final Class<T> clazz) {
ParameterizedType genericType = new ParameterizedType() {
public Type[] getActualTypeArguments() {
return new Type[]{clazz};
}
public Type getRawType() {
return List.class;
}
public Type getOwnerType() {
return List.class;
}
};
return new GenericType<List<T>>(genericType) {
};
}
pom:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.package.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Inside the jar there is:
\META-INF\maven\org.jboss.resteasy\resteasy-jaxb-provider\
BR,
Erki.
|