jsf - java.lang.NullPointerException at java.net.URLEncoder.encode at com.sun.faces.context.UrlBuilder.addValuesToParameter -
i trying run jsf application using netbeans , having exception of nullpointerexception in urlencode. think problems servlet dont know how fix sources : https://github.com/agoncal/agoncal-application-petstore-ee6
<?xml version="1.0" encoding="utf-8"?> <web-app version="3.0" 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-app_3_0.xsd"> <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>*.xhtml</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list>
java.lang.nullpointerexception @ java.net.urlencoder.encode(urlencoder.java:204) @ com.sun.faces.context.urlbuilder.addvaluestoparameter(urlbuilder.java:318) @ com.sun.faces.context.urlbuilder.addparameters(urlbuilder.java:127) @ com.sun.faces.context.externalcontextimpl.encodebookmarkableurl(externalcontextimpl.java:1054) @ com.sun.faces.application.view.multiviewhandler.getbookmarkableurl(multiviewhandler.java:407) @ javax.faces.application.viewhandlerwrapper.getbookmarkableurl(viewhandlerwrapper.java:272) @ org.jboss.weld.jsf.conversationawareviewhandler.getbookmarkableurl(conversationawareviewhandler.java:132) @ com.sun.faces.renderkit.html_basic.outcometargetrenderer.getencodedtargeturl(outcometargetrenderer.java:194) @ com.sun.faces.renderkit.html_basic.outcometargetlinkrenderer.renderasactive(outcometargetlinkrenderer.java:158) @ com.sun.faces.renderkit.html_basic.outcometargetlinkrenderer.encodebegin(outcometargetlinkrenderer.java:96) @ javax.faces.component.uicomponentbase.encodebegin(uicomponentbase.java:864) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1854) @ javax.faces.render.renderer.encodechildren(renderer.java:176) @ javax.faces.component.uicomponentbase.encodechildren(uicomponentbase.java:889) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1856) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1859) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1859) @ com.sun.faces.application.view.faceletviewhandlingstrategy.renderview(faceletviewhandlingstrategy.java:456) @ com.sun.faces.application.view.multiviewhandler.renderview(multiviewhandler.java:133) @ javax.faces.application.viewhandlerwrapper.renderview(viewhandlerwrapper.java:337) @ com.sun.faces.lifecycle.renderresponsephase.execute(renderresponsephase.java:120) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:219) @ javax.faces.webapp.facesservlet.service(facesservlet.java:647) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1682) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:318) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:160) @ org.apache.catalina.core.standardpipeline.doinvoke(standardpipeline.java:734) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:673) @ com.sun.enterprise.web.webpipeline.invoke(webpipeline.java:99) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:174) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:415) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:282) @ com.sun.enterprise.v3.services.impl.containermapper$httphandlercallable.call(containermapper.java:459) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:167) @ org.glassfish.grizzly.http.server.httphandler.runservice(httphandler.java:201) @ org.glassfish.grizzly.http.server.httphandler.dohandle(httphandler.java:175) @ org.glassfish.grizzly.http.server.httpserverfilter.handleread(httpserverfilter.java:235) @ org.glassfish.grizzly.filterchain.executorresolver$9.execute(executorresolver.java:119) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executefilter(defaultfilterchain.java:284) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executechainpart(defaultfilterchain.java:201) @ org.glassfish.grizzly.filterchain.defaultfilterchain.execute(defaultfilterchain.java:133) @ org.glassfish.grizzly.filterchain.defaultfilterchain.process(defaultfilterchain.java:112) @ org.glassfish.grizzly.processorexecutor.execute(processorexecutor.java:77) @ org.glassfish.grizzly.nio.transport.tcpniotransport.fireioevent(tcpniotransport.java:561) @ org.glassfish.grizzly.strategies.abstractiostrategy.fireioevent(abstractiostrategy.java:112) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.run0(workerthreadiostrategy.java:117) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.access$100(workerthreadiostrategy.java:56) @ org.glassfish.grizzly.strategies.workerthreadiostrategy$workerthreadrunnable.run(workerthreadiostrategy.java:137) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.dowork(abstractthreadpool.java:565) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.run(abstractthreadpool.java:545) @ java.lang.thread.run(thread.java:745) warning: standardwrappervalve[faces servlet]: servlet.service() servlet faces servlet threw exception java.lang.nullpointerexception @ java.net.urlencoder.encode(urlencoder.java:204) @ com.sun.faces.context.urlbuilder.addvaluestoparameter(urlbuilder.java:318) @ com.sun.faces.context.urlbuilder.addparameters(urlbuilder.java:127) @ com.sun.faces.context.externalcontextimpl.encodebookmarkableurl(externalcontextimpl.java:1054) @ com.sun.faces.application.view.multiviewhandler.getbookmarkableurl(multiviewhandler.java:407) @ javax.faces.application.viewhandlerwrapper.getbookmarkableurl(viewhandlerwrapper.java:272) @ org.jboss.weld.jsf.conversationawareviewhandler.getbookmarkableurl(conversationawareviewhandler.java:132) @ com.sun.faces.renderkit.html_basic.outcometargetrenderer.getencodedtargeturl(outcometargetrenderer.java:194) @ com.sun.faces.renderkit.html_basic.outcometargetlinkrenderer.renderasactive(outcometargetlinkrenderer.java:158) @ com.sun.faces.renderkit.html_basic.outcometargetlinkrenderer.encodebegin(outcometargetlinkrenderer.java:96) @ javax.faces.component.uicomponentbase.encodebegin(uicomponentbase.java:864) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1854) @ javax.faces.render.renderer.encodechildren(renderer.java:176) @ javax.faces.component.uicomponentbase.encodechildren(uicomponentbase.java:889) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1856) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1859) @ javax.faces.component.uicomponent.encodeall(uicomponent.java:1859) @ com.sun.faces.application.view.faceletviewhandlingstrategy.renderview(faceletviewhandlingstrategy.java:456) @ com.sun.faces.application.view.multiviewhandler.renderview(multiviewhandler.java:133) @ javax.faces.application.viewhandlerwrapper.renderview(viewhandlerwrapper.java:337) @ com.sun.faces.lifecycle.renderresponsephase.execute(renderresponsephase.java:120) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.render(lifecycleimpl.java:219) @ javax.faces.webapp.facesservlet.service(facesservlet.java:647) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1682) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:318) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:160) @ org.apache.catalina.core.standardpipeline.doinvoke(standardpipeline.java:734) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:673) @ com.sun.enterprise.web.webpipeline.invoke(webpipeline.java:99) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:174) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:415) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:282) @ com.sun.enterprise.v3.services.impl.containermapper$httphandlercallable.call(containermapper.java:459) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:167) @ org.glassfish.grizzly.http.server.httphandler.runservice(httphandler.java:201) @ org.glassfish.grizzly.http.server.httphandler.dohandle(httphandler.java:175) @ org.glassfish.grizzly.http.server.httpserverfilter.handleread(httpserverfilter.java:235) @ org.glassfish.grizzly.filterchain.executorresolver$9.execute(executorresolver.java:119) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executefilter(defaultfilterchain.java:284) @ org.glassfish.grizzly.filterchain.defaultfilterchain.executechainpart(defaultfilterchain.java:201) @ org.glassfish.grizzly.filterchain.defaultfilterchain.execute(defaultfilterchain.java:133) @ org.glassfish.grizzly.filterchain.defaultfilterchain.process(defaultfilterchain.java:112) @ org.glassfish.grizzly.processorexecutor.execute(processorexecutor.java:77) @ org.glassfish.grizzly.nio.transport.tcpniotransport.fireioevent(tcpniotransport.java:561) @ org.glassfish.grizzly.strategies.abstractiostrategy.fireioevent(abstractiostrategy.java:112) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.run0(workerthreadiostrategy.java:117) @ org.glassfish.grizzly.strategies.workerthreadiostrategy.access$100(workerthreadiostrategy.java:56) @ org.glassfish.grizzly.strategies.workerthreadiostrategy$workerthreadrunnable.run(workerthreadiostrategy.java:137) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.dowork(abstractthreadpool.java:565) @ org.glassfish.grizzly.threadpool.abstractthreadpool$worker.run(abstractthreadpool.java:545) @ java.lang.thread.run(thread.java:745)
it comes when go index.xhtml
read stack trace bottom top , pick relevant lines understand flow.
@ javax.faces.webapp.facesservlet.service(facesservlet.java:647)
so, facesservlet
invoked , servicing request.
@ com.sun.faces.lifecycle.renderresponsephase.execute(renderresponsephase.java:120
so, render response phase executed.
@ com.sun.faces.application.view.faceletviewhandlingstrategy.renderview(faceletviewhandlingstrategy.java:456)
so facelets (xhtml) file rendered.
@ com.sun.faces.renderkit.html_basic.outcometargetlinkrenderer.encodebegin(outcometargetlinkrenderer.java:96)
so, <h:link>
being rendered.
@ com.sun.faces.renderkit.html_basic.outcometargetrenderer.getencodedtargeturl(outcometargetrenderer.java:194)
so, needs render target url.
@ com.sun.faces.context.urlbuilder.addparameters(urlbuilder.java:127)
so, link has <f:param>
values need added target url.
@ java.net.urlencoder.encode(urlencoder.java:204)
and need url encoded.
java.lang.nullpointerexception
however, value
of <f:param>
of <h:link>
appears null
.
i think now?
Comments
Post a Comment