How Upload My .War file in server - java

I new to deploying project n server.How to deploy my war file virtual private server(VPS), and how to extract .
my war file working in my local pc .Any one please tell me the steps to deploying a project

If your server is used Tomcat to deploy your war file,you may follow these steps:
Open your terminal ,and send your war file to you VPS by scp.
Login in you VPS and use w3m to open tomcat management page,you will find Tomcat Manager,just enter.
Then you can select your war file and deploy it to you host.And Tomcat will extract the war file for you and put it in the correct path.

For extracting war file, In netbeans
When you right click your project and select clean and build, then right click again and deploy. .war file will be created inside dist folder of your project.
for detailed explanation check here

Related

How to deploy web app to tomcat without eclipse?

To my knowledge, to deploy my web application to tomcat, I need to move the war file under webapps in tomcat home. And in eclipse, in order to do that I right click on the server and select "Add and Remove", then add the projects to deploy them when ran.
Without eclipse, I have to make the war file myself by using jar -cf projectname.war * but I don't at which directory should I use this command. Also, should I compile all the sources in the src folder first?
To sum up my question, what is the step to run my web app on tomcat without using eclipse? I want to know what eclipse have done for me under the hood.
Thanks in advance!

WAR file can't be deployed on Tomcat 7 without wtpwebapps folder

I am facing a problem by deploying a War file on a Tomcat Server.
My Tomcat Server configuration as follows:
My steps to deploy:
I created a WAR file in Eclipse Kepler (Windows 7 64 bit, no Maven used).
Uploaded it with a Tomcat Web Application Manager.
Clicked deploy.
Tomcat unpacks WAR file in tomcat/webapps and throws me NullPointerException. It is missing some files that should be imported to project to work it right.
When I was working in Eclipse, as a source for these files I gave a workspace path, given in the Server settings and adding the wtpwebapps folder, which was offered by Eclipse by default. So my complete path looks like this:
C:\Users\myUserName\kepler\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myProjectName\WEB-INF\classes\project\fdsProject\FDS.prj
Now, when I deploy the project, it locates in a webapps folder, not in wtpwebapps and if I try to start in a browser, it shows me NullPointerException. But as soon as I copy the wtpwebapps folder from my workspace to the tomcat installation folder, near webapps, my project is starting successfully.
It means that I cannot start my project on another server, just deploying a standalone WAR file. I must add manually the wtpwebapps with my project in into the tomcat server installation folder. How can I optimize it and start project just with a WAR file deployed?
Thank you!
EDIT
My project structure is looking like this:
Stop the Tomcat Server
In the settings view Tomcat Server settings in Eclipse -> Server
Locations, check Use Tomcat Installation(...)
Now, you can change the Deploy Path, if you want webapps, then input it.
EDIT
The values below control how tomcat deal with war file
autoDeploy="true"
unpackWARs="true"
Just search these values in your server.xml file and edit values as you need.
If you want to be able to deploy your app as a WAR file, you need to refer to everything within it relative to the app itself, not with absolute file paths, not even as file paths if you can. If you have code that requires a java.io.File, rewrite it. The point is that you don't care where things are, you just care about how to get to their contents. For a Servlet, you can read anything on the web app's classpath by calling getResourceAsStream() on the correct class or classloader.
See getResourceAsStream() vs FileInputStream .

How to deploy Java/Spring application on my own system in Apache tomcat server.?

Hello all master minds,
I have created a java spring application in eclipse with mysql db.
Now I can run this application using >Run on server in eclipse,but I want to know how to deploy this application on my own laptop(windows 7).
I have already configured server,by localhost://8080 I can see Apache tomcat is configured.
Give me simple steps so that i can just run that software using browser via its link like
http://localhost:8080/PMS
PMS is my project name.
Thanks in advance.
You can install tomcat-manager in order to deploy your war using a web interface: Tomcat 7 manager
Another option is to copy your war file into tomcat webapps folder. Your container will auto deploy your war: http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html#Deployment_With_Tomcat.
The easiest way, since you are using eclipse is to just export your project as war and then put that war (naming it PMS) in webapps directory in your tomcat.
Once started, Tomcat will deploy that war on http://localhost:8080/PMS
You have to do the following steps:
Right click on project>> Export (Export as WAR file).
or if you are using a maven project then you can give a maven build.
Copy that WAR file, (you will get that war file inside the project folder in your workspace) to the tomcat_Installed_Folder/ webapps
Inorder to deploy the app from outside eclipse,
goto tomcat_Installed_Folder/bin
and double click on startup.bat
then you could see a console.
For detailed logs of deployment, goto tomcat_Installed_Folder/logs
ALL THE BEST :)

Deploying GWT RPC app in Tomcat

As per the Google tutorial, I have developed the basic StockWatcher application, that makes an RPC call to the server, which sends some data, which is displayed on the client.
I now want to deploy it in Tomcat, such that if call something like localhost/StockWatcher, I should get the same experience as when running the app from GWT in development mode.
How do I do this? There is a similar topic here, but I couldn't much understand it. If I only copy the compiled war folder, what happens to the GreetingServiceImpl class which handles the RPC? And how do I do the mapping such that localhost/StockWatcher maps to localhost:8080 (something like Mod_Rewrite)?
Steps to deploy war on TOMCAT
1)Compile you gwt web application
2)Copy the war file
3)Add all libraries(jar files) in lib folder of war file
4)Rename your war as "myapp"
5)create a .war file with that "myapp" folder
6)start tomcat with catalina.bat run.
For step5 (generating .war file ):Preparing .war file from command line
Normally if you deploy well your war directory and you are able to start tomcat you have done everything. If you access your page using this url : localhost:8080/StockWatcher gwt will know that it must use that url as a baseURL for all gwt/rpc requests.
To generate the war using Eclipse : right click on the project -> export -> war. You will have the war exported with all the dependencies inside. just unzip it in the ROOT directory

Jsp Project not running

I have created a web project which includes .jsp and Java beans pages. When I run this project with eclipse, using tomcat it works perfectly fine, I deployed the project successfully, the program runs and I receive a web page in the browser.
But when I try to deploy war file in webapps folder of tomcat6 and run on browser it gives error –
This is the error I see on the page:
HTTP status 404. Description: the requested resource is not available.
What might be the problem?
Check if you have file index.html/index.jsp in your war if it is not there then you have to either need to change the name of file that is opened in context "/" or you have to make changes in list.
To create WAR file using eclipse, follow the option File -> export -> Web > War File and finally select project and destination folder. To deploy war file in Tomcat, place the war file in Tomcat Installation Directory > webapps directory and start the Tomcat.
Hope this is useful for you !!

Categories