Reputation: 277
[In case it is helpful, I am working from the book Core JavaServer Faces (3rd edition) and am on page 12, or thereabouts.]
I am trying to launch a JSF application using GlassFish but am having problems that I can't identify. I can start GlassFish correctly and see the screen that is depicted in the book, so that appears to be fine. I then copy the file login.war that I've created and placed in the directory containing the src and web directories for this project into the domains/domain1/autodeploy directory of GlassFish.
Going to http://localhost:8080
in Chrome shows the correct screen; however http://localhost:8080/login
, as described in the book and corresponding to the login.xhtml page that I have created, simply returns an HTTP 404 Error telling me 'The requested resource () is not available'.
My web.xml file is as follows:
<?xml version="1.0" encoding="UTf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/nx/javaee
http://java.sun.com/xml/ns/javaee/we-app_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-patter>/faces/*</url-patter>
</servlet-mapping>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
</web-app>
Can anyone offer any help? I am using the Eclipse IDE, my version of GlassFish, as detailed on the error page described above, is 3.1.2.2. If there is any more information that would be helpful, e.g. directory structures, please do ask me for it.
Thanks, Conor.
Upvotes: 0
Views: 1974
Reputation: 766
You should set your application context-root
to login
if you need to access it with http://localhost:8080/login
. There are several ways how to do it, e.g. check this Glassfish tip or in Eclipse IDE, in project Properties click on Web Project Settings and enter new Context root of your application.
This is not a bug, so until you will run more then one application on your server, you can leave it this way if you wish.
Upvotes: 1