Grails controller actions throws 404 error - grails

I'm using Intellij Idea IDE to build Grails 3 web apps, whenever I do Rebuild project the actions in controllers starts throwing 404 errors, I checked the URL Mapping and found no issues with it, in order to make these actions work again I need to open controllers and do some changes and then click on "Make", can anyone suggest a solution for this?

Related

Grails 3 scaffolding error when running Application class

I created a trivial Grails 3.0.1 application and loaded it into IntelliJ IDEA by importing the build.gradle file. The recommended way to run the app through IDEA is to execute the Application.groovy class in the init folder.
Doing that started the app, and I was able to browse to the "Welcome to Grails" page, but when I tried to access any of the controllers I get:
This page contains the following errors:
error on line 7 at column 12: Opening and ending tag mismatch: meta line 0 and head
Below is a rendering of the page up to the first error.
default.list.label
in the browser. I have two domain classes and generated the controllers and views using generate-all.
I think something is failing in the <gsp> tags, but I don't know what.
If I start the application using grails run-app, the views work properly, so this is specifically an issue with Application.groovy.

Application_Start not firing in ASP.NET MVC app

I've got an ASP.NET MVC app where the Application_Start event appears to not be firing. The symptoms are that an NLog log statement in that handler does not generate a log entry, and none of my routes get populated (so all my requests for controller actions return a 404).
Static files on the server (eg, favicon.ico) are served correctly.
I have log statements in Application_BeginRequest and Application_EndRequest. Those do generate log entries, both for the controller methods and the static files, so I feel pretty confident the app pool is configured correctly.
The problem shows up on our staging server, but not my local machine or our dev server.
Any idea what would cause this?
It ended up being a combination of things. The root cause was inconsistent versions of DLL's, and I solved that by configuring the project to copy the problem assemblies to my bin folder. On top of that, there was some code in Application_Error that was preventing the actual exception from being shown.

"Incorrect link" in episerver 7 when doing project as MVC

I've just created a new EpiServer 7 MVC project and created my first pagetype and page, the start page. In admin mode I can see the start page and if I single step in the start page controller I can see that "currentPage" has values.
BUT if I go to the page in the normal mode (not in edit in admin) I just get the "Incorrect link". If I single step I also see that "currentPage" is null in the controller. I thinks it's weird that EpiServer succeds in calling the right controller and action and then not being able to render it (it finds the view as well). I have no clue what's going on. I can't see any differences from how I've set up previous sites that works.
The exception is
Exception details:
HttpException: Not Found
Http status:
404 NotFound
If I create a project with webforms (no MVC) it works but it is when I merge a MVC project into the EPI-project this happens.
I have no clue what's wrong so thank you for answers!
I just had this problem with a new mvc site. After bending my brain for a couple of hours I found that although I had created a start page, I hadn't published it. After publishing the problem disappeared. Oh my...

missing controller in .net mvc with elmah emailing me...driving me crazy

elmah is emailing me exceptions for missing controllers like so:
System.Web.HttpException: The controller for path
'/Scripts/modernizr-2.0.6-development-only.js' was not found or does
not implement IController.
I added some ignore routes to try and let the app know that scripts isn't a controller and to ignore all .js and .css files like so:
routes.IgnoreRoute("scripts/*");
routes.IgnoreRoute("*.js|css");
It's still emailing me the exception. at this point I want to just suppress the error because every single time I hit a page on the app, it triggers this email.
any suggestions to cure this?
Check that the script it is looking for actually exists in the site. I have had problems like this reported in Elmah, and as I remember, it was after a js library had been updated by NuGet, but the references in the views had not.
Hope that helps.

Grails - Plugin view pages issue

I have a plugin with domain, controller and view pages. (Using grails 1.3.6)
I run the plugin as standalone, the views work fine. URL: http://localhost:8080/sample-plugin/gp/list. I am able to view the list page.
I installed the plugin into a main application i.e. plugin-test. Start as run-app within STS and browse to http://localhost:8080/plugin-test/gp/list. I am able to view the list page.
I bundle the application as war i.e. plugin-test.war and deploy to tomcat. When I browse to http://localhost:8181/plugin-test/gp/list I get a 404 error! I am not sure what I am doing wrong.
I have been trying to resolve it for quite sometime now and still no luck. The same main application works fine in STS but not in tomcat.
HTTP Status 404 - /plugin-test/WEB-INF/grails-app/views/gp/list.jsp
type Status report
message /plugin-test/WEB-INF/grails-app/views/gp/list.jsp
description The requested resource (/plugin-test/WEB-INF/grails-app/views/gp/list.jsp) is not available.
Please help.
Thank you.
Jay Chandran.
This sounds worryingly familiar, as I spent a while figuring out this (or a very similar) issue. I ended up raising this Grails bug report:
Plugin layout not found in war when installed from BuildConfig.groovy
Have you installed the plugin as using the new BuidConfig dependency technique? The JIRA documents my workaround.
Sharing some of my lessons learned after experiencing the same exact issue (1.3.7):
Double check your HTML source to make sure that your template really isn't being included. Mine was being included, but my CSS/image URLs were wrong (only while running as a war)...so I wrongly assumed that my template wasn't there.
Don't use the ui performance tags for referencing your static content...doesn't appear to work, even if the plugin attribute is specified.
Don't name your layout main.gsp. You're guaranteed to have conflicts.
Don't use absolute=true on your g:resource tags. This doesn't appear to append the pluginContextPath to the absolute url, even if you specify dir="${pluginContextPath}"
Don't use pluginContextPath, as it's no longer required: http://grails.org/doc/latest/guide/single.html#6.3%20Tag%20Libraries (search "Plugin Paths")
In your g:resource tags in your plugin layout, make sure you specify the plugin attribute. Set it to the name of your plugin.
Move your static images/css from your plugin to a web server. If each application using your plugin has its own copy, your users aren't going to benefit from caching when bouncing between apps.
Note that all of the above applies to the layout gsp in your plugin project, not your consuming application.

Resources