Java EE 6中的应用程序部署描述符 [英] Application Deployment Descriptor in Java EE 6

查看:209
本文介绍了Java EE 6中的应用程序部署描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置我的企业应用程序的Web应用程序部分的上下文根(捆绑为EAR)。我添加了一个application.xml文件,如下所示:

I would like to set the context-root of the web application part of my enterprise application (bundled as an EAR). I added an "application.xml" file which looks like this:

<application>
    <module>
        <web>
            <web-uri>SearchResulter-war.war</web-uri>
            <context-root>/searcharoo</context-root>
        </web>
    </module>
</application>

问题是,我在项目中也有EJB。看起来Java EE 5/6魔术之前并没有要求我包含application.xml文件,在我想要更改context-root之前,这一切都很好。就定义自己的命运而言,它是一个全有或全无的命题吗?换句话说,我必须添加一个带有相关信息的< ejb> 元素吗?

The thing is, I have EJBs in the project as well. It seems that the Java EE 5/6 magic previously did not require me to include an "application.xml" file, and that was all good until I wanted to change the context-root. Is it an all-or-nothing proposition as far as defining your own goes? In other words, must I add an <ejb> element with the relevant info?

推荐答案

引用Java EE规范v6的 8.5.2部署Java EE应用程序部分:

Quoting the section 8.5.2 Deploying a Java EE Application of the Java EE Specification v6:


部署工具必须首先从应用程序.ear文件(META-INF / application.xml)中读取Java EE应用程序部署描述符。如果存在部署描述符,则完全指定应用程序中包含的模块。如果不存在部署描述符,则部署工具使用以下规则来确定应用程序中包含的模块。

The deployment tool must first read the Java EE application deployment descriptor from the application .ear file (META-INF/application.xml). If the deployment descriptor is present, it fully specifies the modules included in the application. If no deployment descriptor is present, the deployment tool uses the following rules to determine the modules included in the application.

换句话说,在提供 application.xml 时,您确实需要在其中包含所有模块。

In other words, when providing an application.xml, you need indeed to include all modules in it.

这篇关于Java EE 6中的应用程序部署描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