JSP with jsf standard 2.0 components error [message #207841] |
Fri, 01 February 2008 01:04 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
what can i do with this? I'm testing a basic JSF web application with two
jsp pages containig an input text and a button ............ When asking
eclipse to run the jsp page in a Tomcat 6 server, i get the following
errors in the log's panel:
30/01/2008 09:20:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: C:\Program
Files\Java\jre1.5.0_05\bin;.;C:\WINDOWS\system32;C:\WINDOWS; C:/Program
Files/Java/jre1.5.0_05/bin/client;C:/Program
Files/Java/jre1.5.0_05/bin;C:\WINDOWS\system32;C:\WINDOWS;C: \WINDOWS\System32\Wbem;C:\Program
Files\QuickTime\QTSystem\;C:\Sun\SDK\bin;C:\CLIPPER5\BIN;;C: \PROGRA~1\COMMON~1\MUVEET~1\030625
30/01/2008 09:20:48 PM org.apache.coyote.http11.Http11Protocol init
INFO: Inicializando Coyote HTTP/1.1 en puerto http-8080
30/01/2008 09:20:48 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1219 ms
30/01/2008 09:20:48 PM org.apache.catalina.core.StandardService start
INFO: Arrancando servicio Catalina
30/01/2008 09:20:48 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
30/01/2008 09:20:48 PM com.sun.faces.config.ConfigureListener
contextInitialized
INFO: Initializing Sun's JavaServer Faces implementation (1.2_07-b03-FCS)
for context '/JSFTutorial'
30/01/2008 09:20:50 PM org.apache.coyote.http11.Http11Protocol start
INFO: Arrancando Coyote HTTP/1.1 en puerto http-8080
30/01/2008 09:20:50 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
30/01/2008 09:20:50 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/187 config=null
30/01/2008 09:20:50 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2446 ms
30/01/2008 09:20:52 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() para servlet jsp lanzó excepción
java.lang.RuntimeException: Cannot find FacesContext
at
javax.faces.webapp.UIComponentClassicTagBase.getFacesContext (UIComponentClassicTagBase.java:1835)
at
javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComp onentClassicTagBase.java:1652)
at
org.apache.jsp.Prueba1_jsp._jspx_meth_f_005fview_005f0(Prueb a1_jsp.java:107)
at org.apache.jsp.Prueba1_jsp._jspService(Prueba1_jsp.java:81)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja va:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:393)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:263)
at
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:584)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:447)
at java.lang.Thread.run(Unknown Source)
Thanks,
|
|
|
Re: JSP with jsf standard 2.0 components error [message #207866 is a reply to message #207841] |
Fri, 01 February 2008 14:58 |
Eclipse User |
|
|
|
Originally posted by: wknauf_NO_._INSIDE_hg-online.de
Hi Estuardo,
before calling the first JSP, which requires JSF, in your session, you somehow
have to trigger initialization of the JSF runtime. This is done by invoking a
JSF URL like e.g. "index.faces", which initializes JSF and then renders a page
called "index.jsp".
There are two possibilites to solve this (beside invoking an "index.faces" URL):
-Your index page does not make use of JSF, but is plain HTML or JSP, and
contains either a link to a JSF URL:
<a href="mystartpage.faces">Enter !</a>
It is important that this page is not part of a session:
<%@ page session="false" ....
-Or you use a redirect:
<%@ page session="false" ...%>
<% response.sendRedirect("mystartpage.faces"); %>
Hope this helps
Wolfgang
Estuardo del Cid schrieb:
> what can i do with this? I'm testing a basic JSF web application with
> two jsp pages containig an input text and a button ............ When
> asking eclipse to run the jsp page in a Tomcat 6 server, i get the
> following errors in the log's panel:
>
> GRAVE: Servlet.service() para servlet jsp lanzó excepción
> java.lang.RuntimeException: Cannot find FacesContext
> at
> javax.faces.webapp.UIComponentClassicTagBase.getFacesContext (UIComponentClassicTagBase.java:1835)
> at
> javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComp onentClassicTagBase.java:1652)
> at
|
|
|
Re: JSP with jsf standard 2.0 components error [message #207895 is a reply to message #207866] |
Fri, 01 February 2008 21:17 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
Thanks for your response. The first page content that i'm trying to run
has two standard jsf tags, the input text and the button. I dont have the
source at this moment but i'll send it in a few hours. Do you think i must
do changes to the index page having the first that i'm trying to run jsf
tags?
Please let me know.
Another question. I tried to follow the eclipse documentation example for
creating a jsf application (eclipse jsf tools basic tutorial). There is a
step that requests to define two libraries: SUN-RI-1.2 and JSTL with it's
corresponding jars (i've done so). After invoking the Create new Dynamic
web project, on the jsf capabilities page, the guide requests to add the
jstl library. I couldnt find a way to add the library. Can you tell me
the steps?
Can this be the problem? Do i have to check mark the SUN-RI-1.2 default
JSF libraries in the jsf capabilites page to run with Tomcat 6?
Thanks for your help
Regards
Estuardo
|
|
|
Re: JSP with jsf standard 2.0 components error [message #207941 is a reply to message #207866] |
Sun, 03 February 2008 03:41 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
Hi there, i've tried and the error log changed to this:
2/02/2008 09:37:23 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: C:\Program
Files\Java\jre1.5.0_05\bin;.;C:\WINDOWS\system32;C:\WINDOWS; C:/Program
Files/Java/jre1.5.0_05/bin/client;C:/Program
Files/Java/jre1.5.0_05/bin;C:\WINDOWS\system32;C:\WINDOWS;C: \WINDOWS\System32\Wbem;C:\Program
Files\QuickTime\QTSystem\;C:\Sun\SDK\bin;C:\CLIPPER5\BIN;;C: \PROGRA~1\COMMON~1\MUVEET~1\030625
2/02/2008 09:37:23 PM org.apache.coyote.http11.Http11Protocol init
INFO: Inicializando Coyote HTTP/1.1 en puerto http-8080
2/02/2008 09:37:23 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1013 ms
2/02/2008 09:37:23 PM org.apache.catalina.core.StandardService start
INFO: Arrancando servicio Catalina
2/02/2008 09:37:23 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
2/02/2008 09:37:24 PM com.sun.faces.config.ConfigureListener
contextInitialized
INFO: Initializing Sun's JavaServer Faces implementation (1.2_07-b03-FCS)
for context '/JSFTutorial'
2/02/2008 09:37:25 PM org.apache.coyote.http11.Http11Protocol start
INFO: Arrancando Coyote HTTP/1.1 en puerto http-8080
2/02/2008 09:37:25 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
2/02/2008 09:37:25 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/172 config=null
2/02/2008 09:37:25 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2274 ms
2/02/2008 09:37:29 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() para servlet Faces Servlet lanzó excepción
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
at
com.sun.faces.application.ViewHandlerImpl.executePageToBuild View(ViewHandlerImpl.java:459)
at
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHan dlerImpl.java:143)
at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderRe sponsePhase.java:110)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.j ava:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:26 6)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi lter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App licationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar dWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(Standar dContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo stValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo rtValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(Standard EngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd apter.java:263)
at
org.apache.coyote.http11.Http11Processor.process(Http11Proce ssor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHand ler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoin t.java:447)
at java.lang.Thread.run(Unknown Source)
Here are the index.jsp and prueba1.faces source code:
Index.jsp: (run in the eclipse wtp)
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<% response.sendRedirect("Prueba1.faces"); %>
</body>
</html>
Prueba1.faces:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>test faces</title>
</head>
<body>
<f:view>
<h:form id="mainForm">
<h:outputLabel for="enterName" value="Enter Name"/>
<h:inputText id="enterName" value="#{sayHelloPage.name}"/>
<h:commandButton value="Say Hello" action="#{sayHelloPage.sayHello}"/>
</h:form>
</f:view>
</body>
</html>
What you think?
Thanks
|
|
|
|
Re: JSP with jsf standard 2.0 components error [message #208007 is a reply to message #207970] |
Mon, 04 February 2008 02:38 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
Thanks ginkgo, i think i've succeeded one more step. I dont have the JSTL
error log anymore. Now, when the index.jsp redirects to prueba1.jsp, which
contains two jsf components, i have the following error (in the browser):
Estado HTTP 404 - /JSFTutorial/Prueba1.jsp
Type: Informe de Estado
mensaje: /JSFTutorial/Prueba1.jsp
Descripcion: El recurso requerido (/JSFTutorial/Prueba1.jsp) no está
disponible
This is not part of the message: I translated it to english because it is
received in spanish:
(English translation:
The required resource Prueba1.jsp is not available.)
I've tried redirecting to prueba1.faces, nothing. Then i renamed
prueba1.faces back to prueba1.jsp (originally a jsp file).
¿Can i just rename a .jsp page to .faces extension to get the faces
environment initialized?
Thanks a lot everybody for your assistance, this is a little hard for a
new JSF developer.
By the way, where are you from Ginkgo and Wolfgang?
Estuardo
|
|
|
Re: JSP with jsf standard 2.0 components error [message #208015 is a reply to message #207970] |
Mon, 04 February 2008 03:16 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
Thanks, i went back to the following error log:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspExcepti on(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
causa raíz
java.lang.RuntimeException: Cannot find FacesContext
javax.faces.webapp.UIComponentClassicTagBase.getFacesContext (UIComponentClassicTagBase.java:1835)
javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComp onentClassicTagBase.java:1652)
org.apache.jsp.Prueba1_jsp._jspx_meth_f_005fview_005f0(Prueb a1_jsp.java:107)
org.apache.jsp.Prueba1_jsp._jspService(Prueba1_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja va:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Can i chat with you a few minutes please? tell me where and when if so.
Regards
Estuardo
|
|
|
|
|
Re: JSP with jsf standard 2.0 components error [message #208338 is a reply to message #208051] |
Fri, 08 February 2008 18:49 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
Hi there. Sorry for the delay, i was out for some days.
Here is the sample jsf project:
Faces-config.xml
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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/web-facesconfig_1_2.xsd"
version="1.2">
<managed-bean>
<description>
Pagina de bienvenida</description>
<managed-bean-name>
sayHelloPage</managed-bean-name>
<managed-bean-class>
prueba.SayHelloPage</managed-bean-class>
<managed-bean-scope>
request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/prueba1.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/prueba2.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
web.xml
-------
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>myfaces_allow_javascript</param-name>
<param-value>true</param-value>
</context-param>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class >
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
</web-app>
Index.jsp
---------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
hola, redireccionando ....
<% response.sendRedirect("Prueba1.jsp"); %>
</body>
</html>
Prueba1.jsp
-----------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>ahhhh, que lujo mi Dios</title>
</head>
<body>
<f:view>
<h:form id="mainForm">
<h:outputLabel for="enterName" value="Enter Name"/>
<h:inputText id="enterName" value="#{sayHelloPage.name}"/>
<h:commandButton value="Say Hello" action="#{sayHelloPage.sayHello}"/>
</h:form>
</f:view>
</body>
</html>
Prueba2.jsp
-----------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
Hay que lindo
</body>
</html>
SayHelloPage.Java
------------------
package prueba;
public class SayHelloPage {
public SayHelloPage () {}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String sayHello() {
return "success";
}
}
I hope this helps to solve my problem.
Regards,
Error log reported when running index.jsp with Tomcat 6:
--------------------------------------------------------
Estado HTTP 500 -
------------------------------------------------------------ --------------------
type Informe de Excepción
mensaje
descripción El servidor encontró un error interno () que hizo que no
pudiera rellenar este requerimiento.
excepción
org.apache.jasper.JasperException: java.lang.RuntimeException: Cannot find
FacesContext
org.apache.jasper.servlet.JspServletWrapper.handleJspExcepti on(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
causa raíz
java.lang.RuntimeException: Cannot find FacesContext
javax.faces.webapp.UIComponentClassicTagBase.getFacesContext (UIComponentClassicTagBase.java:1835)
javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComp onentClassicTagBase.java:1652)
org.apache.jsp.Prueba1_jsp._jspx_meth_f_005fview_005f0(Prueb a1_jsp.java:107)
org.apache.jsp.Prueba1_jsp._jspService(Prueba1_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja va:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServl etWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl et.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java :266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
nota La traza completa de la causa de este error se encuentra en los
archivos de diario de Apache Tomcat/6.0.14.
|
|
|
|
|
Re: JSP with jsf standard 2.0 components error [message #208499 is a reply to message #208362] |
Tue, 12 February 2008 04:35 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
Hi there, another problem:
In the example that i'm running, the jsp page "prueba1.jsp" shows nice,
but when i push the button, nothing happens. I've debugged the
SayHelloPage.sayHello method, and its executing, but i dont go to the
second page "prueba2.jsp" despite the string "success" returned. I think
the flow in the faces-config.xml is correct. What is going wrong?
I feel bad with my first steps but i hope you keep helping me.
Thanks,
Estuardo
|
|
|
Re: JSP with jsf standard 2.0 components error [message #208574 is a reply to message #208499] |
Wed, 13 February 2008 19:48 |
Eclipse User |
|
|
|
Originally posted by: estuardodelcid.hotmail.com
Hi there, making some tests i've found the problem. I deleted the jsp
pages in the navigation rules graphical editor and created them again,
graphically, then it worked. There is some stuff when you modify the
faces-config.xml in the source tab.
Regards,
|
|
|
Powered by
FUDForum. Page generated in 0.05867 seconds