本文介绍了Glassfish 无法在根目录下部署,因为声明了 default-web-module的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从 NetbeansAdmin Console 部署到 Glassfish Server Open Source Edition 3.1.2.2(构建 5)时,会抛出以下消息.尽管 Admin ConsoleApplications 部分没有部署的应用程序.我尝试重新启动域但没有成功.

While trying to deploy to Glassfish Server Open Source Edition 3.1.2.2 (build 5) from both Netbeans and Admin Console the following message is thrown. Eventhough the Applications section of the Admin Console has no deployed applications. I have tried restarting the domain without success.

加载应用程序时出现异常:java.lang.Exception: WEB0145: 无法在虚拟服务器 [server] 的根上下文中部署 web 模块 [*module name*],因为该虚拟服务器声明了一个默认的 web-模块

是否有任何缓存或可以清空的东西以清理根目录,以便我可以再次在根上下文中部署我的应用程序?感谢您的帮助!

Is there any cache or something that can be emptied in order to clean up the root so I can once again deploy my application at root context? Thanks for any help!

第一步

我开始在我的 Glassfish 目录中为 "default-web-module" 使用一个简单的 grep 命令.似乎这是在 domains/domain1/config/domain.xml 中定义的(我怎么会错过呢?).

I started with a simple grep-command on my Glassfish-directory for "default-web-module". Seems this was defined in domains/domain1/config/domain.xml (how could I have missed to think of that?).

第 2 步

domain.xml 里面是这样的:

<applications>
    <application context-root="/" ...>
         ...
    </application>
    ...
</applications>

此外,此 application 包含对先前部署在 root-context="/" 中的应用程序名称的多个引用.我一到家我就会尝试删除这个 <application context-root="/" ...>...</application>(当然还有 domain.xml).希望这能解决问题,我将能够再次部署到 root

Also, this application caries multiple references to the applicationname that was previously deployed in root-context="/". As soon as I'm home I will try removing this <application context-root="/" ...>...</application> (ofcourse with a backup of domain.xml). Hope this will solve the problem and that I will be able to deploy to root again!

推荐答案

既然我遇到了这个问题,很可能其他人也会遇到这个问题.出于这个原因,我将回答我自己的问题,而不是删除它.

Since I ran into the problem it's probable that others will too. For this reason I will answer my own question instead of deleting it.

按照我在问题中提到的步骤,我注意到 domain.xml 中的配置仍然引用带有 context-root="/" 的应用程序.从文件中删除此应用程序并保存后,我可以再次将应用程序部署到 /

Following the steps I've mentioned in the question, I noticed the config in domain.xml still had reference to an application with context-root="/". Upon removing this application from the file and saving it, I could once again deploy an application to /!

这篇关于Glassfish 无法在根目录下部署,因为声明了 default-web-module的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 18:45