users@glassfish.java.net

EJB Module with Entity class in library

From: <glassfish_at_javadesktop.org>
Date: Thu, 03 Dec 2009 03:24:20 PST

I am using Netbeans 6.8RC1 and Glassfish v3-b73 to develop an EJB module that contains a EJB session bean.

The session bean instantiates and persists an entity class that I developed in a standard Java application project.

Everything compiles fine, but when I try and deploy to Glassfish I get the error:

-------------------------------------------------------------------------------------------------
SEVERE: Class [ org/gadnex/vehicle/entity/VehicleException ] not found. Error while loading [ class org.gadnex.vehicle.ejb.VehicleSessionBean ]
WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/gadnex/vehicle/entity/VehicleException
SEVERE: Exception while deploying the app
java.lang.IllegalArgumentException: Invalid ejb jar [VehicleEJB]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
-------------------------------------------------------------------------------------------------

If I move my Vehicle and VehicleException classes to the EJB project it compiles and deployes fine.

I specifically want my entity classes to be in a separate Java project and thus jar file, so that I can reuse my entity classes in my Swing front end application as well.

I used to be able to do this with Netbeans 6.7 and Glassfish v2ur2 without any problems.

Any help will be apreciated.
[Message sent by forum member 'gadnex' ]

http://forums.java.net/jive/thread.jspa?messageID=374506