- This topic has 13 replies, 2 voices, and was last updated 17 years, 9 months ago by Russ.
-
AuthorPosts
-
RussMemberGood Afternoon to All!
What I have done is create a simple Java Server Faces project whereby I created a web project and added JSF capability. Next I created some JSPs and markups for the frontend portion of this example. What I am trying to accompllish is move around the different JSPs to ensure enverything is working properly before I get complicated.
When I type in the URL to the Parent (index.html), I get the markup to display. When I click on the link, what is suppose to happen is the screen moves to the index.jsp. The index.jsp has nothing more than a forward to the main.jsp. In this JSP is where all the Java Server Faces markup is located. However, I am getting 500 HTTP status. What appears to me is the server is not able to find the tag libaries for the project as the error stops on the <f:view> line within the main.jsp. This is the error:
org.apache.jasper.JasperException: Exception in JSP: /index.jsp:7 4: <title>A Simple JavaServer Faces Registration Application</title> 5: </head> 6: <body> 7: <jsp:forward page="/main.jsp" /> 8: </body> 9: </html> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) root cause org.apache.jasper.JasperException: Exception in JSP: /main.jsp:5 2: <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 3: <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 4: 5: <f:view> 6: <html> 7: <head> 8: <title>A Simple JavaServer Faces Registration Application</title>
As this is a learning situation for me, I was hoping others would provided some clarification on my root issue. Is there something specical I need to accomplish for JBoss?
Thanks in advance for any suggestion.
Russ
Riyad KallaMemberMoving to OT > Soft Dev
Russ,
First thing I think JBoss ships it’s own JSF libraries that causes JSF apps to barf when you deploy them with their *own* libraries. Atleast it seems I remember users mentioning that, so double check the JBoss /lib dir to see if JSF libs are already there.Next, I have no idea what the JSP compiler is complaining about… try doing the JSF library fix first and see if the problem magically disappears. You may need to remove the JSF libraries from your project (the MyEclipse ones) and instead add the External JARs of the JSF libs from JBoss to your build path then just be sure your project deployment settings are setup to ignore external JAR deployment (so you don’t accidentally redeploy the JBoss JARs back to itself).
RussMemberGood Morning All:
I am hoping someone can clarify what is the correct steps for getting a MyFaces Web Project up and running using JBoss 4.0.5 within MyEclipse 5.1.1. I have tried to follow the steps outlined in JBoss http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces, but I am not very successful.
When I follow JBoss instructions by removing the jsf-lib and using the MyEclipse jar files from the web/lib for MyFaces 1.1.1, I get the following error:
07:58:38,609 DEBUG [TagLibCache] Scanning for tlds in: file:/C:/jboss-4.0.5.GA/server/default/deploy/jbossweb-tomcat55.sar/jsf-libs/myfaces-impl.jar 07:58:38,609 DEBUG [TagLibCache] Failed to scan: jsf-libs/myfaces-impl.jar java.io.FileNotFoundException: C:\jboss-4.0.5.GA\server\default\deploy\jbossweb-tomcat55.sar\jsf-libs\myfaces-impl.jar
When I leave the libraries for JBoss in place and use the MyEclipse libraries within the web/lib for the project, I get the following error:
08:05:24,828 ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml. 08:05:24,859 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615) at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217) at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71) at org.apache.jsp.main_jsp._jspx_meth_f_view_0(main_jsp.java:88) at org.apache.jsp.main_jsp._jspService(main_jsp.java:64)
Any suggestions would be greatly appreciated.
Russ
RussMemberokay……..when I change the file extensions to “jsf” the error goes away……. but nothing is displayed when forwarded to the main.jsf page other than the <h2> element. The input elements are not there! I am led to believe this is a configuration issue.
Any suggestions?
RussMemberI am led to to believe strongly the Server is unable to find the taglib components.
Riyad KallaMemberYou should be seeing exceptions if the taglibs are barfing. I still think this is a library issue.
I would suggest you try and deploy to Tomcat, see if your app works fine. if it does, then atleast you know *what* to play with (the libraries). If it breaks on Tomcat too, then get it working there first, then go back to trying JBoss.
RussMemberRats….Rats and Double Rats! 🙂
I moved the test app over to Tomcat. I am getting the same results–<h2> element is displaying, but nothing is displaying from the jsf elements. NO errors/stacktraces are displaying in console either……
RussMemberThis is the main.jsf file. It’s very simple:
<%@ page contentType="text/html"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <f:view> <html> <head> <title>A Simple JavaServer Faces Registration Application</title> </head> <body> <h:form> <h2>JSF Registration App</h2> <h:commandLink action="register"> <h:outputText value="Click here to register.."/> </h:commandLink> </h:form> </body> </html> </f:view>
Thanks as always for any suggestions/comments from the community!
Russ
Riyad KallaMemberRuss,
Try this:
1) Create a new web project.
2) Add JSF caps to it, using the MyFaces version you want.
3) Add a JSP to it using the default JSF template
4) Deploy it to Tomcat and try and access the page… does *that* even work?Let’s try and narrow down what’s broken.
RussMemberOkay, I have created a simple Web Project and added JSF caps. I chose MyFaces 1.1.1 as the standard. Next, I created a simple JSP called index. Nothing great about it other than text saying one has arrived at the index page. This deploys and tested…….
What I have in my web.xml is:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value>/WEB-INF/faces-config.xml</param-value> </context-param> <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</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>/faces/*</url-pattern> </servlet-mapping> <filter> <filter-name>MyFacesExtensionsFilter</filter-name> <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class> <init-param> <param-name>maxFileSize</param-name> <param-value>20m</param-value> </init-param> </filter> <filter-mapping> <filter-name>MyFacesExtensionsFilter</filter-name> <url-pattern>/faces/*</url-pattern> </filter-mapping> </web-app>
There is nothing in the faces-config.xml file other than a simple declaration.
What is broken is when I try to do the following from within the index.jsp:
<jsp:forward page="/main.jsp" />
Hope that helps…….
Riyad KallaMemberYou cannot forward directly to a JSP page that is part of a JSF application, you must forward to the URL that uses whatever is mapped to JSF like “main.jsf”, JSF will process the page THEN forward to the same-name page with a .jsp extension for you.
RussMemberOkay! We are working 🙂
What I had to do was change the foward from:
<jsp:forward page="/main.jsp" />
to:
<jsp:forward page="/faces/main.jsp" />
and everything worked and matched the web.xml
<servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping>
Thanks AGAIN for sharing… This will give us a great example on how JavaServer Faces can be used in our application….
Russ
Riyad KallaMemberRuss, good deal.
Also now that you are using JSF, I think you should love our 5.5 release (big focus on JSF tooling improvements, new designer, etc.)
RussMembermmmmmmmm, 4 days and counting to M2 release for ME5.5 I’m ready….ready…. ready! 🙂
-
AuthorPosts