icefaces 3 - Cannot reach the backing bean from pages inside WEB-INF - jsf-2

I upgraded icefaces version from 1.8 to 3 and I'm facing the following problem:
everytime I call a method in a backing bean form pages inside WEB-INF, I have the error "Network connection interrupted" and, in firefox I see when I hover the button, POST mypage.jsf , STATUS 404 Not Found.
Can anybody help me, please?
If I move the pages outside WEB-INF it works, but I wouldn't change all the structure of my project...
Thank you very much

I suggest you to move pages outside WEB-INF. This directory has a specific meaning in web application deployment. It holds configuration and (e.g.) classes used by servlet.
Web container should not serve the content of this directory, if in 1.8 this happen, probably it's a bug that has been fixed.

Related

IIS caching "The layout page could not be found at the following path" error

The Problem
I have a website running in IIS. If I rename or delete one of the layout page .cshtml files under /Views/ the site immediately begins throwing following yellow screen error as expected
The layout page "_Layout.cshtml" could not be found at the following path: "~/Views/_Layout.cshtml".
What surprises me is that if I recreate or rename the file so it is exactly like it was before, the yellow screen persists. Why is this particular 500 error sticky?
I currently think that this has something to do with IIS and is specifically related to error handling. The site immediately detects that the layout page file is missing. It does not immediately realize when the file is back in place.
Thanks!
Some interesting clues
This happens on all of my sites I've tried this on so far. It isn't related to a specific site
I tried this on two websites at the same time. On one site I repeatedly and consistently refreshed the page hoping for a success. On the other, I left it alone for several minutes before checking again. The site I leave alone will resolve its problems and find the layout page on disk again. The site I continually make requests to appears to display the error indefinitely.
What I've tried
I have reproduced the problem on Umbraco websites using Umbraco's default routing as well as regular MVC pages using custom routing. The problem is the same for both.
I don't have output caching configured in IIS
When I am reproducing the yellow screen error, I am able to reproduce the error in multiple browsers, so I don't believe it is related to browser caching
I checked on the httpRuntime in the root web.config and the fcnMode is set to fcnMode="Single"
I've fiddled around with the web.config customErrors and httpErrors. Nothing I've done here has affected the problem.
I am able to reproduce the problem on websites where there is no custom code for caching. No CDN. No load balancer.
Versions
IIS: I have reproduced the problem on Windows Server 2012R2 running IIS 8 and Windows 11 running IIS 10
CMS: All of the websites I have tested on so far are Umbraco 7 sites. However, I have reproduced the problem on pages that are routed using Umbraco's out of the box routing as well as pages that are just set up using MVC and aren't leveraging Umbraco.
It appears to be part of the behavior of FcnMode="Single". See https://learn.microsoft.com/en-us/dotnet/api/system.web.configuration.fcnmode?view=netframework-4.8. It isn't an issue with caching. It is a problem with the way that the site's file change notifications (FCN) are configured.
The sticky 500 behavior on renaming files happens when I use FcnMode="Single" but not when I use FcnMode="Default".
FcnMode="Single" will result in only a single object to monitor file changes. This single object is responsible for monitoring changes to files in the main directory and sub directories.
FcnMode="Default" will result in a separate object to monitor file changes for each directory.
Umbraco sites, by default, use FcnMode="Single". This makes sense because Umbraco sites cache under very deeply nested directories in /App_Data/. This can result in so many of these monitors that it can affect the performance of the site. There is a great explanation of FcnMode and why it matters for Umbraco here: https://shazwazza.com/post/all-about-aspnet-file-change-notification-fcn/
Unfortunately, it appears that the single file monitor can miss renames of files in some cases.

Caching: refreshing external content

in a web project using myFaces 2.1.8, I use the following line of code in a composite component in order to include external content (located at the application server, outside of the webapp-folder):
<ui:include src="file:/#{someSingletonBean.externalContentDir}/#{cc.attrs.externalContentFilename}" />
The FACELETS_REFRESH_PERIOD context param is set to 2 hours.
Changes made to the external content files are however not refreshed until the server gets restarted.
Is there a way to populate these changes to myFaces without restarting the server?
There is a bug recently found and fixed in 2.2.4 that cause the problem. See MYFACES-3890 for details.

Springwebflow + CDI + JSF application on Jboss 7

