Maven: How to exclude EJB jars from a War Module
It happened to me that when I build my multi-module maven project and deploy it to my glassfish server I receifed server errors like this:
[#|2008-06-28T23:26:31.815+0200|SEVERE|sun-appserver9.1|javax.enterprise.system.tools.deployment|
_ThreadID=14;
_ThreadName=Timer-7;_RequestID=dffabadc-2951-492d-9b98-88ada568fd33;
|Annotations processing failed for
/opt/glassfish/domains/domain1/applications/j2ee-apps/org.imixs.shareyourwork.ear-0.7.3/
org.imixs.shareyourwork.ejb-0.7.3_jar|#]
[#|2008-06-28T23:26:32.218+0200|SEVERE|sun-appserver9.1|javax.enterprise.system.tools.deployment|
_ThreadID=14;_ThreadName=Timer-7;_RequestID=dffabadc-2951-492d-9b98-88ada568fd33;
|Class org.imixs.workflow.jee.ejb.WorkflowServiceManagerImplementation is annotated with
@WebService and @Stateless but is packaged in a WAR. If it is supposed to be an EJB endpoint,
it should be packaged in a JAR; Deployment will continue assuming this class to be just a POJO
used by other classes in the WAR being deployed symbol: javax.jws.WebService
This happens because the EJB modules which are included using a dependency tag in my war module are also added into the WEB-INF/lib directory.
And this is not allowed or necessary because the EJB jars are available in the EAR / EJB modul.
So the solution to avoid this error message was to add the folling tag to the dependency tag of the war module:
<scope>provided</scope>
This means that the JARs of this dependency are not included into the /lib folder of the war module. So the deployment process will proceed without error messages.
Posted at 08:51PM Jun 28, 2008
Posted by: Ralph
Category: Maven