I have a RestEasyClient which initialize as follows and uses the Jboss AS 7.1 resteasy module
@PostConstruct
public void initializeClient() {
log.info("In initializeClient");
HttpClient httpClient = new DefaultHttpClient();
ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);
ResteasyProviderFactory.getInstance().registerProvider(
ServiceExecutionInterceptor.class);
clientService = ProxyFactory.create(MyProjectClientService.class,
getWebserviceURL(), executor);
}
This throws following error during server startup
Caused by: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl from [Module "javax.ws.rs.api:main" from local module loader @5ad557c2 (roots: C:\Program Files\jboss-eap-6.0\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_32]
at java.lang.Class.forName(Class.java:169) [rt.jar:1.6.0_32]
at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:77)
at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:201)
at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:113)
My pom.xml is as follows
Pom.xml
<!-- Import the JAX-RS API, we use provided scope as the API is included
in JBoss AS 7 -->
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Resteasy Dependencies -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${resteasy.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>${resteasy.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>${resteasy.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
</dependency>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>org.jboss.resteasy.resteasy-jaxrs,
org.jboss.resteasy.resteasy-jaxb-provider,
org.jboss.resteasy.resteasy-jackson-provider,
org.apache.httpcomponents</Dependencies>
<version>${project.version}</version>
</manifestEntries>
</archive>
</configuration>
</plugin>
Please help me in this.
I solved the issue by using jboss-deployment-structure.xml in my war, which needs to be placed in WEB_INF folder.
There are 2 other ways
1) Adding dependency in META-INF file as below
2) Declare them as global module in the configuration file domain.xml/standalone.xml