Grails Deploy XAMPP Tomcat - grails

I was about to test my grails application using the XAMPP Tomcat server for checking.
I followed the instruction set here regarding how to deploy the .war file into the web-app folder of the Tomcat.
The project did deploy within the workspace of Tomcat but when I tried to start the project and restarted Tomcat I get this error message:
FAIL - Application at context path /[Project Name] could not be started
I also tried using the command grails> tomcat deploy, I get this error message on the console:
Error Error executing script Tomcat: : java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2F[Project Name] (Use --stacktrace to see the full trace)
My question is what is the proper way of deploying Grails application with the following Tomcat specifications:
Tomcat Version: Apache Tomcat/7.0.21
JVM Version: 1.6.0_31-b05

To create the war file:
grails prod war
Check the target folder for a war with your app name and version.
Then move the file to webapps folder of Tomcat. If Tomcat is configured to auto deploy, you will see the content of your war file extracted inside webapps.
Finally just open localhost:8080/yourapp/

Related

Why I do not get the following message on running grails app "Server running. Browse to http://localhost:8080/qotd"?

I am following the instructions in the chapter 1 in book "Grails in Action, second edition".
What is on my machine?
| Grails Version: 3.2.0
| Groovy Version: 2.4.7
| JVM Version: 1.8.0_101
Are GRAILS_HOME and JAVA_HOME configured?
YES
/home/myName/.sdkman/candidates/grails/current/bin:/home/myName/software/jdk1.8.0_101//bin:/home/myName/bin:/home/myName/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
I follow the below given commands in terminal
grails create-app qotd
cd qotd
grails run-app
The script runs and gives me the following message (message 1)
Grails application running at http://localhost:8080 in environment: development
however the expected message (message 2) after executing the script is;
Server running. Browse to http://localhost:8080/qotd
The message 1 link is active while the message 2 link gives me following message on the server.
Page Not Found
Error: Page Not Found (404)
Path: /qotd
yes, I tried the solution where they ask to add following code in application.yml file
server:
'context-path': '/qotd'
the result of implementing that solution is given below
Grails application running at message 1/qotd in environment: development.
Further I am not able to click on the links created by controllers and the "view/controller_name" folders are empty (No index.gsp files created)
I get "SLF4J" warnings on executing the run-app command, however I do not think it will have anything related to the problem.
try changing the following
server:
'context-path': '/qotd'
to this in your application.yml
server:
contextPath: '/qotd'
Do not add quotes around contextPath.

Can't access JasperReports after deploying Grails WAR to AWS Elastic Beanstalk

I have a Grails 2.4 application that uses JasperReports to produce PDF vouchers. I have everything working fine I run as dev environment on localhost.
I want to deploy to AWS on an Elastic Beanstalk instance but once I have uploaded the WAR and deployed it, everything works fine apart from JasperReport creation. When I click on the PDF icon if waits for some time and then give the error "An error has occurred" and no report is downloaded.
I have researched and found that the web-app/reports directory (this is where my jasper report files are) is not by default included in WAR creation so I have included the following in my BuildConfig.groovy and now the WAR contains the jasper report files correctly.
grails.war.copyToWebApp = { args ->
fileset(dir:"web-app") {
include(name: "js/**")
include(name: "css/**")
include(name: "WEB-INF/**")
include(name: "reports/**")
include(name: "images/**")
}
}
After deploying again it still does not work and it seems that the app cannot access them.
Do I need to include any other files / directories in the WAR file I might be missing?
Is there a change in a config file I need to make to make this work - for example does deploying to a WAR change the directory structure in anyway that might effect a path in config file?
Just to add for clarity - I have compile ":jasper:1.11.0" in my BuildConfig.groovy already.
* UPDATE *
I couldnt find an actual solution to this on Elasticbeanstalk but I have fixed the problem for me by changing to use an EC2 instance of Ubuntu and installing apache, tomcat, java etc myself and deloying there and I know have it working no problems.

Can't get Grails application to run on Windows 7

I'm having trouble running Grails on my PC (running Windows 7).
It's been a couple of years since I last worked with Grails, and I have a new computer. So I downloaded Grails and NetBeans and followed the instructions. (Grails: version 2.3.7, NetBeans: version 7.4.)
Everything seems to be working. Both the Java JDK and Grails work - I can run "grails" from the command prompt. And it was easy to activate the support for Grails in NetBeans.
I created a very simple "Hello world" application. It compiles fine - and I can run "grails war" to create a War file. But I can't get it to run on my PC. I get the same error using "Run" in NetBeans and when running "grails run-app" at the command prompt:
|Running Grails application
Error opening zip file or JAR manifest missing : C:\Program%20Files\Grails
\lib\org.springframework\springloaded\jars\springloaded-1.1.5.RELEASE.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Error |
Forked Grails VM exited with error
And the program won't start. The jar in question isn't missing, so I can't see what's wrong. Any ideas? I'd be more than grateful for some help! :-)
/Anders from Sweden
Move your copy of grails to C:\ and try again.
There is a known problem with location with space symbol. You can see it in stacktrace:
C:\Program%20Files\...

Grails war deployement on WSAS

I generate a war using grails war, but when I deploy it to Websphere I have errors, what features I need to add so I can run my war under WSAS, here are the errors → http://paste.ubuntu.com/6179593/
Note: The web page show me this error → Context Root Not Found
According log there is no problem and application has started successfully.
Check your Virtual Hosts settings.
There is good article about grails application deployment.

how to access grails application on Tomcat

I'm trying to deploy a simple grails application on my test-server which is tomcat. I've built the WAR with grails war command so I've got a war file named: simplgrailsapp-0.1.war
When I deploy this to tomcat I'm getting a lot of errors which I'm going to resolve one-by-one. But the URL for the app from tomcat manager (mytestserver:8080/manager) is http://mytestserver:8080/simplegrailsapp-0.1/ which doesn't seem correct. Because when I run the app locally the url is: localhost:8080/simplegrailsapp
I've also tried to access the app by http://mytestserver:8080/simplegrailsapp but that doesn't work either.
How can I fix this?
By default, when you deploy a WAR to tomcat it will fall under the context of the name of the WAR file. So in your case, the context becomes simplegrailsapp-0.1. You can:
rename your war file to whatever you want the context to be before you deploy it
define a Context for the application in Tomcat
If you go with defining a context this can be added to the WAR file by creating a META-INF folder in the web-app folder of your project and creating the context.xml file there.

Resources