Pregunta

I'm currently using Primefaces 4.0, Omnifaces 1.6.2, MyFaces 2.1.12, and Google App Engine 1.8.3.

When deploying the application I get the following error:

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)

Is it possible to disable CDI features/JNDI lookups in Omnifaces at startup?

I didn't have that problem in Omnifaces 1.6.0.

Thanks in advance,

Rafael.

¿Fue útil?

Solución

This problem has been fixed in OmniFaces 1.6.3. The solution was to fail fast and silently when JNDI (and CDI) aren't available in the runtime classpath.

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.
}

// ...
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top