Deploy JSF-Maven application from Eclipse directly to tomcat - jsf

Well, i have doubts about best practice to do a deploy correctly. So, lets go.
I have a project JSF with Maven in my local machine in ECLIPSE IDE. In other side (my server online) i have a Tomcat Server (version 6) + SVN Server working normally. The communication from my Eclipse with SVN Repository works fine. My doubt is about putting WAR file from my eclipse workspace to tomcat webapp folder, so i have some solutions to do this:
A) This is the most simple form but i don't know if this correct (best practice): Make a Maven Build (in ECLIPSE) and i'll have a WAR file. Copy the WAR file manually to tomcat webapp folder.
B) Make a "svn checkout" in my "SERVER ONLINE" (where is locate my svn server) and after i can make "mvn tomcat:deploy" to generate WAR file, and copy to tomcat webapp folder.
C) I think this form is more correct but i don't know how can i do: From my ECLIPSE IDE directly deploy (create WAR file) in TOMCAT Remote Server (webapp remote folder).
D) Open "http://XXX.XXX.XXX.XXX:8080/manager/html" and put manually the WAR file.
Well, this is the first time i'm doing this, and i need know what is the most used form.

I and heard most people deploy by A C D way.
You can do it manually without Eclipse see here

Related

Liferay projects building in wrong deploy folder

Working with liferay and portlets from last 3 weeks.
I downloaded the bundled liferay server and placed it on my local drive.
I did the set up and was able to access localhost:8080 properly.
I also created some custom portlets and when build them in eclipse the war files were getting deployed in the path C:/liferay/deploy.
Now, I changed the server location, I wanted to have the server in D:/ drive.
When I did the transition, started the tomcat server from D:/liferay/tomcat/bin/startup.bat
and then build the project, the war files are still building in c:/ drive.
When I copy the war file manually from c:/liferay/deploy to D:/liferay/deploy it gets deployed successfully.
I want the war file to be created directly in the d:/liferay/deploy folder.
Can someone help me understand what all changes do i need to do here?
If you are using Liferay plugin sdk then there would be file named as
build.<userid>.properties
in your plugin sdk.Change the below properties as per new configuration and give a try
app.server.portal.dir
app.server.lib.portal.dir
app.server.lib.global.dir
app.server.deploy.dir
auto.deploy.dir

Excluding jar files from GWTP war file

Currently I am working on a GWTP application. While deploying to application server I remove all the jar files from the application.war file and then I push the war to webapps. I have put all the jars in the application server lib directory. The application works fine. I just have to know, can we remove all the jars from WEB-INF/lib of war file. Is this approach right? please let me know.
And also I have another question. I manually remove the jar files from the created war file which got created using ant. Please give me examples to automatically remove jars from build.xml.
I see only disadvantages from this approach:
If you want to run another application on your server which use an other version of a library, you can't.
Each time you update a jar in you dev environment, you will need to manually copy it to your server lib/ directory instead of having it automatically packaged.
Why having them in WEB-INF/lib bothers you?

How to deploy a data file on tomcat web server in linux debian OS

I have a web application developed using JSP and Servlet. This web application is deployed on server having Debian Linux as OS and The Tomcat version is 5.5.31. As this applications required some data files, These data files will be get created automatically when setting are done using a standalone java application. This application is deployed on another machine. This setup is done. As I dont know much about Debian Linux and where my application is goes on it so I have some doubts in deployment of these autimatically generated data files which are as follows
As I made the .war file of my web application and deployed it using Tomcat Manager. so I dont know where exactly my application goes. I dont know the exact path. How do I find it?
Is it possible to create FTP for this web application which is deployed on Debian Linux server? I think that if creating FTP is possible then I will directly connect to FTP using my Stand alone Java program and will easily do the creation of the file and other file and directory manipulation.
If you've deployed a war, the application isn't anywhere on the filesystem as such. Most servers will unpack the war somewhere, but you shouldn’t rely on where that is.
I can think of several options:
getServletContext().getAttribute("javax.servlet.context.tempdir") to get the application's temp directory, then inform you external program of this location and place the file somewhere in there in a know location.
Arrange for a "know location" outside of the application, such as /tmp/somewhere or /var/cache/your-app/somewhere to place such files. (Note: /tmp is usually cleaned on startup of a linux machine)
As for getting the file onto the server from a remote machine: You could get your client to upload the file directly to your webapp (something like Apache HTTPClient will help you there), which means that you could do without the "know location" above. If you want to do this outside of the application though, I'd avoid FTP (due to security). Instead, I'd go with scp (secure copy).
Edit: Reading between the lines a little, you mention "setting" in the data file. If this is a configuration file which is not changed once the app is running, you may find it more convenient to have a "deploy" step on your server which simply takes the settings file and adds it to the war before deploying it. This is easy enough with "ant war" for example. You could then access the file using getClass().getResourceStream(..) or such.

How to deploy a WAR file on Linux machine

I have a Linux Machine. Apache server is running and I need to deploy my project which is a .war file developed on Windows machine.
Can someone give me bit idea how to do that?
if you have FTP or SCP access to the directories where Tomcat is installed, you should be able to simply copy the generated WAR file to the tomcat/webapps directory. Tomcat will automatically deploy the war for you.
When redeploying, I find it safest to delete the original .WAR file in Tomcat, and tomcat will automatically destory the exploded directory for you. When that's done, copy up the .WAR file.
Finally, make sure you copy the .WAR file "all at once". If you have a slow upload, Tomcat will try and deploy the .WAR file even though it has not completely been uploaded yet. This will lead to a partial or unsuccessful deployment. It's best if you upload to a neutral directory (home directory, temp, whichever), and then either rename (using mv) the .WAR into tomcat, or simply copy it there using the local file systems copy command. Much faster than the upload. Safest way is to mv the file from the same filesystem.
All of this assumes you do not have any of the manager or admin ports open for Tomcat, as it provides mechanisms to remotely deploy applications directly.
But, in truth, simply removing the old app and slipping in the new app works simply and well for many applications.

How to deploy a theme.war file in liferay

I have a theme.war file, which I've placed in the server/tomcat/tomcat6/webapps of liferay folder. When I start the tomcat server this war files create a theme folder. Now to deploy it what should i do?
if you deployed from a bundle (and assuming the bundle's base directory is LIFERAY) there should be a LIFERAY/deploy directory next to the LIFERAY/tomcat6 directory. To deploy plugins to the Liferay portal server you should drop the WAR file in this deploy directory, not in the webapps. Plugins include portlet applications, themes, layouts, hooks and extensions.
In addition to what David stated (deploy through the "deploy" folder) you'll have to select your theme for the community, organization or just one page by selecting Manage/Page/Look&Feel when it's deployed to tomcat.
Somehow I had the impression that you expect it to show up immediately.
If you want to deploy directly to tomcat you'll have to build your theme in the plugins-sdk with "ant direct-deploy" - this creates a tomcat-deployable theme.

Resources