Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find FacesContext

 
v kishore
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Forum,
I am trying to deploy existing code in my localhost , i am using jboss-4.2.2.GA ,Mysql , windows OS.
while i try to call my index jsf file i am getting the following error.

" java.lang.RuntimeException: Cannot find FacesContext
javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1796)
javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1613)
org.apache.jsp.index_jsp._jspx_meth_f_005fview_005f0(index_jsp.java:93)
org.apache.jsp.index_jsp._jspService(index_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) "



I tried with different mapping in my xml but no use.also check the jar in the libs for versions those are all fine.

even i get the same error in tomcat6 while i run the same application.


Here i my web.xml

<?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>faces-config.xml</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>*.faces</url-pattern>
</servlet-mapping>

<taglib>
<taglib-uri>http://java.sun.com/portlet</taglib-uri>
<taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
</taglib>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>




please assist me where i am missing.



 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your mapping you have
<url-pattern>*.faces</url-pattern>

So only queries ending with .faces are handled by Faces Servlet. Is this correct for your application? For example calling your index page with index.jsp or with index.jsf would result in failure.
 
v kishore
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply.

while i try to call using the url like http://localhost:8080/myapp/index.faces
i am getting the following exception .

exception

java.lang.NullPointerException
com.sun.faces.portlet.LifecycleImpl.getWindowStateIdentifier(LifecycleImpl.java:533)
com.sun.faces.portlet.LifecycleImpl.restore(LifecycleImpl.java:391)
com.sun.faces.portlet.LifecycleImpl.execute(LifecycleImpl.java:226)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)


same thing in both jboss and tomcat.

Thank you
 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception and the fact that you include portlet tag library in web.xml hint that your application might be a portlet application and not a servlet application. Is that correct? I have no experience of portlets so I can not help you there.
 
v kishore
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am sorry for not mentioning it before , yes it is portlet application ,
okay and thanks for you replies.
can any one suggest.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic