2013-10-17 101 views
2

我目前使用的是Primefaces 4.0,Omnifaces 1.6.2,MyFaces 2.1.12和Google App Engine 1.8.3。Omnifaces 1.6.2和Google App Engine

當部署應用程序,我得到以下錯誤:

java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google App Engine developer's guide for more details. 
    at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) 
    at org.omnifaces.util.JNDI.lookup(JNDI.java:82) 
    at org.omnifaces.config.BeanManager.init(BeanManager.java:68) 
    at org.omnifaces.config.BeanManager.getReference(BeanManager.java:107) 
    at org.omnifaces.application.OmniApplication.createConverter(OmniApplication.java:86) 
    at org.primefaces.config.ConfigContainer.initConfig(ConfigContainer.java:69) 
    at org.primefaces.config.ConfigContainer.<init>(ConfigContainer.java:59) 

是否有可能禁用CDI功能/ JNDI查找在Omnifaces在啓動?

我在Omnifaces 1.6.0中沒有這個問題。

在此先感謝,

拉斐爾。

+0

Geez。看着它。 – BalusC

+0

請嘗試1.6.3快照:https://code.google.com/p/omnifaces/issues/detail?id=263 – BalusC

+0

非常感謝BalusC。 我試過1.6.3快照,現在它按預期工作。 – rmart

回答

1

此問題已在OmniFaces中修復1.6.3。當JNDI(和CDI)在運行時類路徑中不可用時,解決方案就會快速且無聲地失敗。

try { 
    Class.forName("javax.enterprise.inject.spi.BeanManager"); // Is CDI present? 
    Class.forName("javax.naming.InitialContext"); // Is JNDI present? (not on Google App Engine) 
} 
catch (Throwable ignore) { 
    return; // CDI or JNDI not supported on this environment. 
} 

// ...