aspose file tools*
The moose likes JBoss/WildFly and the fly likes How to deploy a servlet in JBOSS using GEL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to deploy a servlet in JBOSS using GEL?" Watch "How to deploy a servlet in JBOSS using GEL?" New topic
Author

How to deploy a servlet in JBOSS using GEL?

faisal usmani
Ranch Hand

Joined: Jan 14, 2006
Posts: 139
hi ,

I am a newbie in J2EE , can some one explain me how to deploy a servlet in JBOSS 4.0.3 , i have this small servlet to print HELLO WORLD .


thanks in advance

regards

[ April 10, 2006: Message edited by: faisal usmani ]
[ April 12, 2006: Message edited by: faisal usmani ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Moved to the JBoss forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
M Anderson
Greenhorn

Joined: Mar 17, 2006
Posts: 25
Welcome to the wonderful world of J2EE. Everyone was a newbie at one time or another...

You need to create a web application, with your servlet in it, of course.

The easiest way to tell you to do this, without going into all of the details about how to create a web app is to use your IDE, if you have one. For example, using Eclipse Web Tools Project, you can create a Web App project, the create a Servlet. The tool will create all the folders you need, config files (web.xml), etc. Then you need to jar them up into whatever you want to call your web app with a .war extention (lingo for this is a 'war' file), for example, "mywebapp.war" starting with the root directory. So, your war file should have at the root context:

/WEB-INF/lib (any jars you need in this folder
/WEB-INF/classes (any classes you developed, and your servlet class)
/WEB-INF/web.xml (the web app config file)
anyotherfileshere.jsp

Move your war file to your server's deploy folder. If using the default server, move it to (note that I've been using 4.0.2... your installation folders may be different)

C:\jboss\jboss-4.0.2\server\default\deploy

and start up the server.

Then, when you 'hit' the server, your URL should be something like:

http://localhost:8080/mywebapp/servlet/HelloWorldServlet

In order to really understand what's going on here, it'd be a good idea to pick up a good beginning J2EE book (I like the Head First series, but there lots of good J2EE books out there).

[ April 10, 2006: Message edited by: M Anderson ]
[ April 10, 2006: Message edited by: M Anderson ]

Mike -- SCJP, SCWCD
M Anderson
Greenhorn

Joined: Mar 17, 2006
Posts: 25
One more note...

If you're just learning how to do a J2EE web app for the first time, you might have an easier time with using Tomcat directly. Download Tomcat 5.5 and just use that. JBoss also has EJB capability, and the director structure can be confusing, even for a veteran like me.

In the case of Tomcat, you just copy your .war file do the webapps folder and bring up the server. Tomcat will also do hot deployments, like JBoss, meaning if you replace the war file while the server's already running, the server will install the new webapp right now, on the fly.
faisal usmani
Ranch Hand

Joined: Jan 14, 2006
Posts: 139
Thanx mike ,

But i am using GEL editor , could you please explain how to do it on GEL , or how do it without using any of the editor's.

Thanx in advance
[ April 12, 2006: Message edited by: faisal usmani ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to deploy a servlet in JBOSS using GEL?