Java 将Spring MVC应用程序从Tomcat移动到Glassfish。与上下文根有关的问题

Java 将Spring MVC应用程序从Tomcat移动到Glassfish。与上下文根有关的问题,java,web-applications,spring-mvc,tomcat7,glassfish-3,Java,Web Applications,Spring Mvc,Tomcat7,Glassfish 3,我已经在Tomcat上成功部署并运行了一个Spring MVC应用程序。现在,我正试图将其移动到glassfish,原因很简单,我想从管理控制台设置JNDI数据源 现在,当我在glassfish中部署war文件并启动应用程序时,它成功地启动了在web.xml中设置的欢迎文件: <welcome-file-list> <welcome-file>home</welcome-file> </welcome-file-list> 欢迎页面有如下

我已经在Tomcat上成功部署并运行了一个Spring MVC应用程序。现在,我正试图将其移动到glassfish,原因很简单,我想从管理控制台设置JNDI数据源

现在,当我在glassfish中部署war文件并启动应用程序时,它成功地启动了在
web.xml
中设置的欢迎文件:

<welcome-file-list>
    <welcome-file>home</welcome-file>
</welcome-file-list>
欢迎页面有如下链接:

<a href="orders">Manage Orders</a>
但是,当我单击该页面上的链接(
orders
)时,上下文根就消失了,剩下的是:

http://localhost:8080/orders
因此,由于不再显示上下文根,因此无法找到应用程序本身。我得到一个404错误

我的问题是,在将应用程序从Tomcat移动到Glassfish时,是否需要做一些更改?通过互联网搜索后,我添加了一个
glassfish web.xml
,与我的应用程序中的
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 error-url="">
    <context-root>/ContextRoot</context-root>
</glassfish-web-app>
点击
orders
链接,我将进入:

http://localhost:8080/orders
这很好,因为应用程序是默认的,现在不需要上下文根


现在,如果不将应用程序设为默认值,并显式地给出上下文根,那么就没有办法做到这一点了吗?

这两个链接可能会对您更有帮助。@Gyanapriya。我已经试过那些链接了。解决方案在我的情况下不起作用。
<!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 error-url="">
    <context-root>/ContextRoot</context-root>
</glassfish-web-app>
http://localhost:8080
http://localhost:8080/orders