Grails internall error with new controller - grails

I just created Intellij grails app,first I opened the console and did : grails create-app helloworld, cd helloworld and I started the app on localhost and everything was ok but then I opened the project with intelliJ and created a controller to print the message "hi" and build the project.
After I closed IntelliJ I went back to the terminal and tried to run the app but it gave me this error:
Error 500: Internal Server Error
URI
/testc/index
Class
javax.servlet.ServletException
Message
Could not resolve view with name '/testc/index' in servlet with name 'grailsDispatcherServlet'

Fairly impossible to answer without some example code, but generating a controller does not magically make the output appear. Your clue is in the "Could not resolve view with name..." I'd suggest a read through the grails docs. No sense repeating all that good information here.

Related

Grails 5 application is not finding GSP files in .war, grails run-app is fine

I have an application that runs perfectly using grails run-app but fails when I try to run is using the embedded server. I use the following commands to build and run the .war.
./gradlew assemble
java -Dgrails.env=dev -jar build/libs/rideshare-services-3.0.war
Below is the error and the steps I've taken to try to determine what the issue is.
The browser shows 500 error page, and the log shows the following:
Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Could not resolve view with name '/index' in servlet with name 'grailsDispatcherServlet'] with root cause
javax.servlet.ServletException: Could not resolve view with name '/index' in servlet with name 'grailsDispatcherServlet'
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1384)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1149)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1088)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
<snip>
However, spring security is enabled, and it renders its form fine with this path:
/login/auth
So I started poking around and assets can be accessed, for example:
/assets/advancedgrails.svg
Also, the built-in actuator paths all work fine:
/actuator/*
I found this question
grails and debugging UrlMappings which seemed like it could help.
To test if the URL mapping were working I added a /test route in UrlMappings.groovy, mapped to a controller named 'member' and the 'index' action.
I also added the logging as suggested:
<logger name="org.grails.web.mapping" level="ALL"/>
It resolved to the correct controller and action, but still failed to load the page, so I added a log statement to the action, and the controller definitely runs, but the view fails to load.
At which point, with the debug statement in the controller, I could confirm that even without the /test URL mapping, the controller fires if I use the standard controller/action URI /member/index. That confirmed that the configuration in UrlMapping.groovy was working.
So, thinking the .gsp files failed to be compiled, I searched and found this:
Grails 3 application works locally, but unable to resolve view when deployed to a remote Tomcat
But I already had the plugins suggested in the answer in my build, so I figured maybe they weren't be added to the .war so I unziped it.
The .war has the gsp files as well as a mapping file WEB-INF/classes/views.properties which included a mapping for the view that corresponds to the controller/action I was using to test (among all of the other mappings in the file):
/WEB-INF/grails-app/views/member/index.gsp=gsp_rideshare_services_memberindex_gsp
I then confirmed the referenced gsp_rideshare_services_memberindex_gsp files exist, and the do with the following being present WEB-INF/classes:
gsp_rideshare_services_memberindex_gsp_html.data
gsp_rideshare_services_memberindex_gsp_linenumbers.data
gsp_rideshare_services_memberindex_gsp.class
gsp_rideshare_services_memberindex_gsp$_run_closure1.class
gsp_rideshare_services_memberindex_gsp$_run_closure1$_closure3.class
gsp_rideshare_services_memberindex_gsp$_run_closure1$_closure3$_closure4.class
gsp_rideshare_services_memberindex_gsp$_run_closure2.class
gsp_rideshare_services_memberindex_gsp$_run_closure2$_closure5.class
gsp_rideshare_services_memberindex_gsp$_run_closure2$_closure6.class
gsp_rideshare_services_memberindex_gsp$_run_closure2$_closure7.class
The compiled .gsp files for all of my views seem to be here, and the source .gsp files are also in WEB-INF/classes, in the same folder structure as the project's grails-app/views directory.
So at this point I'm at a loss to understand why my views (gsp files) are not being found, although built-in views and plugin views are fine.
I will reiterate that the app runs perfectly well when run using 'grails run-app'.

IBMWebsphere gives SRVE0190E: File not found ERROR

I am using docker to deploy and run my application. Everything is fine during deployment and running my application.I am using dockerDeploy and restartWas commends in order to deploy and run my application.
After I run my application , my login and password comes to my screen. Everything is fine at that step as well but after I write my login and password, I come across with the error below. I did not change anything in the code but after I restart docker I come across with the following error.
I restarted docker and also computer several times but I still come across with that. I would be glad if you can help me.
Regards
Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
Original Exception:
Error Message: SRVE0190E: File not found: {0}
Error Code: 404
Target Servlet:
Error Stack:
com.ibm.ws.webcontainer.webapp.WebAppErrorReport: SRVE0190E: File not found: {0}

"Error occurred running Grails CLI: null" when running grails 3.0 command line

I'm trying to run grails list-profiles, but receive the following error:
snowch#snowch-ws2:~/repos$ grails list-profiles --stacktrace
| Error Error occurred running Grails CLI: null (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NullPointerException
at org.grails.cli.profile.git.GitProfileRepository.getAllProfiles(GitProfileRepository.groovy:72)
at org.grails.cli.profile.commands.ListProfilesCommand.handle(ListProfilesCommand.groovy:43)
at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:173)
at org.grails.cli.GrailsCli.main(GrailsCli.groovy:99)
| Error Error occurred running Grails CLI: null
My versions are:
snowch#snowch-ws2:~/repos$ grails --version
| Grails Version: 3.0.1
| Groovy Version: 2.4.3
| JVM Version: 1.7.0_75
This was on a fresh install of grails and gvm.
The command grails create-app myapp works without error.
This question is similar to Grails 3.0 error, nullpointer, however, that question does not state what command is being run.
After searching online, I found that I needed to set my GRAILS_OPTS environment variable as follows before running the command:
export GRAILS_OPTS="-XX:-UseSplitVerifier -Xverify:none"
Source of fix: https://grails.org/news/1292028
I have not figured out, what is the exact cause of the error, but it seems to occur if you try to run grails 3 in the system where grails 2 is also installed.
What I did to get the command run - I created the project in a new directory. The directory for my old grails app was:
/home/me/projects/oldgrailsapp
when I tried to execute the grails command in /home/me/projects it failed, but when I tried this in another directory /home/me/projects_new, it succeeded. So I guess that the problem was that old grails configuration was somehow interfering with the new one.
I also removed references to old grails and groovy versions from the PATH variable by editing .bashrc file in my home directory (I really do not know if it was needed).
I had same experience when I was working on "Building an Andoird Client" guide, I got the following message whenever I try to create an app in the same folder where I've created the first app grails-app :
| Error Error occurred running Grails CLI: null (Use --stacktrace to see the ful
l trace)
So obviously, when you create a grails app in folder containing "grails-app" directory, grails will consider this folder as full grails application, hence cannot create-app in that directory.
I used:
Grails 3.1.15
Java 1.8.0.101
Hope this help.
It worked for me now.
this was my setting
GRAILS_HOME=C:\Users\murali.solayappan\apps\grails-3.1.11
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102
I received the same error while launching "grails" for the first time
**Error occurred running Grails CLI: connect timed out**
After reading GRAILS_HOME\bin\grails.bat i found that executing "grails" while in GRAILS_HOME dir makes some difference. So I did the same
Now i received error stating that GRAILS couldn't find a particular maven package from my mirror repository - printed my private nexus repository url. I know that's my private repo and not connected to internet.
so I changed the MY_HOME_DIR.m2\"settings.xml" with the one came by default in Maven.
After that executed "grails" while in %GRAILS_HOME% dir.
It worked like breeze !!! I got grails prompt.
C:\Users\murali.solayappan\apps>grails
| Enter a command name to run. Use TAB for completion:
grails> exit
Somethimes it happens when you have wrong version of grails installed for the project you want to run it on
try to run it somewhere else and see if you get the same error
i had the same issue because i was using Grails 1.3.5 witj Java 8 which are incompatibles. I changed with Java 7 and it works fine.

Grails: Strange IOException that occurs rarely when trying to issue the run-app target

Every once in a while I have seen this error when issuing the grails run-app target:
| Error Error executing script RunApp: : IOException in C:\Users\user\Dropbox\Code\Projects\qotd\target\work\web.xml.tmp - java.io.FileNotFoundException:C:\Users\user
\Dropbox\Code\Projects\qotd\target\work\web.xml.tmp (Access is denied) (Use --sta
cktrace to see the full trace)
and so far it appears I can always get around it by issuing grails run-app again. If possible I would like to know what is the mechanism causing this error and why does it seem to disappear/correct by itself. Thanks.
Edit: Is it possible that this error is generated because since I keep my project in my Dropbox folder, I may sometimes invoke the grails run-app target while something in Dropbox is still syncing?

new grails project won't start

I'm trying to get my feet wet with grails, so I'm following a tutorial to get going with a sample project. I downloaded grails 2.3.2, added the environment variables for the command prompt commands, and successfully created a project by using >grails create-app teamwork. Calling >grails run-app after changing to the project directory successfully downloads all requisites, but then I get . I know that this exception doesn't reveal much, but do you guys have any ideas on why? I am running command prompt in admin mode, if that means anything.
Try not forking the JVM in BuildConfig.groovy, if I recall correctly. If that works, then check the JIRA issues for Grails 2.3.2.

Resources