Create EAR with EJB3 and JAX-WS
oskar.carlstedt Mar 15, 2007 12:01 PMHello!!
I have been struggling a whole day now with this topic. Reading a lot of forum questions and tips, but I can't find a solution. Now I hope some of you can help me.
I want to deploy an ear file containing a jar file that contains an EJB. The ejb jar file also contains a JAX-WS-web service endpoint provider that will "lookup" a session bean containing business methods for the actual web service request.
I have a couple of problems. JBoss (version 4.2.0.CR1). I always get the message:
16:17:41,057 WARN [verifier] EJB spec violation: Bean : TestEjb Section: 22.2 Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element. Info : Class not found on 'some.package.TestEJB': No ClassLoaders found for: some.package.TestEJB
Of course, I don't have any TestEJB class. I really can't understand why it is questioning about it.
I have an interface
public interface Test { ... }
And I have a class
@Stateless public class TestBean implements Test { ... }
My JAX-WS Service enpoint provider looks something like:
@Stateless @WebServiceProvider( serviceName = "Test", portName = "TestSoap11Port", targetNamespace = "http://my.domain.com/test-service", wsdlLocation = "WEB-INF/wsdl/test-service.wsdl") @ServiceMode(value = Service.Mode.PAYLOAD) public class TestEndpointProvider implements Provider<Source> { /** * The sei to use */ private Object sei = null; @Resource protected WebServiceContext webServiceContext; /** * Does everything that must be done. This method is a kind of dispatcher * that finds the business method to invoke. Invokes the method and * serializes the response. */ public Source invoke(Source requestSource) { try { ... // instantiate the sei InitialContext initialContext = new InitialContext(); sei = initialContext.lookup(some.package.Test.class.getName()); // get business method Method wsdlJavaMethod = getWsdlJavaMethod(); // invoke method XmlObject xmlResponseObject = (XmlObject) wsdlJavaMethod.invoke(sei, xmlRequestObject); ... } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new WebServiceException(e); } } }
I have tried to annotate my EJB with the @Local(Test.class) and also the EJB annotation @EJB(beanInterface=Test.class, name="Test").
The JAX-WS service endpoint provider does also have a Stateless annotation. Can this bean mess it up?
The other thing is that JBoss reject to load my jar files included in the EAR file. All jar dependencies are on the classpath in the META-INF/MAINIFEST.MF file (generated by maven).
My ear file has the following structure:
test-ear-1.0-SNAPSHOT META-INF jboss-app.xml lib ... test-ejb-1.0-SNAPSHOT.jar
jboss-app.xml
<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd"> <jboss-app> <loader-repository> some.package:loader=test-ear-1.0-SNAPSHOT </loader-repository> </jboss-app>
Does anyone know how I can fix these problems? DO I need anejb-jar.xml when I'm using EJB3. Do I have to configure JBoss 4.2.0.CR1. I get the same error in JBoss 4.0.5.GA with a jboss-EJB-3.0_RC9_Patch_1 installed.
Best
Oskar