Question

I have jsf 2.1 dynamic web application set for jboss as 7.1.1 runtime. I can't get to see my welcome page, not even when I type the name of the page in browser. I read a lot of similar questions, but nothing is working for me. It's strange, cause it worked before. After I imported project in different workspace, nothing. No errors. Here is web.xml:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
    <display-name>JPAWEB</display-name>
    <welcome-file-list>
     <welcome-file>home.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
     <param-value>.xhtml</param-value>
    </context-param>
    <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>

and I indeed have home.xhtml under WebContent.
In browser I get http://www.localhost.com:8080/jpa/ but no server can be found at localhost, even if I put http://www.localhost.com:8080/jpa/home.xhtml.
Just to say, server is working, I can open console and welcome page.

So, any ideas? Everything seems ok, but... Help :)

Was it helpful?

Solution 2

I solved it. The code was alright. Problems were with browser Firefox v26 and JBoss AS 7.1.1.

Problems with Firefox seems to be common:

problem 1 - By default Firefox changes URL by appending www. and .com, which can be seen in the text of the question.

SOLUTION:
Type about:config into the address bar.
Type fixup into the "Filter" box.
Double-click browser.fixup.alternate.enabled to change its value to false.

problem 2 - By default Firefox doesn't show full URL.

SOLUTION:
Type about:config into the address bar.
Type browser.urlbar.trimURLs into the "Filter" box.
Double-click browser.urlbar.trimURLs to change its value to false.

Problem with JBoss AS 7.1.1 was localhost URL. Usually worked with localhost:8080, but now works with 127.0.0.1:8080.

So, that is it.

OTHER TIPS

I'm not sure if you can use the same extension to map the xhtml facelet and the url pattern for JSF Front controller (I'm pretty sure that no), so try change this values first change the url pattern so:

<servlet-mapping>
     <servlet-name>Faces Servlet</servlet-name>
     <url-pattern>*.jsf</url-pattern>
</servlet-mapping>

And your welcome file so:

<welcome-file-list>
     <welcome-file>home.jsf</welcome-file>
</welcome-file-list>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top