The spec says otherwise (section 20.4): "An enterprise bean class with a component-defining annotation defines an enterprise bean component when packaged within the WEB-INF/classes directory or in a .jar file within WEB-INF/lib. An enterprise bean can also be defined via WEB-INF/ejb-jar.xml or the META-INF/ejb-jar.xml file of a .jar file within WEB-INF/lib."
Jarek On Mon, Sep 20, 2010 at 11:32 AM, Gurkan Erdogdu <[email protected]> wrote: >>>>First of all, as according to the spec the ejb-jar.xml can be >>>>placed in WEB-INF/ejb-jar.xml or within any jar file in WEB-INF/lib. > In Web Profile, ejb-jar.xml is only put into the WEB-INF/. Others ejb-jar.xml > files inside > WEB-INF/lib jars are not scanned or will be ignored. > > Look at , http://docs.sun.com/app/docs/doc/820-7627/bnblr?l=en&n=1&a=view > Packaging Enterprise Beans in WAR Modules section. > > """""""""""""""""""""""""" > > WAR modules that contain enterprise beans do not require an ejb-jar.xml > deployment descriptor. If the application uses ejb-jar.xml, it must be located > in the WAR module's WEB-INF directory. > JAR files that contain enterprise bean classes packaged within a WAR module > are > not considered EJB JAR files, even if the bundled JAR file conforms to the > format of an EJB JAR file. The enterprise beans contained within the JAR file > are semantically equivalent to enterprise beans located in the WAR module's > WEB-INF/classes directory, and the environment namespace of all the enterprise > beans are scoped to the WAR module. > """""""""""""""""" > > ----- Original Message ---- > From: Jarek Gawor <[email protected]> > To: [email protected] > Sent: Mon, September 20, 2010 6:07:18 PM > Subject: Re: What kind of module is a war with ejbs inside? > > I ran into additional problems with ejbs packaged in a war file. > Especially, when ejbs were packaged within some jar file in a war > file. First of all, as according to the spec the ejb-jar.xml can be > placed in WEB-INF/ejb-jar.xml or within any jar file in WEB-INF/lib. > So we really might need to scan all jars for the ejb descriptor. Also, > any ejbs within any of the jars are considered part of the same 'ejb > module'. And right now the deployer wants to deploy each jar with ejbs > as a separate ejb module. I opened OPENEJB-1362 to track these > problems. > > I have some local code that addresses these problems which I'm testing > right now. It basically gets rid off the preferEjb option alltogether, > creates a WebModule for any war file, and always adds a single > EjbModule for all ejbs in a war file (if detected) > > Let me know if you see some potential problems with this. > > Thanks, > Jarek > > On Mon, Aug 9, 2010 at 5:28 PM, David Blevins <[email protected]> wrote: >> >> On Aug 7, 2010, at 10:41 PM, David Jencks wrote: >> >>> I've been working on geronimo's ejb lite support. The way geronimo is set >>> up >>>we tell DeploymentLoader to look in META-INF or WEB-INF for ejb-jar.xml, and >>>expect openejb to decide that any module that it finds ejbs in, whether by >>>finding an ejb-jar.xml or by finding annotated classes, is an ejb module. >>> >>> Right now openejb is deciding that a module is an ejb module if it has an >>>ejb-jar.xml, but a web module if it has a web.xml but no ejb-jar.xml, even if >>>there are annotated ejbs. >>> >>> I don't understand why this would be appropriate for openejb, so what I'm >>>provisionally implementing is: >>> >>> - provide a flag in a constructor, preferEjb >>> - if its true, check for ejb-jar.xml and annotated ejbs before looking for >>>web.xml, and if found decide the module is an ejb module >>> - if its is false, the current behavior, where we check for ejb-jar.xml, >>> then >>>web.xml, then annotated ejbs. >>> >>> If the preferEjb=true behavior would be more appropriate for openejb by >>> itself, >>>let me know and I'll adjust the code appropriately. >> >> Using the discoverModuleType is probably not appropriate for this setup. In >>fact using the DeploymentLoader at all probably doesn't fit. The rules more >>or >>less allow us to skip that: >> >> 1. if the web.xml metadata complete flag is true and there is no >>WEB-INF/ejb-jar.xml == not a web module with ejbs >> 2. else, we must be prepared to deploy ejbs >> >> Probably what we need to do is create an EjbModule object to mirror every >>WebModule (or the equivalent Geronimo object) if #1 is not the case. >> >> The critical part will be setting the AbstractFinder object to be the same >> one >>as the WebModule finder and filling in the altDD information. It's actually >>pretty close to the way we do things now with creating an OpenEJB EjbModule >>object to match the Geronimo EjbModule object. >> >> Thoughts? >> >> -David >> >> > > > >
