JBoss Reference Module Description

Source: Internet
Author: User
Tags documentation first row jboss

Assuming that the installation directory for JBoss EAP is%{jboss_home}, the storage path for the MODULE provided by JBoss default is:%{jboss_home}/modules, which is known as%{jboss_module}. The module in EAP 6.1 has the following screenshot:


Before you say the reference to the module, let's talk about customizing a module.

The custom module is generally stored in the%{jboss_module}/com directory. Since the system provides so many module by default, let's choose one for reference. Here I refer to: \com\google\guava, the screenshot is as follows:

The key is module.xml this document, which is the configuration of this module, the content is as follows:
Properties are some of the attributes that will be used when the system resolves this module. The resources are the jar package names for this module, which are placed in the same directory as the module. Dependencies refers to the information of the other module that this module relies on. It is important to note that the value of the Name property of the first row must be consistent with the path of the module. Than
The path to this module is "Com\google\guava" (main is not included), so it's
The value of the Name property must be "Com.google.guava". This value is also the same as when the module is referenced
The value used. Below, we customize a module, which uses the jar package I made myself, first screenshot:


As you can see, the structure is almost the same as the one previously referenced. Not to repeat here. Now, a custom module is OK.

After the custom module has been defined, how to use it.

Whether it is a module that is provided by default or a custom module, you need to use a configuration file to declare dependencies on them. There are two ways to rely on module. Implicit dependency: This dependency is automated by the system. For example, when you deploy a Java EE project, even if you do not have a configuration file that declares a dependency on Servlet-api.jar, your project can be deployed properly
and operation. That's because JBoss automatically relies on this jar package for your project. (It is, of course, dependent on the module that contains the jar package).
PS: Specific implicit dependency details please refer to: HTTPS://ACCESS.REDHAT.COM/SITE/DOCUMENTATION/EN-US/JBOSS_ENTERPRISE_APPLICATION_PLATFORM/6.1/ Html/development_guide/sect-reference.html#implicit_module_dependencies Display dependency: If you want to use a Module that is not included in an implicit dependency (for example, module), the corresponding module must be referenced through the configuration file.
The following is an example of how the deployment of a war package shows how to display a dependent module

From the above figure, we need to add a copy of the Jboss-deployment-structure.xml to Web-inf directory. Jboss-deployment-structure.xml, a reference to the custom module "Com.fujitsu.util" and the JBOSS self-contained module "Org.apache.commons.lang" is declared. The names of the two module are consistent with the value of the name attribute in their module.xml.
(see above for instructions)

The following is an example of how to display a dependent module (mode one) with the deployment of the ear package.

From the image above, we move the jboss-deployment-structure.xml from the Web-inf directory of the war package to the Meta-inf directory of the ear package, and at the same time, add an export attribute to each module and set its value to True If you do not have this export= "true", you will not be able to access these two module in a war.
Ear package, deployment Method II

From the above figure, compared with the method, the difference is: we have Jboss-deployment-structure.xml "Com.fujitsu.util" dependency commented out, at the same time, under the Eartest.ear set up a Lib subdirectory, The Fujitsu-numberutil.jar is then copied to this directory. After this deployment, the war package is still accessible to the APIs in Fujitsu-numberutil.jar. Because all jar packages in the ear's Lib directory are visible to all other sub system in the ear package (for example, Webtest.war here). That way, if we have some jar packages for engineering to use, but do not want to customize the module, you can use this approach.
Here's how the global module is built

Please look at the shaded section of the graph, we declare two global module through Global-modules, so that in all projects, no other configuration is required (such as the above
Jboss-deployment-structure.xml), you can use these two module.
PS: On the official website, said can be modified by MANIFEST. MF file to specify display dependencies, but I tried many times and did not work. If you are interested, you can try it.
The official links are as follows:
Https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html/Development_ Guide/add_an_explicit_module_dependency_to_a_deployment1.html


Finally attach the ear:http://download.csdn.net/detail/rainbow702/9466265 used in the test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.