I'm trying to deploy a JSF-2 application in the root of my glassfish server so that http://localhost:8080/
leads to my welcome page. For some reason when trying to configure this, http://localhost:8080/
leads to glassfish default welcome page while http://localhost:8080//
leads to mine. If I go to http://localhost:8080/<welcome-page>
it works, so the context-root seems to work in most cases, it's just the welcome page that has the wrong mapping somehow.
How to fix this?
sun-web.xml:
<sun-web-app error-url="">
<context-root>/</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>
web.xml (minus security constraints and other unrelated stuff)
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<filter-mapping>
<filter-name>AlreadyLoggedInRedirectFilter</filter-name>
<url-pattern>/login.jsf</url-pattern>
</filter-mapping>
开发者_Python百科 <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>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<filter-name>AlreadyLoggedInRedirectFilter</filter-name>
<filter-class>com.xdin.competence.jsf.util.AlreadyLoggedInRedirectFilter</filter-class>
</filter>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/viewExpired.jsf</location>
</error-page>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsf</form-login-page>
<form-error-page>/login.jsf</form-error-page>
</form-login-config>
</login-config>
As a side note, the application is not the default application of the server, I just want it to be deployed in the root.
it's a special 'feature' from glassfish. Please check out the answers in How do you deploy a WAR that's inside an EAR as the root (/) context in Glassfish?
Btw: Which version of glassfish are you using? Is it possible for you to change your application to be the default application?
精彩评论