quality@glassfish.java.net

EJB development with Maven, making it easier and more fool proof.

From: Richard Kolb <rjdkolb_at_gmail.com>
Date: Tue, 16 Mar 2010 09:02:24 +0200

Hi Hong and Cats

Relating to this issue
:https://glassfish.dev.java.net/issues/show_bug.cgi?id=11642
I have been thinking quite a bit on how to solve this tripping up
developers.

Here is the example of what is happening now :
1) Start NetBeans 6.8
2) Create EJB Maven project
3) Create a stateless session bean classed Stateless1 and local interface
Stateless1Local
4) Create a stateless session bean classed Stateless2 and local interface
Stateless2Local
5) Add a member to Stateless2 'private Logger logger =
Logger.getLogger(Stateless2.class);'
6) Add add a Maven dep 'log4j:log4j'
7) deploy application to GlassFish 3
8) Go to the GlassFish 3 admin gui. Click on the deployed project.
Stateless2 will be missing
9) A log is created in the server.log that indicated Stateless2 has a
ClassNotFoundException
10) This is because Maven's EJB package does not bundle libs

Here is the example of what is happening now with normal NetBeans projects:
1) Start NetBeans 6.8
2) Create EJB NetBeans project
3) Create a stateless session bean classed StatelessA and local interface
StatelessALocal
4) Create a stateless session bean classed StatelessB and local interface
StatelessALocal
5) Add a member to StatelessB 'private Logger logger =
Logger.getLogger(StatelessB.class);'
6) Add add a NB dep library
7) deploy application to GlassFish 3
8) Go to the GlassFish 3 admin gui. Click on the deployed project.
StatelessA and StatelessB are there
9) This is because NetBeans's EJB package bundle libs


There is a simple solution to solve this.
Add the following to the Maven pom.xml
http://maven.apache.org/plugins/maven-assembly-plugin/usage.html

Obviously not bundling all the libs with the project is a feature, but it is
an advanced feature.

I propose adding a feature request for NetBeans to add a tick box when
creating a Maven EJB to add this Maven plugin.

Does this make sense ?
Any comments will greatly be appreciated.


regards
Richard