css not working jsf app on glassfish (bootsfaces primefaces) behind apache - css

I'm trying to build a JSF app on a glassfish 4.1 server. I have a apache 2.4 in front of glassfish as a proxy server. The app is using the bootsfaces or the primefaces frameworks. The same happens to both of them.
What's my problem. When I run the app within my network, directly from the glassfish, everything are ok. It is also looking good when I run the app from web bypassing the apache proxy. But when I run it be calling it via apache, the css are not working.
I have a look at the page source code and I found this: On the head part of my page, I have the
<link type="text/css" rel="stylesheet" href="/gk-1.0-SNAPSHOT/faces/javax.faces.resource/theme.css?ln=primefaces-aristo" />
link.
When I click on the href from the "glassfish" page, I can view the css contents.
But when I click on the href from the "apache" page, I got an 404 error page:
<h1>HTTP Status 404 - Not Found</h1><hr/><p><b>type</b> Status report</p><p><b>message</b>Not Found</p><p><b>description</b>The requested resource is not available.</p>
Both the jars are included to my war file.
Any help will be valueable
Thank you

Just for the record (because I believe questions should have an answer): as it turned out, the problem was a configuration error in an apache configuration file. It doesn't have anything to do with JSF, BootsFaces, or JavaEE. Also see the comments below the question.

Related

Flex deploy on tomcat, when open in browser, it is blue blank

My project including A.swf and B.swf, A.swf embed in a html file, A.swf will load B.swf after initialed. The project test ok.
Now I deploy it on tomcat. Open the url http://*:8080/myproject in browser, the screen is blue blank, it seems B.swf is not loaded.
I try some methods: add crossdomain.xml, and trustPlayerFile, also i use apache http server as a proxy. But the problem is not solved.
Can someone help me?
Try to add your tomcat catalog to Global Security Settings panel

MVC CSS not rendering in Visual Studio When debugging

