One of the greatest features of Java EE 6 is the ability to package EJBs inside a WAR. I've done this for a few projects w/out a hitch, until now. I'm using Java EE 6, Glassfish 3.1 and deploying my application as a WAR. I want the ability to control the number of beans that are being开发者_如何学编程 created by the app server. Previously I would do so by specifying the proper values inside the sun-ejb-jar.xml file in my EJB jar which lived in my EAR.
When I put a sun-ejb-jar.xml file in my WAR at /WEB-INF/classes/ it doesn't seem to be honored by Glassfish.
Ideas?
Thanks, -Jay
I see this in the EJB 3.1 spec. Chapter 20 'Packaging'; Section 4 (around page 589 of the pdf of the spec that you can download from the JCP site: http://jcp.org/aboutJava/communityprocess/final/jsr318/index.html)
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.
The first part of this incredibly complex sentence is talking about class files; not the deployment descriptor.
Since the ejb-jar.xml and the sun-ejb-jar.xml file are often seen 'together', you may want to put the file WEB-INF, next to ejb-jar.xml and web.xml.
The bean I am defining is an MDB and I forgot to include the information. Once I did the file appears to be picked up by Glassfish.
精彩评论