Deployment Options Play Framework v1.4 - java

I am trying to deploy a web application to Tomcat v.6.0. I know I need to be able to deploy a single file--the WAR file. The problem is, the command that the Play documentation instructs to run, produces a directory, and not a single file.
The command:
play war myapp -o myapp.war
produces a directory called myapp.war with another directory WEB-INF which contains the directories of application, classes, framework, lib, etc.,
I am trying to deploy this to my private JVM instance of my web server. I have tried compressing the myapp.war directory, uploading that, unpacking it, etc,. but that does not do anything. I get a blank screen when I check my site.
I've heard I can run Play as a stand alone server like I do locally but I have Java and Play installed. My remote host may likely not have this installed on whatever instance is serving up pages from the public_html directory. If I were to put my application directly into the public_html directory, how can I terminal into and issue the "Play run" command to get it started?
This is the first time I've deployed a web application to a web server.

With this command Play produces an exploded .war file, so you don't have to zip/unzip it.
Check what Tomcat documentation says here about the deployment of an exploded .war files.
Also, a blank screen may be the sign of some problems with your application startup, so you have to check Tomcat logfiles like catalina.out or localhost.log to see if there are some exceptions.

Related

Can't get a Java Spring webapp to deploy to Tomcat

I've got a project in Eclipse, with a .war file inside it. I'm using Spring for the project, with the help of Maven too.
I've installed Tomcat 8, but I'm having trouble deploying the webapp to Tomcat. The Tomcat runs without errors and the console output of launching the Tomcat looks like it is successfully deploying it, however when I go to localhost is just displays the generic Tomcat home page saying I have successfully deployed Tomcat.
I've tried changing my server location to use the tomcat installation, I've changed the location in the properties of my server to not be the workspace metadata.
When I add jars to the tomcat, I click on my project, and under it it lists the Spring jar if that is of any relevance.
I don't really know what else to put here at the moment, but I'm at hand to respond immediately to any questions or any more info that you require.
Thanks.
EDIT:
http://localhost:8080, it leads me to this: http://i.imgur.com/82lmpai.png
My tomcat console output is: https://gist.githubusercontent.com/J-Owens/8164b3ec6dbed9986322/raw/6756486aad0092647bbea8f315c42ac5ba9550b1/tomcatconsole
Each war file will have a name associated with it. When you use localhost:8080 as the URL, Tomcat will use the war with name ROOT under tomcat/webapps to display on the browser. By default, Tomcat will have a ROOT war that comes with the tomcat bundle. If you need to open your project, you will need to use localhost:8080/<your-war-name> to open your project's page. Alternatively, you could remove everything under tomcat/webapps and rename your war to ROOT to be able to access your project pages with the localhost:8080.

How to start tomcat server outside netbeans IDE

I have created an application in Java EE, I have learned how to deploy it in the tomcat server using the manager app or by copying the war file to the webapps folder. Now I can start the tomcat server only from the Netbeans IDE.
I want to know how to start the apache tomcat server without using the IDE and run my web application from the war file deployed. If I'm headed in the wrong direction please correct me. I'm asking this to gain knowledge of how to deploy the .war file in another server system without using the IDE only the tomcat server.
The shell scripts located in "CATALINA_HOME/bin" are the most bare-bones way of getting Tomcat up and running. The two scripts capable of starting Tomcat in this directory are named "catalina" and "startup", with extensions that vary by platform.
In your tomcat installation directory, there would be a startup.bat/sh file which will start the server for you. Moreover you can see the conf folder as well if you want to change any configurations. Whatever war you copy to the webapps folder will be automatically deployed

Running website on Tomcat 7.0: Windows 2008 R2

My team and I originally had a server running through Eclipse (Java EE), but wanted to switch it to running on the Tomcat 7.0 service found in Windows 2008 R2. We are completely clueless on what files to put where in the Tomcat folders found in program files. The entire server has gone down and we can't go back to the original setup. Any help is appreciated. All we're asking is where do we put our JSP/ROOT ect folders in the Tomcat program files.
Copying JSP files are not good idea rather you can package your jsp file into an archive file called WAR file. You can export your project from Eclipse IDE as a WAR file.
After creating the WAR file (.war), you need to find out tomcat installation directory and its called tomcat HOME. Now you just need to copy the WAR file into the following folder:
{TOMCAT HOME}/webapps/<project>.war
I'll add to the answer.
If you have folders of running applications from before you can put 'em under
{TOMCAT HOME}/webapps/
war file will un-zip after you start the service.
once the war is un-zipped, you can delete it, but only after you stop the service for the first time after war deployment.

Undeploy web application from tomcat doesn't remove the deployed directory

I am using tomcat manager commands to deploy and undeploy web applications on a tomcat server. The problem is when I try to undeploy a web application, it does remove the .war file from the webapps directory but the exploded directory doesn't get removed (the WEB-INF/lib folder), neither from the List Applications in the tomcat mananger.
I am on Windows and I am using Tomcat 6.0.20.
Note: When I tried to delete the directory manually it gave me an error saying that the file is being used by another program.
I found the solution, just put this in your context.xml file in your_tomcat_home_directory/Config:
<Context antiJARLocking="true" antiResourceLocking="true">
Everything works fine.
Try to stop your Tomcatserver(-service), then you can manually delete the exploded directory, then restart it agian.
I was on Windows using cygwin. Even after shutting down tomcat, I could not delete the web application folder - the command kept on returning "Device or resource busy". I noticed that the java process was still running even after I had shut down tomcat so I decided to kill it, and was able to manually delete the web application folder.

I want to run a bash script when Tomcat deploys my web application from its .war file - is this possible?

(Tomcat version 5.5, in case it matters.)
I have a library in one of my web applications that needs to be configured with a machine-specific license before use. I don't want to put this library in shared/lib because at some point I may want to run multiple web applications with different versions of the library.
Right now the .jar files are stored in WEB-INF/lib. Thus, when I build the .war file and upload it to the server, the .jar file would still be the one bound to my PC. I would like to put a bash script somewhere in the webapp that Tomcat would automatically run when deploying the .war file - this script would then run the configuration script and bind the server's license file to the .jar. Is this possible? Is there a nicer way of doing what I want?
You could create a ServletContextListener to do that in the contextInitialized() method. And from that listener you can run the "configuration script" directly, no other script required.

Categories