java.lang.NullPointerException

hi

i am very new JSF.I developed very simple JSF application.I am using jboss 4.0.5 app server.I included all the required jar files.But i dont know y i am getting following error...

java.lang.NullPointerException

at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:929)

at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:310)

at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:70)

at org.apache.jsp.pages.result_jsp._jspx_meth_f_view_0(result_jsp.java:81)

at org.apache.jsp.pages.result_jsp._jspService(result_jsp.java:59)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)

at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)

at java.lang.Thread.run(Thread.java:595)

please help me in resolving this error....

[2919 byte] By [patel123a] at [2007-11-27 6:49:48]
# 1

When faced with this kind of error, I would try to track down the source code for UIComponentTag and look at what is happening at line 929.

I'm using JBoss as well, so I suspect you have the same version of JSF and MyFaces, so I took a look at my libraries. I see that UIComponentTag looks like the following:

FacesContext facesContext = getFacesContext();

if(facesContext == null)

{

log.error("Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.");

}

_writer = facesContext.getResponseWriter();

with the last line being line 929. This indicates that the facesContext is null which means that either you did not set up the FacesServlet or you are not running this request through the FacesServlet.

RaymondDeCampoa at 2007-7-12 18:23:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hello frnds, I am new to JSF as well. I've been trying to configure JBoss 4.0.5 to run a JSF page but in vain. I've included external JARs to run the JSF application. I guess the problem is with the conflict between external JARs from SUN RI and MyFaces bundled with JBoss. However I cant find MyFaces library to include in the application and stop using external JARs. Please direct me in the right direction

Please pardon me if there is something wrong in the question, I hope there is someone up here who had the same problem and managed to solve it. I'd be glad to see your reply. Tons of thanks.

Cheers

Pravin

ravin_login_SUNa at 2007-7-12 18:23:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

JBoss 4.0.5 already has the MyFaces libraries packaged with it. There is no reason to include them in your application. Start by removing the Sun RI jars from your build. You may want to look at the JBoss wiki at jboss.org as well, but be aware that the latest JBoss (4.2) is packaged with the Sun RI so take care when perusing the documentation.

RaymondDeCampoa at 2007-7-12 18:23:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Thanks raymond, Iam the same person who posted the question yesterday. I dont know sun forum is asking for a screen name every time i login.

I managed to sort out the issue with JBoss, i removed SUN RI from the application build path and mapped MyFaces(which i downloaded from Apache) and it works fine now but if i remove the mapping for MyFaces library files it wont work.

Sorry am a student so am curious to know whether there is a difference between MyFaces Implementation(allegedly bundled with JBoss 4.0.5) and MyFaces library files?

Pardon me if tha question doesnt make any sense!!

bliss_login_pravina at 2007-7-12 18:23:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Also if you could tell me where to look for MyFaces library files in JBoss 4.0.5, it'd be greatly helpful. Thanks in advance
bliss_login_pravina at 2007-7-12 18:23:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Somewhere under the deploy directory there is a directory with tomcat in the name. Under this directory is a jsf-libs directory in which you will find the MyFaces shipped with JBoss. Be aware that the directory structure changed in JBoss 4.2.
RaymondDeCampoa at 2007-7-12 18:23:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Thanks a lot Raymond it worked.
bliss_login_pravina at 2007-7-12 18:23:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...