zno2

what is a ear

http://docs.oracle.com/javaee/6/tutorial/doc/bnaby.html

An EAR file (see Figure 1-6) contains Java EE modules and, optionally, deployment descriptors. A deployment descriptor, an XML document with an .xml extension, describes the deployment settings of an application, a module, or a component. Because deployment descriptor information is declarative, it can be changed without the need to modify the source code. At runtime, the Java EE server reads the deployment descriptor and acts upon the application, module, or component accordingly.

 

 

具体例子:

jboss-javaee-multi-ear
│   jboss-javaee-multi-ejb.jar
│   jboss-javaee-multi-web.war
│
└───META-INF
        application.xml
        jboss-javaee-multi-ds.xml

 

application.xml

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" version="7">
  <display-name>jboss-javaee-multi-ear</display-name>
  <module>
    <web>
      <web-uri>jboss-javaee-multi-web.war</web-uri>
      <context-root>/jboss-javaee-multi-web</context-root>
    </web>
  </module>
  <module>
    <ejb>jboss-javaee-multi-ejb.jar</ejb>
  </module>
  <library-directory>lib</library-directory>
</application>

 部署运行后效果:

 

 

 

 

如何创建这个例子:

使用eclipse 如下操作 new ear

posted on 2016-10-17 17:17  zno2  阅读(255)  评论(0编辑  收藏  举报

导航