OpenShift: Too many active sessions - jsf

I got an error in OpenShift scalable (JSF JBossAS 7.1) application:
2014/06/19 03:39:55,581 FATAL
[org.apache.jasper.runtime.JspFactoryImpl]
(http-127.12.210.1-127.12.210.1-8080-2) Exception initializing page
context: java.lang.IllegalStateException: createSession: Too many
active sessions
I configured STATE_SAVING_METHOD to client but error is the same.
Why does this error appears?

it seems the solution is put next code snippet to jsp page which is available for haproxy
<%# page session="false" %>

Related

Liberty profile: birt and jsf integration

I'm building a web application running on Liberty profile 8.5, with JSF 2.0 feature enabled (jsf-2.0 in server.xml) and BIRT integration in the web app.
The web application includes all BIRT needed libs in WEB-INF/lib folder, but the only way to make it working (specially for chart report) is to set the classloader to 'parentlast' in the server.xml:
<webApplication contextRoot="MyApp" id="MyApp" location="MyApp.war" name="MyApp">
<classloader delegation="parentLast"/>
</webApplication>
In this way, I correctly see charts and reports.
But the 'parentlast' setting makes JSF not working, with this exception:
[ERROR ] SRVE0315E: An execption occurred:
com.ibm.ws.webcontainer.webapp.WebAppErrorReport:
javax.servlet.ServletException: SRVE0207E: Uncaught initialization
exception created by servlet at
com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:385)
at [internal classes] Caused by: javax.servlet.ServletException:
SRVE0207E: Uncaught initialization exception created by servlet ... 3
more
Caused by: java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener><listenerclass>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
Without the parentlast setting, the JSF pages are correctly shown, but BIRT charts don't work.
I understand this behaviour, as the parentlast classloading makes the application seeing at first the application libs, where JSF is not included (it's loaded at server scope).
Any suggestion?
Thank you in advance!

The absolute uri: http://java.sun.com/jsf/html cannot be resolved when running JSF 1.0 application on Wildfly 8.1

I'm working on upgrading one of my applications from JSF 1.0 to 2.0. It runs on JBoss 4.0.3SP1 and I'm trying to make it run on WildFly 8.1 final. After some struggles, I was able to get the application compiled and deployed to WildFly but got this error, when accessing the .jsp file.
2015-07-09 07:40:08,600 ERROR [io.undertow.request] (default task-2) UT005022: Exception generating error page /errorpages/error.faces: org.apache.jasper.Jasper
Exception: JBWEB004113: **The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with this application** at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:53) [jastow-1.0.0.Final.jar:1.0.0.Final]
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:147) [jastow-1.0.0.Final.jar:1.0.0.Final]
I've read the following articles but still cannot fix the problem.
JSF 1.2 on Wildfly 8 Final - weld-core-jsf is still referencing JSF 2.2 API
Can not find the tag library descriptor for http://java.sun.com/jsf/facelets
https://developer.jboss.org/wiki/StepsToAddAnyNewJSFImplementationOrVersionToWildFly
https://developer.jboss.org/wiki/DesignOfWildFlyMulti-JSFFeature
I also enabled org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL in web.xml and disabled "weld" in WildFly and I put the following libs/files in <EAR>/lib, <WAR>/WEB-INF/lib.
jsf-api.jar
jsf-impl.jar
jstl.jar
standard.jar
html_basic.tld, jsf_core.tld
And, for JSTL, I tried different URLs, like:
<%# taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
or
<%# taglib uri="http://java.sun.com/jsp/jstl/html" prefix="h"%>
or put the URL into <html> instead of using <%#taglib>.
However, the problem cannot be resolved by the above steps.
Is there anyone had the same problem can share some experience? I'd like to see if there is a possibility I can run the JSF 1.0 code on WildFly?
Thanks in advance!

mojarra is not defined

