NPE in FacesContextHelper under Jboss EAP 7.2 - jsf

we're trying to migrate our application from Jboss Eap 6.4 to 7.2 but we're facing this issue.
When we're rendering the first view a NPE happens
Caused by: java.lang.NullPointerException
at deployment.EAR-0.0.1-SNAPSHOT.ear.blue_webLayer-0.0.2-SNAPSHOT.war//org.springframework.faces.webflow.FacesContextHelper.releaseIfNecessary(FacesContextHelper.java:64)
at deployment.EAR-0.0.1-SNAPSHOT.ear.blue_webLayer-0.0.2-SNAPSHOT.war//org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:61)
at deployment.EAR-0.0.1-SNAPSHOT.ear.blue_webLayer-0.0.2-SNAPSHOT.war//org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at deployment.EAR-0.0.1-SNAPSHOT.ear.blue_webLayer-0.0.2-SNAPSHOT.war//org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at deployment.EAR-0.0.1-SNAPSHOT.ear.blue_webLayer-0.0.2-SNAPSHOT.war//org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
It's like our app isn't able to create a faces context.
In addition I've seen some strange lines during the startup
10:06:34,775 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 55) WFLYJSF0007: Activated the following JSF Implementations: [main]
....
10:07:09,505 WARN [org.jboss.as.jsf] (MSC service thread 1-1) WFLYJSF0005: Unknown JSF version 'NONE'. Default version 'main' will be used instead.
We've replaced under "main" folder of Jboss' modules the api and spec JSF with the one we're using at the moment with Jboss 6.4.
We've also tried to use multiple JSF installation without luck.
Any idea?

The issue was caused to an updated version of spring-faces.
Using 2.3.2.RELEASE with spring-core 3.2.18.RELEASE fixed the issue.
Now our application is running under EAP 7.2 with custom JSF impl (mojarra 2.1.13)
I'll still need to figure out how to make it work with Spring 4+ and jsf-impl 2.3 but these are another kind of problem.

Related

java.lang.NullPointerException at org.omnifaces.cdi.eager.EagerBeansWebListener.requestInitialized

I am using TomEE Plus 1.7.2 Server and try to start a webapp with OmniFaces included, but I get a Nullpointer exception:
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)
When I use the EagerBeansFilter as shown at OmniFaces docs, I get a slight variation:
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)
Is this server not combinable with omnifaces?
TomEE is after WildFly one of most tested servers for OmniFaces, particularly because it uses almost everywhere in Java EE a different implementation as compared to WildFly (Apache vs Oracle). In the OmniFaces compatibility matrix you can find TomEE versions which successfully ran through all pages in OmniFaces showcase.
Those exceptions mentioned in your question will be thrown when CDI BeanManager couldn't find the OmniFaces EagerBeansRepository, which is an #ApplicationScoped bean. This in turn indicates a misconfigured CDI environment (e.g. wrong beans.xml or missing JNDI/listener configuration) or a dirty build (e.g. duplicate libraries). Verifying the CDI configuration and performing a full clean/rebuild should solve the problem.
At least, OmniFaces 2.2 or newer is technically incompatible with TomEE 1.x, because TomEE 1.x ships with JSF 2.1 and OmniFaces 2.2 or newer has a hard dependency on JSF 2.2 due to new <o:viewAction> tag. So, unless you modify TomEE to provide JSF 2.2, OmniFaces 2.2 or newer won't deploy and should fail deployment with below exception:
java.lang.NoClassDefFoundError: javax/faces/component/UIViewAction
The latest OmniFaces version which successfully deploys on a stock TomEE 1.7.x server is OmniFaces 2.1. If you want to use OmniFaces 2.2 or newer on a stock TomEE, then you need to upgrade to TomEE 7.x.

java.lang.ClassNotFoundException: javax.servlet.ServletRegistration when using OmniFaces library on Glassfish v2.1

I'm trying to use the excellent OmniFaces library on a Glassfish v2.1 server.
It works well until I try to use the org.omnifaces.util.Faces class. In this case, I encounter a
java.lang.ClassNotFoundException: javax.servlet.ServletRegistration
From what I've gathered, it seems this class appeared with the Servlet 3.0 specification.
Glassfish v2.1 is only Servlet 2.5 compatible but OmniFaces documentation indicates that it only requires Servlet 2.5.
Is there something I'm missing ? Is this a dependency that was accidentally added ?
Full configuration is :
Myfaces 2.1.12
Glassfish v2.1.1 (9.1_02 Patch12)
OmniFaces 1.6
Thank you for your answers.
I've come across this article that explains things a bit more but I'm still confused as to whether or not it should work on Glassfish 2.1.
OmniFaces is indeed supposed to be Servlet 2.5 compatible, but that's not thoroughly tested as the development and showcase environments are Servlet 3.0 based. See also https://github.com/omnifaces/omnifaces/wiki/Java-EE-5-and-6-compatibility, so it may happen that something accidently slipped through. This is one of those things.
As per issue 298, this has been fixed for the current 1.8 snapshot.

