我使用TomEE加1.7.2服務器並嘗試啓動web應用程序與OmniFaces包括在內,但我得到一個空指針異常:顯示java.lang.NullPointerException在org.omnifaces.cdi.eager.EagerBeansWebListener.requestInitialized
WARNUNG: Could not instantiate eager request scoped beans for request /index.xhtml. Possibly the CDI request scope is not active. If this is indeed the case, see JavaDoc on org.omnifaces.cdi.Eager on how to remedy this.
java.lang.NullPointerException at org.omnifaces.cdi.eager.EagerBeansWebListener.requestInitialized(EagerBeansWebListener.java:78)
當我使用EagerBeansFilter如OmniFaces docs所示,我得到一個微小的變化:
WARNUNG: Could not instantiate eager application scoped beans. Possibly the CDI application scope is not active. This is known to be the case in certain Tomcat and Jetty based configurations.
java.lang.NullPointerException at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateApplicationScopedAndRegisterListener(EagerBeansRepository.java:69)
這是服務器omnifaces不可組合?
準確哪個OmniFaces版本?你可以在這裏找到兼容性矩陣:https://github.com/omnifaces/omnifaces/wiki/Compatibility-Matrix TomEE是最受測試的服務器之一。該webapp是爲Tomcat還是Java EE設計的? TomEE絕對不能與Tomcat相提並論。任何Tomcat(或Jetty或任何其他定製堆棧)的目標webapp在部署到標準Java EE服務器時都會以某種方式失敗。 – BalusC
問題至少表明配置錯誤的CDI環境。也許webapp確實是Tomcat的目標,並且捆綁了一些CDI庫,而當部署在標準的Java EE服務器上時,這些服務器已經提供了幾種Java EE API實現,例如CDI(和JSF!)。 – BalusC
好吧,問題似乎是omnifaces版本相關:我使用2.2-RC2,現在更新到2.3,並沒有例外了! – Lemao1981