You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Dr. Michael N. Lipp" <Mi...@Danet.de> on 2005/05/09 16:03:11 UTC

NullPointerException in trivial example

Hi,

I just wanted to give JSF a try and started with the "simplest possible
example". Here is the layout:

jsftest
  test.jsp
  WEB-INF
    faces-config.xml
    lib
      commons-beanutils-1.6.1.jar
      commons-codec-1.2.jar
      commons-collections-3.0.jar
      commons-digester-1.5.jar
      commons-el.jar
      commons-fileupload-1.0.jar
      commons-logging.jar
      commons-validator.jar
      jakarta-oro.jar
      jsp-2.0.jar
      jstl.jar
      myfaces-extensions.jar
      myfaces-impl.jar
      myfaces.jar
      myfaces-jsf-api.jar
      myfaces-wap.jar
      myfaces-xdoclet.jar
    web.xml

faces-config.xml is empty (expect for the <faces-config/>). test.jsp is
--------------------------
<%@ page contentType="text/html; charset=ISO-8859-1" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"/>
            <title></title>
    </head>
    <body>
        <f:view>
	    Hallo5
	</f:view>
    </body>
</html>
--------------------------

I'm using JBoss-3.2.7. I've packaged the above files and deployed them.

Everything worked fine until I added the <f:view> (i.e. really got
started ;-)). With this I get

14:41:00,665 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service()
for servlet jsp threw exception
java.lang.NullPointerException
	at
javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:646)
	at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:254)
	at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:90)
	at org.apache.jsp.test_jsp._jspx_meth_f_view_0(test_jsp.java:88)
	at org.apache.jsp.test_jsp._jspService(test_jsp.java:63)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	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:75)
	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:214)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:162)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:534)

Seems like some prerequisite for the doStartTag of
javax.faces.webapp.UIComponentTag is missing (assuming that the
NullPointer indicates that something has not been initialized). What am
I doing wrong?

Regards,

    Michael

Re: NullPointerException in trivial example

Posted by "Dr. Michael N. Lipp" <Mi...@Danet.de>.
Sean Radford wrote:
> Dr. Michael N. Lipp wrote:
> 
>>
>> faces-config.xml is empty (expect for the <faces-config/>). test.jsp is
>> --------------------------
>> <%@ page contentType="text/html; charset=ISO-8859-1" %>
>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>>
>> <html>
>>    <head>
>>        <meta http-equiv="Content-Type" content="text/html;
>> charset=ISO-8859-1"/>
>>            <title></title>
>>    </head>
>>    <body>
>>        <f:view>
>>         Hallo5
>>     </f:view>
>>    </body>
>> </html>
>> --------------------------
>>
> You should be putting your text message in either an h:outputText or
> f:verbatim tag.

Maybe I should (will read the taglib docu when I get the example
running), but neither helps with the NullPointer problem (as was to be
expected, as the problem arises at the <f:view> tag which is before my
text). Thanks anyway,

    Michael

Re: NullPointerException in trivial example

Posted by Sean Radford <sr...@bladesystems.co.uk>.
Dr. Michael N. Lipp wrote:

>
>faces-config.xml is empty (expect for the <faces-config/>). test.jsp is
>--------------------------
><%@ page contentType="text/html; charset=ISO-8859-1" %>
><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
><%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>
><html>
>    <head>
>        <meta http-equiv="Content-Type" content="text/html;
>charset=ISO-8859-1"/>
>            <title></title>
>    </head>
>    <body>
>        <f:view>
>	    Hallo5
>	</f:view>
>    </body>
></html>
>--------------------------
>
You should be putting your text message in either an h:outputText or 
f:verbatim tag.

Sean

-- 
Dr. Sean Radford, MBBS, MSc
sradford@bladesystems.co.uk
http://bladesys.demon.co.uk/