Die Verwendung des neuen Namespaces xmlns.jcp.org für Verbundwerkstoffe führt zu einer Ausnahme von java.lang.NullPointerException in java.util.concurrent.ConcurrentHashMap.putIfAbsent
Ich lese das Java EE 7 Tutorial vonhttp://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets005.htm#GIQZR
Nachdem ich den Beispielcode im Kapitel 8.5 Composite Components in meine IDE eingegeben und das Beispiel auf GlassFish4.0 ausgeführt habe, ist ein Fehler aufgetreten
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1078)
at com.sun.faces.util.Cache.get(Cache.java:116)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata(FaceletViewHandlingStrategy.java:237)
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:951)
at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:648)
Dann überprüfe ich die ältere Version dieses Tutorials, ich habe einen Unterschied festgestellt.
In der Java EE 7-Version sieht der email.xhtml-Code folgendermaßen aus:
<!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 will not be 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>
Aber in der 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 will not be 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>
Nachdem ich den Code auf Java EE 6 geändert habe, ist der Fehler behoben. Der Unterschied ist der Namespace. Ich weiß nicht, ob dies ein Thema dieses Tutorials ist. Gibt es welche, die es wissen?