aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Deploy servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Deploy servlet" Watch "Deploy servlet" New topic
Author

Deploy servlet

Popescu Gabi
Greenhorn

Joined: Nov 01, 2011
Posts: 7
Hi,
I'll start by saying that i'm pretty new to servlets.
I just finished my first servlet, using netbeans. But how can i deploy it now? If i right click on the project and press deploy, from what i see it just creates a .war file, but i don't know how to use it. I mean, i don't want to start netbeans in order to use the servlet, i want something like double click and the servlet is online. I use Apache, if it's relevant.
Can you help me, please? Sorry for my beginner question.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

You can copy the generated war file into the your server. [=


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Welcome to Ranch,

As you figure out yourself that this is beginner question, then I suggest to use search utility within the forum
as same type of question have been discussed many times here.

and No Need To Say Sorry.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Apache is a web server, but what you need is a servlet container - Tomcat is a popular choice.
Popescu Gabi
Greenhorn

Joined: Nov 01, 2011
Posts: 7
Thank you for your answers, i installed Tomcat 7, i copied the war file to the webapps folder and tomcat extracted the war file. But now i try to access the servlet, it should be on http://localhost:8084/ (that's how it is using Netbeans), but Mozilla says unable to connect (i tried with IE and Opera and it's the same). If i run it inside Netbeans, it works. If i access http://localhost:8080, it finds Tomcat, so Tomcat should be working properly. Am i doing something wrong?
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Am i doing something wrong?


You are just hitting the browser with wrong port. you are accessing your server with 8084, while its running over 8080.
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Popescu Gabi wrote:http://localhost:8084/



The URL for servlet is wrong, it should look like this: http://localhost:8084/WebApp/MyServlet

You have to specify your web application name after port number, then slash, then your serlvet name.
Popescu Gabi
Greenhorn

Joined: Nov 01, 2011
Posts: 7
Again, thanks for the answers.
I accessed:
http://localhost:8080/ServletApp/
The application starts, but when it needs to open another page (it should be called
http://localhost:8080/servlet/TableView
it says
HTTP Status 404 - /servlet/TableView
The requested resource (/servlet/TableView) is not available.
I found on the web that it should be because the web.xml is not configured well, but considering it works with netbeans, i'm not sure.
My web.xml looks like this:

Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Put your app name before the URL.

http://localhost:8080/YOU_APP/servlet/TableView
Popescu Gabi
Greenhorn

Joined: Nov 01, 2011
Posts: 7
My application was called WebApp and initially it didn't start a servlet, it was starting a simple html page, that's why the url looked like that. After some thinking, i realised the problem was with my forms, with the action attribute, it didn't contained the name of the app. Now i modified it, i'm sure it will work but for the moment i have some difficulties with the cache of the browser, i think, because i modified the code, but when i run the app the source looks the same. Anyway, i'm sure i'll be able to solve this on my own.
Thank you again for all your help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deploy servlet