2013-08-23 49 views
1

我試圖從運行的例子CH05 「核心JavaServer Faces的」 圖書(http://horstmann.com/corejsf/FileNotFoundException異常時使用的Facelets TAGFILE

登錄我收到以下消息後:

/sections/planetarium/sidebarLeft.xhtml @12,72 <corejsf:planet> null 

行星的組合物中,駐留在WEB-INF /標籤/ corejsf/planet.xhtml

的corejsf.taglib.xml是:

<?xml version="1.0"?> 
<!DOCTYPE facelet-taglib PUBLIC 
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" 
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd"> 
<facelet-taglib> 
    <namespace>http://corejsf.com/facelets</namespace> 
    <tag> 
    <tag-name>planet</tag-name> 
    <source>tags/corejsf/planet.xhtml</source> 
    </tag> 
</facelet-taglib> 

中的web.xml,包括文件:

<context-param> 
    <param-name>facelets.LIBRARIES</param-name> 
    <param-value>/WEB-INF/corejsf.taglib.xml</param-value> 
</context-param> 

調試時,我得到一個FileNotFoundException異常而尋找 「JNDI:/server/planets/WEB-INF/tags/corejsf/planet.xhtml」。

在其他機器上,我部署了同樣的戰爭並沒有例外。

戰爭部署在GlassFish4

最後的堆棧跟蹤:

com.sun.faces.facelets.impl.DefaultFaceletCache._unwrapIOException(DefaultFaceletCache.java:166) 
com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:126) 
com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:63) 
com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:299) 
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:370) 
com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:326) 
com.sun.faces.facelets.tag.UserTagHandler.apply(UserTagHandler.java:142) 
javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) 
javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) 
com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:190) 
javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) 
com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:189) 
com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) 
com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) 
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:312) 
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:371) 
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:350) 
com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199) 
com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:120) 
com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:116) 
javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) 
javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) 
com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:190) 
javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) 
javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) 
com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) 
com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) 
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:312) 
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:371) 
com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:350) 
com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199) 
com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:169) 
com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) 
com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) 
com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:161) 
com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:972) 
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99) 
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:357) 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260) 
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188) 
org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191) 
org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168) 
org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189) 
org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288) 
org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206) 
org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136) 
org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114) 
org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838) 
org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113) 
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115) 
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55) 
org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135) 
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564) 
org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544) 
+0

「安裝的Facelets 1.x」是什麼意思?在部署的war文件中沒有附加jar,我使用「vanilla」glassfish4,從「http://glassfish.java.net/download.html」下載爲「Full Java EE平臺」和zip。我購買了本書的第3版及其關於jsf 2. – user2706510

+0

我用 。不幸的是它沒有幫助 – user2706510

回答

2

我遇到同樣的問題,我的項目(Glassfish的4 +彈簧+ EJB 3 + JSF 2.2 +自定義標籤)在我的本地Glassfish和分段服務器上運行良好,但在生產中它拋出了異常TagException: /WEB-INF/templates/common.xhtml @38,33 <app:div> null

經過大量調試,我們發現問題所在。如果您的Glassfish配置了多個虛擬服務器,並且您的項目已部署並與2個或更多的關聯,則JSF lib將通過您正在訪問的當前主機名稱讀取源文件,但對於自定義facelet標記,它會通過不同的虛擬服務器(可能是一個bug)並且拋出FileNotFoundException(被TagException壓制)。

如果將部署的項目配置爲只有一個虛擬服務器,則不會發生此問題。

相關問題