Я пытаюсь упаковать Grizzly с Джерси в одну банку, используя плагин Maven Shade.Но я всегда получаю сообщение No container provider supports the type class org.glassfish.grizzly.http.server.HttpHandler
Код отлично работает в Eclipse, но не в упакованном банке:
public class Main {
private static URI getBaseURI() {
return UriBuilder.fromUri("http://localhost/").port(9998).build();
}
public static final URI BASE_URI = getBaseURI();
protected static HttpServer startServer() throws IOException {
System.out.println("Starting grizzly...");
ResourceConfig rc = new PackagesResourceConfig("share.test");
rc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
return GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
}
public static void main(String[] args) throws IOException {
HttpServer httpServer = startServer();
System.in.read();
httpServer.stop();
}
}
Вот полное исключение
$ java -jar target/webServiceTest-0.0.1-SNAPSHOT.jar
Starting grizzly...
Mar 20, 2012 12:48:53 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
share.test
Mar 20, 2012 12:48:54 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class share.test.NonJAXBBeanResource
class share.test.Hello
Mar 20, 2012 12:48:54 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Exception in thread "main" java.lang.IllegalArgumentException: No container provider supports the type class org.glassfish.grizzly.http.server.HttpHandler
at com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:196)
at com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:134)
at com.sun.jersey.api.container.grizzly2.GrizzlyServerFactory.createHttpServer(GrizzlyServerFactory.java:242)
at share.test.Main.startServer(Main.java:27)
at share.test.Main.main(Main.java:31)
Я создаю пакет jar, используя maven с
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>share.test.Main</Main-Class>
<Build-Number>1</Build-Number>
</manifestEntries>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Нужно ли мне менять плагин shade, чтобы включить что-нибудь еще?