3
votes

I'm trying to build an enterprise application which is assembled in an EAR. This application should contain one or more ejb-jars and one or more war's. I want to make heavily use of CDI, Interceptors and Producers. In the first step I want to use a Log-Producer which is placed in the ejb-jar in all areas of the application.

What I did is creating a beans.xml in the ejb/META-INF and the war/WEB-INF/ folders. Creating the EAR works. But deploying to the Glassfish Server (3.1) fails with a ClassNotFoundException of the Interceptor Class which is placed in the ejb-jar.

Removing the EAR and deploying the ejb-jar inside the war works as expected.

Due the reason of modularisation and the fact of having more war's and ejb-jar's a deployment based on an EAR is highly welcome.

So the question is: Is there a way to create a full featured EAR including CDI and all other nice stuff?

Thank you very much.

Cheers Ansgar

1

1 Answers

1
votes

We had similar problems with CDI on JBoss 6. The workaround for us was to configure the WAR deployer to use one global class loader scope togteher with the other applications deployed in the EAR file. By default each application in a WAR file uses its own class loader scope. Unfortunately I don't know whether there is a similar configuration available for Glassfish, but I guess there is.

There is an open ticket on the glassfish issue tracker, which might to relate to your problem as well.