5

最近、Glassfish 3.1.2.2 に切り替え、いくつかの Web アプリケーションを war ファイルとしてパッケージ化しました。これらのアプリケーションに必要な context-root がファイル名と異なる場合があります。

Weblogic を使用していた頃は、weblogic.xml で context-root を次のように宣言することでこれを実現していました。

<context-root>path/to/our/App</context-root>

Glassfish-web.xml に同じタグが存在することに気付きました。しかし、そこで何を定義しても、サーバーは常にファイル名を context-root として決定します。

asadmin ユーティリティにオプション --contextroot があり、展開時にファイル名を上書きできますが、アーカイブ自体に直接定義して、最後に展開する人が誰であろうと失敗しないようにすることをお勧めします。目的のコンテキストルートを知る必要があります。

これを達成する方法はありますか?

4

2 に答える 2

10

GlassFish 3 および GlassFish 4 では、Web アプリケーションの構成は を介し​​て行われglassfish-web.xmlます。あなたの場合、目的の構成ファイルは次のようになります。

<!DOCTYPE glassfish-web-app PUBLIC 
    "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN"
    "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
    <context-root>/path/to/our/App</context-root>
</glassfish-web-app>

詳細については、『 Oracle GlassFish Server Application Deployment Guide』のGlassFish Server Deployment Descriptor Filesのセクションを参照してください。このドキュメントのオンライン バージョンは、http://docs.oracle.com/cd/E18930_01/html/821-2417/にあります。

于 2013-08-21T13:22:46.937 に答える
4

通常、これは次のglassfish-web.xmlような外観で機能するはずです。

<!DOCTYPE glassfish-web-app PUBLIC 
    "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN"
    "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
    <context-root>/path/to/App</context-root>
</glassfish-web-app>

sun-web.xmlしかし、ここでは、タスク用に呼び出されたファイルが必要なようです。

次に例を示します。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC 
     "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN"   
     "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
    <context-root>/path/to/our/App</context-root>
</sun-web-app>
于 2013-04-25T15:34:59.203 に答える