如何将 EAR 中的 WAR 部署为 Glassfish 中的根 (/) 上下文? [英] How do you deploy a WAR that's inside an EAR as the root (/) context in Glassfish?

查看:23
本文介绍了如何将 EAR 中的 WAR 部署为 Glassfish 中的根 (/) 上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含两个 WAR 的 EAR 文件,war1.war 和 war2.war.我的 application.xml 文件如下所示:

I have an EAR file that contains two WARs, war1.war and war2.war. My application.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
  <display-name>MyEAR</display-name>
  <module>
    <web>
      <web-uri>war1.war</web-uri>
      <context-root>/</context-root>
    </web>
  </module>
  <module>
    <web>
      <web-uri>war2.war</web-uri>
      <context-root>/war2location</context-root>
    </web>
  </module>
</application>

这导致 war2.war 在 http://localhost:8080/war2location 上可用,这是正确的,但是 war1.war 在 http://localhost:8080// -- 注意两个斜线.

This results in war2.war being available on http://localhost:8080/war2location, which is correct, but war1.war is on http://localhost:8080// -- note the two slashes.

我做错了什么?

请注意,当包含在 EAR 中时,WAR 的 sun-web.xml 文件会被忽略.

Note that the WARs' sun-web.xml files get ignored when contained in an EAR.

推荐答案

在 Glassfish 3.0.1 中,您可以在管理控制台中定义默认的 Web 应用程序:配置虚拟服务器服务器默认 Web 模块".下拉框包含所有已部署的战争模块.

In Glassfish 3.0.1 you can define the default web application in the administration console: "ConfigurationVirtual ServersserverDefault Web Module". The drop-down box contains all deployed war modules.

然后可以从 http://localhost:8080/ 访问默认的 Web 模块.

The default web module is then accessible from http://localhost:8080/.

这篇关于如何将 EAR 中的 WAR 部署为 Glassfish 中的根 (/) 上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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