I have a big problem when I deploy my application in jboss 5.1. When it starts, I get this:
org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
com.sun.faces.config.ConfigurationException: It appears the JSP version of the container is older than 2.1 and unable to locate the EL RI expression factory, com.sun.el.ExpressionFactoryImpl. If not using JSP or the EL RI, make sure the context initialization parameter, com.sun.faces.expressionFactory, is properly set.
I read many things about this bug, and nothing works for me.
I haven't jsf-api and jsf-impl in my WEB-INF/lib.
Here is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Personnes-Front</display-name>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<!-- Mojarra JSF -->
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:net/blog/dev/front/applicationContext.xml
</param-value>
</context-param>
<context-param>
<param-name>facelets.BUFFER_SIZE</param-name>
<param-value>100000</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>0</param-value>
</context-param>
<!-- JSF -->
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<!-- Facelets -->
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener
</listener-class>
</listener>
<!-- JSF -->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener
</listener-class>
</listener>
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<!-- FILTERS -->
<!-- RichFaces -->
<filter>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>FacesServlet</servlet-name>
</filter-mapping>
<!-- Page par défaut -->
<welcome-file-list>
<welcome-file>private/personnesList.xhtml</welcome-file>
</welcome-file-list>
</web-app>
I don't understand what is the problem.
Thanks for your help.
I have found the solution.
Jboss 5.1 come with JSF 1.2.12 and this version seem to not work with jboss el.
So I have added this in my web.xml:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
And in my pom.xml, I fixe a newer version (1.2.13 for exemple) for jsf-api and jsf-impl and I remove the scope provided.
The war is deploy with this own jsf version and all work fine.
Related
My Current web-application is using Servlet 4.0 version and
I am trying disable auto-initialization for log4j2 and below is my web.xml
I have followed Official document
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>CentricityPracticeWS</display-name>
<listener>
<listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
</listener>
<filter>
<filter-name>CentricityPracticeWS</filter-name>
<filter-class>org.apache.logging.log4j.web.Log4jServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CentricityPracticeWS</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<context-param>
<param-name>isLog4jContextSelectorNamed</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>file://C://jboss//standalone//deployments//CentricityPracticeEAR.ear//init//log4j2.xml</param-value>
</context-param>
<context-param>
<param-name>log4jContextName</param-name>
<param-value>CentricityPracticeWS</param-value>
</context-param>
<context-param>
<param-name>isLog4jAutoInitializationDisabled</param-name>
<param-value>true</param-value>
</context-param>
<!-- init properties shared by entire application -->
<context-param>
<param-name>earDeploymentDescriptorPath</param-name>
<param-value>application.xml</param-value>
</context-param>
<listener>
<listener-class>com.CustomListener</listener-class>
</listener>
<!-- bootstrap Log4j -->
<!-- Log4j refresh interval -->
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>60000</param-value>
</context-param>
<context-param>
<param-name>log4jExposeWebAppRoot</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- bootstrap Spring -->
<context-param>
<param-name>parentContextKey</param-name>
<param-value>centricity.practice</param-value>
</context-param>
<context-param>
<param-name>locatorFactorySelector</param-name>
<param-value>/beanRefFactory.xml</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/context-web.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- welcome file list-->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
disable auto-initialization is not working with above web.xml
I have also tried keeping only below but no luck
<context-param>
<param-name>isLog4jAutoInitializationDisabled</param-name>
<param-value>true</param-value>
</context-param>
please correct me if there is anything wrong with above web.xml configuration
your help is apricated !!
I can confirm auto-initialization is not disabled from server.log file
Because , I am having a listener that invokes during server startup ,
I having some debug statements in the listener which are printing before log4j initialization,
hence log4j is initializing first before my listener start . This flow is working as expected with log4j 1.2.17 version
I am setting some variables in the listener which I want to use in log4j2.xml .
As log4j is initialization is happening before my listener and variables are not resolving
I'm using Mojarra 2.2 on Tomcat 8 and Eclipse 4.4.1 (Build id: 20140925-1800) without any additional plugins and no Maven.
Everything works fine, but in last few days I have the following problem:
I start Tomcat, can navigate and submit data, etc, everything works correct. Now if I change my Java code, then Tomcat republishes as usual, but if I try to refresh the page in browser via F5, then I get the following error:
HTTP Status 503 - Servlet Faces Servlet is currently unavailable
In Eclipse console the following appears:
Apr 27, 2015 5:18:27 PM org.apache.catalina.core.ApplicationDispatcher invoke
WARNUNG: Servlet Faces Servlet is currently unavailable
Now I have to restart Tomcat after every little change in Java source code in order to solve it.
I don't know since when I have this issue, but I am sure I haven't it before. I changed many things in the project, but I cannot figure out the cause of this problem.
Here's a snippet of my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
.....
.....
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/ps/*</url-pattern>
</servlet-mapping>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>0</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml,/WEB-INF/navigations.xml</param-value>
</context-param>
....
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
....
<security-constraint>
<display-name>Restrict XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
</security-constraint>
<session-config>
<session-timeout>60</session-timeout>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/index.jsp</location>
</error-page>
<locale-encoding-mapping-list>
<locale-encoding-mapping>
<locale>de</locale>
<encoding>UTF-8</encoding>
</locale-encoding-mapping>
</locale-encoding-mapping-list>
</web-app>
How is this caused and how can I solve it?
I've been trying to set up OCPsoft's Rewrite http://ocpsoft.org/rewrite/examples/ for JSF 2.2.
My setup:
JSF 2.2
Tomcat 7
Servlet Container 3.0
Maven Project
URLRewrite Version 2.0.12
My pom.xml includes the following two dependencies
<!-- for JSF 2.x -->
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>2.0.12.Final</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-config-prettyfaces</artifactId>
<version>2.0.12.Final</version>
</dependency>
I have placed a pretty-config.xml in my WEB-INF folder
<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">
<url-mapping id="test">
<pattern value="/test" />
<view-id value="/home/index.jsf" />
</url-mapping>
</pretty-config>
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>myproject</display-name>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>org.omnifaces.CDN_RESOURCE_HANDLER_URLS</param-name>
<param-value>primefaces:jquery/jquery.js=http://code.jquery.com/jquery-1.11.0.min.js</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>State saving method: "client" or "server" (= default)
See JSF Specification 2.5.2. Zur Produktion wieder auf server schalten. HTTP
GET Request zusammen mit 'client'
führen zum Verlust des STATE</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<description>Next step - disable compression of state in server</description>
<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>If true, rendered HTML code will be formatted, so that
it is "human readable". i.e. additional line separators and whitespace will
be written, that do not influence
the HTML code. Default: "true"</description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>Very important, too, is to disable the serialization
of state, serialization and deserialization of the component tree is a
major
performance hit
</description>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
</context-param>
<!-- Verschlüsselung des Viewstates -->
<context-param>
<param-name>org.apache.myfaces.secret</param-name>
<param-value>NzY1NDMyMTA=</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
<param-value>3</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfLogicalViews</param-name>
<param-value>10</param-value>
</context-param>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/error/404.jsf</location>
</error-page>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/home/index.jsf</location>
</error-page>
<filter>
<filter-name>adminPinFilter</filter-name>
<filter-class>com.myproject.filters.AdminPinFilter</filter-class>
</filter>
<filter>
<filter-name>facesRedirectFilter</filter-name>
<filter-class>com.myproject.filters.FacesRedirectFilter</filter-class>
<init-param>
<description>Auf diese Extension soll nicht direkt zugegriffen
werden
(z.B. .xhtml)</description>
<param-name>forbiddenExtension</param-name>
<param-value>.xhtml</param-value>
</init-param>
<init-param>
<description>Auf diese Extension soll umgeleitet werden (z.B. .jsf)</description>
<param-name>redirectExtension</param-name>
<param-value>.jsf</param-value>
</init-param>
</filter>
<filter>
<filter-name>directGetFilter</filter-name>
<filter-class>com.myproject.filters.DirectGetFilter</filter-class>
</filter>
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter>
<filter-name>sessionFilter</filter-name>
<filter-class>com.myproject.filters.SessionFilter</filter-class>
</filter>
<filter>
<filter-name>authFilter</filter-name>
<filter-class>com.myproject.filters.AuthFilter</filter-class>
</filter>
<filter>
<filter-name>offerFilter</filter-name>
<filter-class>com.myproject.filters.OfferFilter</filter-class>
</filter>
<filter>
<filter-name>adminAuthFilter</filter-name>
<filter-class>com.myproject.filters.AdminAuthFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>adminPinFilter</filter-name>
<url-pattern>/adminPin/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>facesRedirectFilter</filter-name>
<url-pattern>*.xhtml</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sessionFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>authFilter</filter-name>
<url-pattern>/profile/*</url-pattern>
<url-pattern>/conversation/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>adminAuthFilter</filter-name>
<url-pattern>/admin/panel/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>offerFilter</filter-name>
<url-pattern>/offer/view/*</url-pattern>
</filter-mapping>
<session-config>
<!-- Disables URL-based sessions (no more 'jsessionid' in the URL using
Tomcat) -->
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<listener>
<listener-class>com.myproject.system.ContextFinalizer</listener-class>
</listener>
</web-app>
However, if I navigate to /test, I'm only getting a 404 error.
Is there anything I missed?
Do you have a file in your web application called "/home/index.xhtml" (or something to that effect)? Please also post your web.xml if possible. Thanks!
Also, it seems that you have quite a few filters defined in your web.xml, but you do not define the rewrite filter. This should be fine, however, it is worth adding the filter manually and seeing what happens. The rewrite filter should be the first filter in your web.xml:
<listener>
<listener-class>org.ocpsoft.rewrite.servlet.impl.RewriteServletRequestListener</listener-class>
</listener>
<listener>
<listener-class>org.ocpsoft.rewrite.servlet.impl.RewriteServletContextListener</listener-class>
</listener>
<filter>
<filter-name>OCPsoft Rewrite Filter</filter-name>
<filter-class>org.ocpsoft.rewrite.servlet.RewriteFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>OCPsoft Rewrite Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ASYNC</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
Everything is working fine now. I removed the default servlet from my web.xml.
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
I am using <rich:fileUpload> of RichFaces 3.3.3 Final. When I upload some Excel files in Chrome browser, then it sometimes shows the "Transfer failed" error message as in below screenshot:
Sample Code,
<rich:fileUpload id="fileUpload" addControlLabel="#{bundle.browse}"
allowFlash="#{not TestFileUpload.allow}"
fileUploadListener="#{TestFileUpload.fileUploadListener}"
maxFilesQuantity="10"
autoclear="false"
listHeight="135px;"
uploadControlLabel="#{bundle.upload}"
progressLabel="#{bundle.progress}"
sizeErrorLabel="#{bundle.sizeError}"
noDuplicate="true"
style="width: 100%; height: 135px;">
<a4j:support event="onuploadcomplete"
onbeforedomupdate=""
action="#{TestFileUpload.validateExcel}"
reRender="validationDetailPanelId, messageId"
focus="cancelId"/>
</rich:fileUpload>
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
<param-value>true</param-value>
</context-param>
<!--Configuration for Facelets-->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>
<context-param>
<param-name>
facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE
</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>all</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>all</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<context-param>
<param-name>org.ajax4jsf.SKIN</param-name>
<param-value>Wine</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>
/WEB-INF/test/faces-config.xml
</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>Ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
<init-param>
<param-name>enable-cache</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>createTempFiles</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>maxRequestSize</param-name>
<param-value>1048576</param-value>
</init-param>
</filter>
<filter>
<filter-name>SFilter</filter-name>
<filter-class>com.test.SFilter</filter-class>
</filter>
<listener>
<display-name>SLCListener</display-name>
<listener-class>com.test.SLCListener</listener-class>
</listener>
<!-- End of Rich Faces and A4JSF -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Custom Faces Servlet</servlet-name>
<servlet-class>com.test.CFServlet</servlet-class>
<init-param>
<param-name>error</param-name>
<param-value>/faces/pages/errorPage.jsp</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>ASServlet</servlet-name>
<servlet-class>com.test.ASServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>PASRServlet</servlet-name>
<servlet-class>com.test.PASRServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>LOServlet</servlet-name>
<servlet-class>com.test.LOServlet</servlet-class>
<init-param>
<param-name>DException</param-name>
<param-value>/faces/pages/dException.jsp</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>FDServlet</servlet-name>
<servlet-class>com.test.FDServlet</servlet-class>
</servlet>
<!--OverRiding FacesServlet Start-->
<servlet-mapping>
<servlet-name>Custom Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Custom Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<!--Filter for ajaxrequest and Custom Faces Servlet-->
<filter-mapping>
<filter-name>Ajax4jsf</filter-name>
<servlet-name>Custom Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>SSEFilter</filter-name>
<servlet-name>Custom Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<!--End-->
<!-- Filter for Commons File Upload -->
<filter>
<filter-name>Extensions Filter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Extensions Filter</filter-name>
<servlet-name>Custom Faces Servlet</servlet-name>
</filter-mapping>
<!-- End of commons file upload filter -->
<error-page>
<error-code>404</error-code>
<location>/faces/pages/error/errorPage.jsp</location>
</error-page>
</web-app>
The file is also not being uploaded to the server. How is this caused and how can I solve it?
i have the same problem since one of the lastest update of Chrome.
Chrome version : 36
The fileUploadListener method in the bean is called twice when you click on the upload button.
The debug mode reveals that The second time, the file is lost.
I bypassed the problem like that :
public void fileUploadListener(UploadEvent event) {
if(!event.getUploadItem().getFileName().equalsIgnoreCase("")){
//code here
}
}
First make your bean session scope then in web.xml change boolean attribute of createTempFiles to false instead of true just as below:
<init-param>
<param-name>createTempFiles</param-name>
<param-value>false</param-value>
</init-param>
"Error 500: com.ocpsoft.pretty.PrettyFilter incompatible with javax.servlet.Filter"
JSF2.1.2
Prettyfaces-jsf2-3.3.2
Primefaces 3.2
WebSphere Application Server 7.0.0.9
Tried with adding custom properties in WebSphere admin console for filter compatibility(Last in FAQ at http://ocpsoft.org/prettyfaces/).
Tomcat 6.0.32 don't have any issues but once deployed the app in WAS got the issue.
Below is webxml
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
<param-value>3</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfLogicalViews</param-name>
<param-value>10</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:WEB-INF/Controller-servlet.xml</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<description>JSF Injection provider</description>
<param-name>com.sun.faces.injectionProvider</param-name>
<param-value>net.devgrok.jsf.Tomcat6GuiceInjectionProvider</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>cupertino</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>
<param-value>abc.xhtml</param-value>
</context-param>
<!-- JSF Required Context Params END-->
<!-- JSF Required Filters & Listeners START-->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>1048576000</param-value><!--51200-->
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>/temp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<!-- JSF Required Filters & Listeners END-->
<!-- JSF Required Servlets START -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
Changed war class loader order to "parent last" and policy to "Single class loader for application" in WebSphere admin console to pick apps own JSF version.
Removed the redundant jars (servlet-api.jar and xml-apis-1.0.b2.jar are in my case) from WEB-INF/Lib folder as it collides with server versions.
The above solved this issue. However creating Isolated shared library (https://stackoverflow.com/a/12081307/1341062) would be better option when you have app-specific dependencies that may collide with server versions.