I'm developing JSF application with mojarra.
I'm getting javascript error "mojarra is not defined".
After deploy everything is ok, ajax call works properly.
But after refreshing page, error appears.
There is lack of javascript include in head tag after refreshing.
It seems to be working very moody.
Same behavior I have on Tomcat and Glassfish, Mojarra is in version 2.0.3.
One of the reason this error can appear is by using <head>..</head> and <body>...</body> tags instead of <h:head>...</h:head> and <h:body>...</h:body>.
Namespace - xmlns:h="http://java.sun.com/jsf/html"

IntelliJIdea, error in deployment of spring + JSF application

In IntelliJIdea, i've created a little application with just default pages auto created by ide. I've added two frameworks: spring (3) and JSF 2. The app level is java ee 2.5, because I want to deploy on a Tomcat 6.0.
I installed an Apache Tomcat 6.0, created an administrator user, and tested, it works.
But when I deploy the simple application, it seems to deploy it correctly, but accessing it, the browser gives the error:
Simple jsp page
12: <body>
13:
14: f:view>
15:
16:
17:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:519)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.RuntimeException: FacesContext not found
....
java.lang.RuntimeException: FacesContext not found
The JSF component is complaining that the FacesContext cannot be found. The FacesServlet is the one responsible for creating it. So it has clearly not run. You need to ensure that the request URL as you entered in the browser address bar matches the URL pattern of the FacesServlet as it is been definied in the webapp's web.xml file (and that it is been definied in the web.xml). If it is for example
<url-pattern>*.jsf</url-pattern>
then you need to ensure that the request URL is
http://localhost:8080/contextname/page.jsf
and thus not
http://localhost:8080/contextname/page.jsp
If the request URL matches the URL pattern of the FacesServlet, then it will be invoked and it will do all the JSF jobs.
Unrelated to the problem: why the choice for JSP when you're using JSF2? Why not using its superior successor Facelets instead?
I encountered the same problem. The solution for me was to use the URL "http://localhost:8080/index.faces".

java.lang.IllegalArgumentException: null source

We have an application which uses JSF2 and Spring. The application works fine when deployed. But this happens if I went through the following steps:
Open the login page of the application.
Redeployed the application on the server.
Tried to login using the previously opened login page, and it shows the following exception:
javax.servlet.ServletException: null source
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
root cause
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:38)
at javax.faces.event.SystemEvent.<init>(SystemEvent.java:67)
at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69)
at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69)
at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
If I click on the first login page and then enter the login details the application does not break. This only occurs if I try to use the previously loaded login page with the newly deployed application.
Anyone knows the answer?
This one should have been thrown as a ViewExpiredException. It's a bug which started to manifest in Mojarra 2.0.3 and is been fixed in Mojarra 2.1.0. See also issue 1762 (note that Mojarra 2.1.0 doesn't work on Tomcat/Jetty, use at least Mojarra 2.1.1 then).
Basically, when Mojarra fails to build or restore the view, then it usually throws a specific enough exception, but due to this bug, a valid view was incorrectly been expected later in the code which in turn results in IllegalArgumentException: null source. The possible real cause would have been that the view contains a simple XML syntax error, such as a missing tag or broken attribute value, for which Mojarra would usually have thrown a FaceletException with a very detailed message with line number and position and such.
To prevent the ViewExpiredException, you would have to refresh the page by a GET request before doing any actions on it. If you're using a Mojarra version where this bug does not manifest (e.g. 2.0.2 or older, or 2.1.0 or newer), then you could gracefully handle it with an <error-page> in web.xml on the particular exception and provide a custom error page wherein the enduser is informed that the session has been expired, along with a link to the initial request URI.
This looks like http://java.net/jira/browse/JAVASERVERFACES-1758
which is not fixed in Mojarra 2.1.x
As long as javax.faces.PARTIAL_STATE_SAVING is set to false you'll receive that java.lang.IllegalArgumentException. If you set javax.faces.PARTIAL_STATE_SAVING to true (and you know what you are doing) you will get the "good old" javax.faces.application.ViewExpiredException back.
In my case turned out i had missing end tag in xhtml file for one of the jstl calls. i was using choose tag and one of the when tags in between choose did not have an end tag

Resources