JBoss Descriptor Files

The DEPLOYMENT DESCRIPTOR

The ejb-jar.xml is a deployment descriptor that is common to all application servers and after configuration supplies the application server container the information required to deploy the beans in the jar/ear files.
It describes the entity or session beans that are included in the application. It is also responsible for declaring those fields in entity beans that are container managed.
It may have the following skeletal structure:

<enterprise-beans>
       <entity>......</entity>
       <session>.....</session>
</enterprise-beans>

Every ejb-jar.xml has exactly one

<enterprise-beans>

tag, which may contain

<session>

, or

<entity>

tags.
The

<session>

tag contains the names of the home, remote and the bean class as well as some other info.
The

<ejb-name>

tag contains the descriptive name of the bean.
The tag contains the fully qualified name of the home class.
The

<remote>

tag contains the fully qualified name of the remote class.
The

<ejb-class>

tag contains the fully qualified name of the bean class.

<session-type>

and are specific to session beans.
The tag states whether the session bean is stateless or stateful.
are specific to session beans and is used to specify whether transactions are container managed or bean managed.

<ejb-ref>

is used to map the bean references used within the session bean.
tells whether it is a session or entity bean that is mapped.
In case of entity beans there is a tag that contains the fully qualified name for the entity bean’s primary key class.
This may be a primitive data type such as java.lang.String for a simple key or a fully qualified primary key class name for a compound key
The

<reentrant>

tag declares whether the bean can call another bean, which calls the original bean.
The

<cmp-field>

tag contains a tag that describes the CMP fields in the entity bean.
Lastly the

<primkey-field>

tag contains the name of the primary key field (for simple pry key types) and is not required for compound keys. (In case the

<prim-key-class>

specifies a primitive type such as java.lang.String.)

THE JBOSS CONTAINER SPECIFIC XML DESCRIPTOR FILES

jboss.xml
jboss.xml is a container specific configuration file that is used to define the jndi names for the beans in the package.

jaws.xml
jaws.xml is required while deploying entity beans.
It maps a bean to a data table and the instance variables of a bean to the fields in the database.
Container managed finder methods are also described in jaws.xml

THE WEB CONTAINER DESCRIPTOR

web.xml
web.xml contains the descriptive names for the servlets in the application as well as the fully qualifed servlet name.
It also maps the servlet to a url pattern.
Note:
http://{hostname}:{portnumber}/{context}/{url-pattern}
hostname is “localhost”
portnumber is “8080”
context (in application.xml) is for eg. “interest” (usually the same name as the .war file)
url-pattern (in web.xml) is for eg. /InterestServlet
so the url becomes
http://localhost:8080/interest/InterestServlet

About cuppajavamattiz
Matty Jacob - Avid technical blogger with interests in J2EE, Web Application Servers, Web frameworks, Open source libraries, Relational Databases, Web Services, Source control repositories, ETL, IDE Tools and related technologies.

Comments are closed.

%d bloggers like this: