i have a question about how to deploy multiple jars which contains CDi implementations together with a webapp.
This is my Jar Structure
-------- ---------- ------------
| WAR | <-- | API Jar | <-- | Data Jar |
-------- ---------- ------------
^
|
--------------
| Common Jar | And many more implementations
--------------
The WAR itself is the webapp which uses classes which are defines in the API Jar. The API jar only contains Interfaces, Annotations, non-logic classes, Qualifiers etc...
The implementation for the API is stored in different JARs, split by thematic. So all Data accessing/manipulating implementations in Data, security, logging, common and so on. This Implementations have the dependency to the API Jar and maybe Libraries. All packages communicates trough events.
We use CDI in every implementation and in the webapp. The complete configuration is only in the WAR.
I want to deploy everything in one EAR. So this is the file structure i use:
EAR
- META-INF/application.xml
- api.jar
- api classes, no beans.xml here
- common.jar
- api implementation for common project classes
- META-INF/beans.xml
- data.jar
- api implementation for data classes
- META-INF/beans.xml
- logging.jar
- api implementation for logging classes
- META-INF/beans.xml
- webapp.war
- classes
- ( project classes which uses the api)
- META-INF
- services
- persistence.xml
- WEB-INF/beans.xml
- beans.xml
- web.xml
My application.xml looks something like this:
<application 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/application_6.xsd" version="6">
<display-name>test-ear</display-name>
<module>
<java>api-1.0.0.jar</java>
</module>
<module>
<java>common-package-1.0.0.jar</java>
</module>
<module>
<java>data-package-1.0.0.jar</java>
</module>
<module>
<java>logging-package-1.0.0.jar</java>
</module>
<module>
<web>
<web-uri>test-war-1.0.0.war</web-uri>
<context-root>/war</context-root>
</web>
</module>
</application>
My problem is now, that this is not working at all. The CDI Container is complaining about missing some beans. I searched google about that, and found that the jars which contains a beans.xml mus be deployed as ejbModule, but here i need to create an ejb.jar for everything. An other result said i just need to add all dependencies to the WAR file in WEB-INF/lib. Same complaints here.
I cant get this running and try to request help here.
As server i want to use websphere (and maybe tomee).
Edit: Maven is uses to assemble all files together.
Thanks a lot, if anyone can help me out :)