Deploying web service from EAR's lib
havramm Apr 9, 2014 7:01 AMHi,
I would like to deploy a class (EJB3) found in a jar placed within the lib folder of an EAR as a Web Service and I would like to do it by using deployment descriptors. Deployment of the class as a SLSB by using descriptors works fine, but I do not have a success to deploy it also as a WebService. I have used this approach earlier (JBossAS 4.2.3) and it has given the desired result (EJB3 from lib folder was deployed as Web Service).
Here is the sketch of the artifacts and the contents of the relevant ones:
+-test.ear | +-lib | +-services.jar | +-TestService.class (1) | +-depl.jar +-META-INF +-ejb-jar.xml (2)
(1) - TestService.class:
package test;
import javax.ejb.Stateless;
import javax.jws.WebService;
@Stateless
@WebService
public class TestService {
public String sayHello() {
return "Hello, World!";
}
}
This class is "as-is" - it's annotations have to be as they are (). Also, it cannot be deployed as an EJB (placed in the root of an EAR) because it needs to be used also as a shared library.
(2) - ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0"> <enterprise-beans> <session> <ejb-name>TestService</ejb-name> <ejb-class>test.TestService</ejb-class> <session-type>Stateless</session-type> </session> </enterprise-beans> </ejb-jar>
Bottom line: there is a EJB3 class within a shared library that should be deployed as a Web Service somehow. Does anybody have any idea or suggestion how to achieve a desired behavior? Target is WildFly 8.0.0.Final.
I have also tried to experiment with jboss-webservices.xml descriptors, but without a success.
Thanks in advance.