I am trying to deploy my grails application on an openshift server. I have created an instance using command "rhc app create MyApp jbossews-2.0". When I ssh to the server, I see a jboss folder but no tomcat folder. How can I deploy my .war file onto the server?
I think the Docs on how to deploy a binary file will help you with this, however what the docs do not say is that with Tomcat the deployments directory is called webapps but they work the same way (except for the marker files, tomcat does not use those).
You may want to check out https://github.com/gssOpenShiftsupportExamples/JavaSample as it shows an example of how to do this with JBoss (the same thing will work for Tomcat if you change the directory as denoted above).
Related
I have a springboot project with default structure. I have an excel file under resources/data. My program need to load excel file and dump data into different tables from each sheet.
When I run from Eclipse, program loads excel file correctly and everything looks good. However, when I deploy the same App on Docker, it fails to read the File from resources.
Have anyone encountered this issues? How have you solved it?
First of all try to check whether the Docker is a reason, or there is an issue with java code. Spring boot creates an artifact that can be run with just java -jar <your-spring-boot-artifact.jar>
If this doesn't run even without docker, then you should change the way you access Excel files from spring boot application (your java code):
if the file is in resources folder, it should be packaged into the spring boot artifact.
In this case, you have to use getClass().getResourceAsStream() to access the file, and not rely on java.io.File API, because File API doesn't allow working with files inside a Jar, its not a regular filesystem.
My Grails app is based on
Gradle with Grails 2.4.4,
Tomcat plugin 7.0.55,
and MySQL plugin(mysql:mysql-connector-java:5.1.29).
Do I need to install Tomcat on the server?
Do I need to install MySQL on the server?
Both Tomcat and MySQL are not installed on dev environment(on my PC), but it seems working.
Container
While all the other answers pointed out, that you need already a container (which of course is true) there is also the option to use one of the "standalone" plugins (like e.g. https://grails.org/plugin/standalone). This will package your app as a fat jar, where the container and your app are part of a jar, that you simply run by java -jar myapp.jar (of course your would integrate that into your regular startup scripts on the server).
This is in general no bad option, since many WAR-deployed apps don't need any of the full blown container features anyway and you would be able to configure everything in place for your workload and don't have to compromise for all running wars (or your ops team). On the downside, if there is a security problem etc. with the container you would have to roll a new jar.
/With grails 3, which uses Spring Bootstrap, this even is a default option, since the preferred way of deploying. Spring Boot 1.2 supports Tomcat, Jetty, and Undertow by default./
Database
You can use a MySQL from "somewhere" else. But this is nitpicking, since you really need a MySQL somewhere (BTW: you really should start using MySQL also for your dev env, or you will be in for a few surprises once you put your stuff over to production).
Also be aware, that you can also keep using your H2 (see your datasource config) with files. This is an OK option (that saves you from installing a DB server) for small amounts of data you are storing and also there are other free database servers like PostgreSQL.
Obviously you have to install mysql and tomcat on the server.
During development you run grails from console, so you dont need tomcat as it will use embedded tomcat but still you need to have mysql installed, if you want to use mysql.
But on production, you create a war of your app using 'grails war command' and you deploy this war to a web container just like any other war, so you need tomcat and you will need mysql installed too.
In one word answer is 'Yes'.
Fact is when you are in development environment grails uses as an embedded tomcat server provided by the 'Apache Tomcat plugin' which version corresponds to grails version.
You've not installed mysql and you claimed 'it seems working'. That's funny! But it's not mysql who is working without being installed(!), rather it's also an integrated database provided by the 'H2 Database Plugin'.
So, when you'll deploy your grails app in Linux or another server certainly you need a tomcat server to handle user request to that app and a database where your data will be saved.
I have a Grails application which I run on an Amazon EC2 instance. I usually start this application by using Putty from my windows machine to log into it and change to the application's home directory and type 'grails run-app'. This approach works fine when developing but what if I wish to leave the application running for testers? Is there any way I can make it so that the application will continue to run on the Amazon EC2 machine even when I quit my Putty link to it or turn off my windows computer that I use to access the EC2?
You should never use grails run-app for anything other than testing the app locally while developing.
build a .war file using the grails war command
deploy it to Tomcat's webapps directory
start Tomcat (if it's not already running)
I downloaded latest jenkins.war (1.530) and just exploded it locally. When I go to localhost:8080 I get only apache tomcat start page instead of dashboard.
Am I missing something?
Running on OSX 10.8.2 with java Oracle 1.7.0_17
You're missing the context name in the URL, try:
localhost:8080/jenkins
exploded it locally
where exactly ? within tomcats' webapps folder ? If yes, then you have to start tomcat first.
and then visit the url http://localhost:<port>/<extractionFolderName> for e.g. http://localhost:8080/jenkins
I also use Jenkins and I prefer to use the standalone version of it, that's more manageable, and then one can run jenkins on different port, without worrying about tomcat's webapps, context and memory consumption.
http://jenkins-ci.org/content/thank-you-downloading-os-x-installer - here you can find the OS X installer.
I have 2 grails applications packed with --nojars parameter in grails war command. All grails framework libraries are moved to server and they are loader in shared.loader line in tomcat servlet container.
My question is, how can I set different loggers for this different application.
Now log4j = {..} produce the static variable which is shared between two applications.
I'd like to have different logs for each one.
When deploying the war files produced by grails build command without --nojars everithing went well, and each application had its own log file.
Any suggestions ?
I think there should be two different web applications as well. If you do not want the duplicate libraries packaged again, just give them a 'provided' scope and make sure they are available in your instance of Tomcat.