I have been trying to get my application working under JBoss 7 but have finally hit a problem that I cannot find an answer to.
The application is a web based application using springwebflow,cdi,jsf (primefaces).
it gets deployed without an error and renders the first page (login.xhtml). once i'm logged in, if i try to click list of accounts (users's accounts) link (which invokes the webflow for list of Accounts) which display a list of accounts but when the server looks for the resource to use for rendering the view, it fails with FileNotFoundException when attempting to load a resource as below. javax.faces.FacesException: Error Checking Last Modified for jndi:/localhost/datapTest/AccountSelect.xhtml For some reason the default view of the flow (Accountflow) is being converted to a jndi resource location. Can anybody help?
Updated :
after changing the param javax.faces.FACELETS_REFRESH_PERIOD value to 1
exception :
Caused by: javax.faces.FacesException: java.io.FileNotFoundException: Facelet /accountSelect.xhtml not found at: jndi:/default-host/datapTest/accountSelect.xhtml
I was having a similar problem, and i found out that the problem was a conflict with the omnifaces lib. The problem occurs because omnifaces registers a view handler called RestorableViewHandler and this view handler does not know how to solve the id's from the flows files.
To solve that, we need to add the view handler of spring-webflow locally on our faces-config.xml file:
<application>
<view-handler>org.springframework.faces.webflow.FlowViewHandler</view-handler>
</application>
PS: Or you can just remove the omnifaces dependence from your application.

JSF 2 Mojarra and Primefaces in WebSphere 7+

I have been struggling with the unholy alliance that is WebSphere 7+ and Mojarra 2.0.4 and have run into something of a showstopper.
I followed the directions as specified at this forum post and got Mojarra 2.0.4 initializing properly: http://forum.primefaces.org/viewtopic.php?f=3&t=6860
Basically I created an isolated classloader shared library that refers externally to the Mojarra and Primefaces jars, added the shared library to the webapp and reversed the classloader to go PARENT_LAST. All of that works.
When I attempt to access my web app http://server:port/context/index.xhtml it is hitting the FacesServlet correctly but then instantly the Request Dispatcher is redirecting to index.jsp???
I don't have any JSP specified ANYWHERE in my code, my app, my web.xml, and in fact I specified DEFAULT-SUFFIX to be .xhtml and that didn't help. All my web pages are .xhtml extension and FacesServlet is mapped correctly to *.xhtml.
I have tried adding XHTML as a mime type to WebSphere, disabling the Request Dispatcher, all to no avail. I have been able to get this running correctly on Tomcat 6-7, JBoss 6 and Glassfish 3 with no problems but for some reason WebSphere insists on a JSP file extension?
I appreciate any help you might have.
WAS7 sometimes does not undeploy the web applications properly. Clearing WAS_PROFILE_HOME/temp and WAS_PROFILE_HOME/wstemp may help.

MVC application deployed to IIS5 using Wildcard mapping causes 401 and 404 errors on CSS and JS

I've been developing an MVC 2 application under the built in Web-server in VS2010. On Friday, I moved it to a virtual directory under IIS 5 in my WinXP development machine. I had the usual problems, and added a wildcard mapping to the Virtual Directory configuration in IIS to map .* to aspnet_isapi.dll (Framework 4). Neither the check file exists box nor the Script Engine box is checked.
The routing works and brings up the correct page. But none of the css or js files are served. Fiddler shows them getting either 401 (Not Authorized) or 404 (Not Found) errors (with no apparent rhyme or reason to which one - sometimes both). I went back in and added IgnoreRoute statements to the mapping tables for .css and .js, files, but that made no difference. I also added LOCALMACHINE\ASPNET to the security settings on the directory, giving it (for right now) full control permissions (I know that's a security hole, but I'll fix it after I get it running.)
I have not seen this problem referred to in any of the blog posts on getting MVC running on pre-IIS 7 servers. Has anyone else seen it, and how did you solve it?
The simplest and most straightforward way I've found to get the scripts/graphics/css files working is to specifically remove the wildcard mapping to aspnet_isapi for your content directories (graphics, scripts, css), in the same way that you added them for the project directory.
Right click on your scripts folder and select properties, and hit Create. The configuration button will now be available; click it and hit Remove to remove the custom mapping that the folder inherited from it's parent; click okay. Now back in the properties dialog for the folder, click Remove, so it's no longer a virtual directory, and click OK. Repeat for other such folders.
This is because when your app servers url like : www.domain.com/Controller/Param1/Param2/Param3 it will try to get images from www.domain.com/Controller/Param1/Param2/Param3/images. Try to install firebug and see the net section. Good fix to this is use a helper method to add css reference that adds fully qualified path for css reference like: www.mydomain.com/css/my_css.css

Resources