Grails run-app causes error generating web.xml file and bootstrap.groovy not included in war file - maven

I am working on an maven application. When I run it from IntelliJ, it successfully launches my application. But bootstrap.groovy file is not being read. I have created a new username to be added to DB in bootstrap and it should allow me to login to the application using that username for the first time. This is not getting invoked during the start of the program. What settings should I do to include bootstrap.groovy.
The same happens when I create a war file and deploy it in the test server. Bootstrap.grrovy is not read. To create the war file, I use mvn package in command line.
My other question with the same application is that when I do grails run-app, I get the following error: Error generating web.xml file.
What is that I am missing? Please let me know.

Well, I fixed the issue. The web.xml was created when I changed the grails dependent jar. I was using 2.3.4 in my application and my jar was incompatible as I had 2.4.3 version of the jar. Now my program is up and running! Hope this helps someone who is facing the same problem.

Related

Spring boot 2 in a war file and to deploy in a stand alone tomcat, cannot redirect

I'm new in using Spring-boot 2.1.0,
I'm setting up a new Spring-boot 2.1.0 web project with maven, in some reasons my front page is JSP, and I package the project into a war file.
Then I deploy the war file in a stand alone Tomcat 8.0.
I package the war file with the commond mvn clean package -DskipTest=true.
The problem is:
The war package name is marpt.
login page can access by url http://localhost:8096/marpt, but when I login, action redirect failed, it takes out a 404 error.
I have googled many articles, most are base on Spring-boot 1.x.x version;
I tried to exclude embeded-tomcat in POM file;
And also I tried to config server.servlet.context-path=/marpt in the application.properties file, but it's failed to redirect again, and <%#include file="../../pages/share/partial/sidebar.jsp" %> failed too, only can use <jsp:include flush="true" page="/pages/share/partial/sidebar.jsp" />
I have upload the project to github: click here
I hope some guys can help me to fix it out, thanks very much!

Spring Boot Flyway migrations not executed, SQL files are in JAR

I have a Spring Boot application using Flyway Migrations. Everything runs fine, from:
within IntelliJ
from the terminal on my macbook
With 'fine' I mean, migration files are found, which are placed in src/main/resources and end up in the Spring Boot executable jar.
However, when I run the jar from the commandline on Centos 6.8, Flyway is unable to find the migration files.
Any ideas?
Using Java 8.
The easiest way to resolve it is to open at your logger the package org.flywaydb to loglevel DEBUG and retry. For sure you'll find the initial clue.
Good luck

Unable to resolve class on Heroku for Spring Boot app

I created a Spring Boot Groovy app to be deployed on Heroku. I was able to successfully do that, but in running it I came across an error in a Spring Jar (spring-social-facebook-web). I downloaded the code from github, added some logging to a class and rebuilt the module.
Then I commented out the reference to the Jar from the dependencies section and added a reference to my version of the Jar file:
compile fileTree(dir: 'libs', include: '*.jar')
The built app has the new Jar file included in it and it builds fine locally. But when I upload it to Heroku, I get compilation errors that the classes contained in the customized Jar aren't being found - each import is marked as unable to resolve class ... .
Any idea what is going wrong? I've posted a question to Heroku support but haven't heard anything yet.
Thanks in advance.
First time using Heroku and got into the same basic pattern. Unfortunately I didn't store the debug jar I was creating in the git repository. Funny how things start to work when all the pieces are present.

Placeholder in banner.txt are not replaced when deploying war file

I've built a spring boot application and I'm trying to customize the banner to display the version of my application.
After reading the documentation, I've managed to create a banner.txt in the classpath and added the ${application.formatted-version} placeholder inside.
I've also managed to create a manifest file (using Gradle) containing the Implementation-Version.
Everything works fine when executing a jar file directly but when creating a war file, the banner is displayed but the version placeholder is not replaced.
After a bit of debugging, this method seems to be the source of the problem
org.springframework.boot.ResourceBanner.getApplicationVersion()
When running a war file, the call to
sourcePackage.getImplementationVersion() always return null
The manifest file is located at the root of the war file /META-INF/MANIFEST.MF
The application is deployed in a standalone tomcat 8.0.15
Any idea of what's wrong ?
It's a bug/limitation in Tomcat. It fails to find the /META-INF/MANIFEST.MF from an exploded WAR file which causes its ClassLoader to define the package with a null implementation version. This has been fixed in Tomcat, but the fix hasn't made it into a release yet. It'll be in 8.0.25.
There's some more information in this Spring Boot issue and this is the change that was made to Tomcat if you're interested.

grails tomcat 7 deployment

So I have a grails 2.0.4 application that works exactly the way I want. I created the war file and deployed it to Tomcat 7. I'm getting an error saying that the application can't find the jar I'm using to connect to oracle (ojdbc6.jar). The jar is listed under mywebapp/WEB-INF/lib. WHY can't it be found?? Any help would be greatly appreciated!
The jar file should be in the toplevel lib directory of your project (or specified as a dependency in a repository), not webapp/WEB-INF/lib. Is the jar file actually inside the warfile? You can test this by opening the war as a zip file, or by running jar tf target/mywebapp*.war and looking for ojdbc6.jar. If it is, it should get deployed and you should see it in tomcat7/webapps/mywebapp/WEB-INF/lib.
The default environment for grails war is production instead of development. Make sure you've got the production data source configured correctly in grails-app/conf/DataSource.groovy

Resources