使用Glassfish应用程序服务器设置上下文根 [英] Setting Context-Root with Glassfish Application Server

查看:67
本文介绍了使用Glassfish应用程序服务器设置上下文根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有Glassfish应用程序服务器的EJB WEB应用程序. 现在我想要像这样的"/"的上下文根. 我当前的网址是" http://localhost:8080/Make " 但我想要这个:" http://localhost:8080 ",而没有"Make",因为我的应用程序名称当前为.但是当我部署它并提示" http://localhost:8080 时,我得到了服务器正在运行"页面玻璃鱼 所以我想弄清楚我能做什么.我在我的WEB-INF文件夹中创建了glassfish-web.xml

I have a EJB WEB Application with an Glassfish Application-Server. Now i want the Context-Root like this "/". My current URL is "http://localhost:8080/Make" but i want this one :"http://localhost:8080" without the "Make" as my Application Name currently is. But hen i deploy it and tip "http://localhost:8080" i got the "Server is running" page from glassfish So i trie to figure out what i can do. I have create a glassfish-web.xml in my WEB-INF folder

<?xml version="1.0" encoding="UTF-8"?>
<!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>/</context-root>
</glassfish-web-app>

什么都没发生.比我在同一文件夹中创建了一个sun-web.xml:

Nothing happens. Than i have create a sun-web.xml in the same folder:

<?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>

我也尝试使用glassfish-application.xml和application.xml. 那我该怎么做才能达到这种效果呢?

Also i hvae trie with a glassfish-application.xml and application.xml. So what must i do to take this effect?

PS:这是我的web.xml,我部署为EAR文件

PS: this is my web.xml and i deploy as EAR file

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>Make</display-name>
<mime-mapping>
<extension>xhtml</extension>
<mime-type>application/xml</mime-type>
</mime-mapping>
<welcome-file-list>
 <welcome-file>anmeldung.xhtml</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
 <error-page>
 <exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/anmeldung.xhtml</location>
</error-page>
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
 </context-param>
 <context-param>
<param-name>primefaces.THEME</param-name>
<param-value>bootstrap</param-value>
 </context-param>
 <context-param>
<param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
<param-value>/WEB-INF/resources</param-value>
 </context-param>
 <context-param>
 <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
 </servlet-mapping>
 </web-app>

WEB-INF文件夹中的application.xml

The application.xml in the WEB-INF Folder

<?xml version="1.0" encoding="UTF-8"?>
<application 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_6.xsd" version="6">
<application-name>Make</application-name>
<display-name>Make</display-name>
<module>
<web>
  <web-uri>Make.war</web-uri>
  <context-root>/</context-root>
</web>
 </module>
<module>
  <ejb>makeITown.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>

推荐答案

将上下文根设置为/不足以仅通过键入http://yourdomain.org就能访问您的Web应用程序,因为Glassfish将显示您的服务器"正在运行",可在index.html`中找到该消息.

Setting the context root to / is not enough to be able to access your web app only by typing http://yourdomain.org because Glassfish will display the "Your server is running" message found in index.html`.

启动您的应用.将在Configuration | server-config | Virtual Servers | server(在Web控制台中)中找到的Default Web Module下拉菜单设置为您的Web应用程序的名称.

To get your app launch. set the Default Web Module drop down found in Configuration | server-config | Virtual Servers | server (in the Web console) to the name of your web app.

这篇关于使用Glassfish应用程序服务器设置上下文根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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