jsf - Using new xmlns.jcp.org namespace on composites causes java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent -
i reading java ee 7 tutorial http://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets005.htm#giqzr
after typed example code in chapter 8.5 composite components in ide , run example on glassfish4.0, got error
java.lang.nullpointerexception @ java.util.concurrent.concurrenthashmap.putifabsent(concurrenthashmap.java:1078) @ com.sun.faces.util.cache.get(cache.java:116) @ com.sun.faces.application.view.faceletviewhandlingstrategy.getcomponentmetadata(faceletviewhandlingstrategy.java:237) @ com.sun.faces.application.applicationimpl.createcomponent(applicationimpl.java:951) @ javax.faces.application.applicationwrapper.createcomponent(applicationwrapper.java:648)
then check older version of tutorial, found difference.
in java ee 7 version email.xhtml code following:
<!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" xmlns:composite="http://xmlns.jcp.org/jsf/composite" xmlns:h="http://xmlns.jcp.org/jsf/html"> <h:head> <title>this content not displayed</title> </h:head> <h:body> <composite:interface> <composite:attribute name="value" required="false"/> </composite:interface> <composite:implementation> <h:outputlabel value="email id: "></h:outputlabel> <h:inputtext value="#{cc.attrs.value}"></h:inputtext> </composite:implementation> </h:body> </html>
but in java ee 6 version
<!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" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>this content not displayed</title> </h:head> <h:body> <composite:interface> <composite:attribute name="value" required="false"/> </composite:interface> <composite:implementation> <h:outputlabel value="email id: "></h:outputlabel> <h:inputtext value="#{cc.attrs.value}"></h:inputtext> </composite:implementation> </h:body> </html>
after changed code java ee 6 version, error gone. difference namespace. don't know whether issue of tutorial. there knows?
the way how new xmlns.jcp.org
xml namespaces been handled broken in first mojarra releases 2.2.0 , 2.2.1. has been fixed in mojarra 2.2.2 (note: ticket in link describes different problem symptom, under covers, it's same cause). it's recommended upgrade @ least mojarra 2.2.2 (always pick newest available, if possible). glassfish 4.0 has 2.2.0 bundled. can jar javaserverfaces.java.net. need replace javax.faces.jar
file in glassfish's /modules
folder newer version.
the java ee 7 tutorial fine. implementation broken. kind of trouble way not unusual first major glassfish release (all hastle ready on time). recommend wait java ee 7 until glassfish 4.0.1 or 4.1 has been brought out avoid future surprises. note other vendors apache tomcat , jboss take time release java ee 7 container; don't have production ready version yet.
Comments
Post a Comment