Error deploying JSF app in Glassfish

I used to deploy a JSF+Primefaces app in a Glassfish server without any trouble. Recently I upgraded my NetBeans version. I haven't had any problems with the most of the applications after that. But with one of them when I tried to do the deployment, it failed and this was the error message:
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: java.lang.RuntimeException:
com.sun.faces.config.ConfigurationException:
java.util.concurrent.ExecutionException:
com.sun.faces.config.ConfigurationException: Unable to parse document
'jar:file:/opt/glassfish3/glassfish/domains/domain1/applications/[name-of-the-application]/WEB-INF/lib/javax.faces.jar!/META-INF/mojarra_ext.taglib.xml':
null. Please see server.log for more details.
It seems like all is ok with the project (cleans and build well), but the error keeps appearing. This is the environment I'm using:
NetBeans 7.3.1
JSF 2.2 (Mojarra)
GlassFish Open Source Edition 3.1.1 (build 12).
PS: When I try to do the deployment with Glassfish 3 bundled in NetBeans, this is the error:
SEVERE: Error during deployment : class com.sun.faces.application.annotation.PersistenceUnit Scanner cannot access its superinterface com.sun.faces.application.annotation.Scanner
Thanks
Unable to parse document 'jar:file:/opt/glassfish3/glassfish/domains/domain1/applications/[name-of-the-application]/WEB-INF/lib/javax.faces.jar!/META-INF/mojarra_ext.taglib.xml
The path to the taglib file suggests that you shipped JSF 2.2 along with the webapp inside its /WEB-INF/lib instead of upgrading GlassFish itself. As GlassFish 3 itself ships with a JSF 2.1 implementation out the box, you need to instruct it to not load it in order to avoid version conflicts. You didn't state anywhere that you were doing that, so I guess that this is the whole cause of your problem.
Glassfish itself already ships with JSF bundled which get by default classloading precedence over the one bundled in the webapp. You basically need to tell Glassfish to use the webapp bundled JSF instead.
In order to achieve that, edit the /WEB-INF/glassfish-web.xml to add the following two lines.
<class-loader delegate="false" />
<property name="useBundledJsf" value="true" />
If the file does not exist create it, you can find a sample xml file here. and add the two lines from above inside the <glassfish-web-app> tag.
GlassFish will then suppress its own bundled JSF from loading and rely on webapp-bundled JSF.
Alternatively, if you have full admin control over Glassfish, you can also copy the javax.faces.jar file from JSF 2.2 into the /glassfish/modules directory, hereby replacing the old one, in order to upgrade it from JSF 2.1 to JSF 2.2 so that it get applied on all webapps.

Richfaces 3.3.3.final jar and jsf 1.2 deployment fails on WAS7

I want to migrate from richfaces 3.3.1 to 3.3.3.Final jar for rich:scrollabledatatable issues (header disappears after rerender).
I am using jsf 1.2. After successfully building the application through maven,I deployed build of my applicaiton on WAS 7, i am getting error saying Deployment failed:
ADMA5069E : The installation of App failed.
If anyone has done migration to 3.3.3.Final, please suggest if apart from pom.xml version change anything else needs to be done.All other web.xml entries etc are same as when i used 3.3.1 richfaces version.

JSF 2.1 web-app runs on Tomcat 6 but fails on Tomcat 7

I have a JSF 2.1 web-application that uses Primefaces 3.1.1. The integration-tests run fine on Tomcat 6, but on an identically configured Tomcat 7 I get the following error:
[INFO] [talledLocalContainer] 16.10.2012 15:25:13 com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback visit
[INFO] [talledLocalContainer] SEVERE: java.lang.NullPointerException
No further stacktrace or anything that could hint at the problem (all logging levels set to ALL). I can load the application in the browser, but it does not respond to any input.
I am using Primefaces 3.1.1 and Mojorra 2.1.13. Is this a known issue? What has changed from Tomcat 6 to 7 that could have this effect?
P.S.: I have also tried JBOSS AS 7 with the built-in JSF, which also runs fine.
After some digging around I found that I seem to have stumbled upon this issue. Does anyone have resolution for that?

Resources