开发者

Where is the documentation for sun-ejb-jar.xml & ejb-jar.xml version 3.1?

I must have a really bad day cause no matter what I search for I only get to this link which has only the listing for the allowed XML tags for those deployment descriptors.

I'm pretty sure I saw once a document with a thorough description 开发者_如何学运维of those files, but I can't seem to find it right now.


:) GF Application Deployment Guide -> Elements of the Enterprise Server Deployment Descriptors


sun-ejb-jar.xml is an old naming convention for what is today called glassfish-ejb-jar.xml. It is still supported for backward compatibility (see the GlassFish 4 deployment guide, page B-2).

glassfish-ejb-jar.xml is a GlassFish specific deployment descriptor file, documented in the deployment guide. The deployment guide describes its technical structure and is a good start for any question you might have about a specific element of the file. Examples of how-to really use the file is spread out through the entire document base.

All other application servers will most likely ignore this file. Making your application dependent on the contents of this file is the same as making your application non-portable. Thus, it should be avoided as much as possible.

Let me quote the GlassFish deployment guide (page 1-3):

Unless otherwise stated, settings in the GlassFish Server deployment descriptors override corresponding settings in the Java EE standard descriptors and in the GlassFish Server configuration.

The overridable standard and portable descriptor file is ejb-jar.xml and is described in the EJB 3.2 specification. The presence of the file is optional and should probably not be used if all you do with the file is describe bean behavior and services from the application server that is used. Unless application developer and application deployer is different persons with different needs, or unless you have a requirement to define different beans based on the same class, then you'll be more than covered using annotations only. That way, declared application server services is more tightly bounded to the code that actually uses the services. It will increase the readability of your code and make more sense to more people. One arguable important and encouraged use of the file is to put customizable environment entries in the descriptor file. If your application is packaged in an EAR file, consider using the application.xml descriptor file for declaration of environment entries instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