Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

jakarta ee - How do you deploy a WAR that's inside an EAR as the root (/) context in Glassfish?

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>

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.

What am I doing wrong?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...