views:

397

answers:

2

Has anyone got this configuration working? Latest Netbeans, latest Glassfish, I created an EJB project, also an EE Application. The EJB in itself builds & deploys to Glassfish OK. Now when I want to reference the EJB, I have to add the EJB jar to the EE Application path, if I don't do this the code does not compile. But, the EJB jar gets packaged in the App jar and as a result when I try to deploy the app to Glassfish it says:

"java.lang.IllegalArgumentException: Sniffers with type [ejb] and type [appclient] should not claim the archive at the same time. Please check the packaging of your archive"

How do I tell Netbeans NOT TO package the EJB in the App jar? Or is the problem somewhere else?

btw. if I remove the EJB manually from the JAR then the app deploys successfully (with asadmin deploy), but when I try to run it with appclient, I get a NullPointerException.

Surely there must be a solution to this, I thought Netbeans was for web application development after all...

Edit: I found this:

http://forums.netbeans.org/topic23499.html

Which lists exactly the same steps that I did to resolve the problem.

A: 

Here is a solution candidate: https://netbeans.org/bugzilla/show_bug.cgi?id=183488

Which basically says that Glassfish v3 is seriously broken, and it won't work.

Gabor Kulcsar
Actually, the Netbeans "cart" sample works, but I still can't really see why. Oh well.
Gabor Kulcsar
GlassFish v3 isn't broken, it just works when properly used :)
Pascal Thivent
You are right, however it takes quite some time for a newbie to figure out what is supposed to be the "proper" way (no docs available - and tutorials are low quality, since they don't work out of the box)... Now that I figured this out it works like a charm!
Gabor Kulcsar
A: 

Here is how I got it to work: the EJB and the EE Application MUST BE packaged in an EAR (project), and they MUST BE deployed within the EAR. Deploying the application jar individually WILL NOT WORK (at least not with Netbeans 6.8 + Glassfish v3).

Gabor Kulcsar