I have an issue where the CSS is not rendering properly when I compile the MVC project and view it on [https://localhost/MyApp.] The buttons, and background image are not showing up. It worked one time, then for some reason it stop working. Something with the pages not caching? I used firebug to check to see if the pages were missing, and no errors were found. Something in Visual Studio 2010 settings need changing or IIS?
However, when I publish it to an individual website, instead of in the (default web site) area, using [https://localhost:444] website I setup in IIS 7.5, the css seem to render fine.
What is the problem?
One common problem that occurs on MVC 4 websites is difference between release and debug when you have css bundles. It does not have to be your case, but you have the symptoms.
I will explain on an example.
If you have bundle which looks like this:
var styles = new StyleBundle("~/Content/css").Include(
"~/Content/toastr.css",
"~/Content/flags/stylesheets/flags16.css",
"~/Content/flags/stylesheets/flags32.css",
"~/Content/Site.css")
And in flags16.css you have:
background:url('flags/images/flags16.png');
Which uses file in ~Content/flags/images/flags16.png
That will work in release mode (compilation debug="false" in web.config), because all of your css files in bundle will be served as 1 file located at ~/Content/css with relative path 'flags/images/flags16.png' pointing at correct file.
However, in debug mode, ASP.NET MVC will disable minification, and if you used #Styles.Render("~/Content/css") inside your view, it will render link to every one of your files contained in a bundle, so there will be a:
<link href="/WorkOrders.Web/Content/flags/stylesheets/flags16.css" rel="stylesheet">
And from that path, relative path to image is not ok, so images in flags16.png will not be rendered.
One way to solve this, you need to move your .css file which contains references to images to the location where bundle is pointing (~/Content in this case), so it will have same path when it is served minified and raw.
UPDATE As your app is not mvc4, and you have problems when your app is not in the root of your web site (i.e. when it is in localhost/myapp) then you need to check paths in references to your pictures. It is possible that you referenced them absolutely ('/somepath/mypic.png'), and when your app is in localhost/MyApp, path needs to be localhost/MyApp/somepath/mypic.png. You can solve that by replacing path with #Url.Content(~/somepath/mypic.png), if you are using it from cshtml. If path is in css, then you need to put relative path to your pictures.
I have just been battling with the same problem - images, scripts and css not being found or rendered. (Visual Studio 2013, Windows 8.1. Project moved across from Visual Studio 2010.)
The problem was caused by a line in Web.config:
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
It seems that because the IIS Express application.host file already contained this mimeMap definition, IIS Express couldn't cope with it being defined again.
Removing this line from Web.config completely solved the problem.
It looks like your web site is configured to use SSL. Except that when running locally you probably do not have a valid SSL certificate which is trusted by a certification authority and the client browser is refusing to download the static resources. One way to fix that is to add the address as trusted. So copy paste the url to some of your CSS files in your browser address bar:
https://localhost/MyApp/Content/Main.css
and you will see a warning about the invalid certificate that you could ignore by adding an exception to your browser. Hit Ctrl+F5 to force a refresh once the exception is added and your application should start working properly.
When I had this problem I found that all of my CSS and Script files were encountering a HTTP 500 error when they were being downloaded in the browser (Firefox 33.0.2).
Killing the instance of my browser in the Task Manager and then starting afresh fixed the issue for me.

Controller factory receiving request for "favicon.ico"

I've noticed that a request to "favicon.ico" is being passed to my ASP .NET MVC controller factory when using Google Chrome and the Visual Studio Development Server. The controllerType parameter has a value of null which is unsurprisingly resulting in an unhandled exception, which I only know about because of an error log.
Any ideas where the request is coming from and why ASP .NET is letting it get to the controller factory? CSS files and images for example are being correctly filtered out.
With IIS7 in integrated mode all requests are tunneled to the pipe. you can add it to your ignore routes
asp.net mvc does it handle all requests? - iis 7 integrated mode
Another resource
http://weblogs.asp.net/gunnarpeipman/archive/2009/02/26/asp-net-mvc-ignore-requests-to-favicon-ico.aspx
Bear in mind to you only seeing this as you are in debug mode. Your users wont see it (Not optimal still, but hey I didn't design it)
I have also noticed this occuring with chrome. I believe it is the browser looking for the site favicon (little icon next to its tab) with the default path of /favicon.ico. MVC trys to find a controller matching that route and comes up blank.
Easiest fix is probably just to add favicon image in your root directory called favicon.ico or using a link tag in the head section of your html to point it somewhere else.
eg
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />

ASP.NET MVC in Subfolder/Virtual Directory/Routing/Domain issue

I posted the following question yesterday but didn't get a helpful answer.
May i was not clear enough, i am very sorry.
After hours of searching here and googling with Bing i could not solve
the following
Problem. It does not should a "heavy" Problem.
here is my problem
I have a Domain like http://example.com that is pointed to a
virtual directory on my webspace like
http://myprovider.com/VirtualDirectoryName/.
The folder structure on my webspace is (off course) like this
root
bin
VirtualDirectoryName
bin
Content
Scripts
Views
Web.config
Global.asax
If i call now "http://www.domain.com" i get the Site without CSS and the
links
are "http://www.domain.com/VirtualDirectoryName/".
I used the default and almost empty default "Internet Application". So
the routing
is default and all links are created with #Html.ActionLink.
Please help me, i tried so many things but i cant get it working. In my
local environment i can affect that with IIS settings but (off course) i
do not have access on the IIS settings of my host.
btw, my hosting provider provider is discount ASP.NET.
Thank you all!
How are you referencing the css files in your html?
If your referencing the like:
<link href="../../Content/Style.css" rel="stylesheet" type=\"text/css\" />
It might not be looking in the correct directory. Try the referencing it as the following:
<link href="/Content/Style.css" rel="stylesheet" type=\"text/css\" />
That way you reference it from the root.
A good way to check is to use the "net" tab within firebug this will show if they are loading and if not what location it is trying to find them.
Link your css and javascript this way (using ResolveClientUrl):
<link href="<%=ResolveClientUrl("/Content/style.css")%>" rel="stylesheet" type="text/css" />
The problem was a simple routing error. My Application was only a simple folder in the iis and not a virtual directory / application. After setting the folder to an application the problem is gone.
I think you can solve it using web.config at the root as suggested here How to host ASP.NET MVC site in a subfolder

CSSFriendly issue just after publishing to web server

I created a website and used css friendly adapters for Menu, TreeView and GridView, all was correct, but after publishing it to my great web server, the menus and treeviews didn't load and there is just some bullets!
Here is my work: http://jds.cot.ir (dead link)
Left side I have a menu which did not load.
Did you copy over the App_Browsers folder? I'd check you copied all files over and, if you can, restart the application pool (touching web.config should achieve this).
I found the problem and the solution, I have an error loading one css file:
<link href="/WebResource.axd?d=FmPs0x8PbK0cHdhnI4N-J7cB33HdEr5UOoA_QzdIwqZdeINM8Kod5dxru5SzZMkL0&t=633820044382031250" type="text/css" rel="stylesheet" />
and the content of this css was an error titled:
Specified argument was out of the range of valid values. Parameter name: utcDate
I changed my pc date to one month ago and rebuilt my solution, and upload it again.
And every thing is correct. ;)
Try deleting precompiled.config from the root of the web app on the server. That did it for me. Haven't really looked into what the pros and cons are. Looks like the publisher's precompilation doesn't take into account the control adapters for some reason. I just ran into this in VS2010 beta 2.

Resources