Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Needs an Overview 2

Status
Not open for further replies.

LawnBoy

MIS
Mar 12, 2003
2,881
I'm a SysAdmin familiar with C, Basic, and assembler. I'm wanting to teach myself Java, both the code side and the deployment side. After browsing through the Sun website, I'm thoroughly confused.

I've a server, Netware 6.5, running Apache 2.0 and Tomcat. Everything works, many of the administrative tools run through Tomcat. I can't seem to get a good image in my mind as to how all this stuff works together though. Can someone point me to a reference that will give me a good overview? If I were to put a 3rd party Java applett on the server, where would it go, how is Apache/Tomcat configured for it, etc.?

 
Apache is a HTTP web server.
Tomcat is a servlet container (though can also be used as a HTTP web server).

Apache talks to Tomcat via port 8009 usually using a protocol built on TCP/IP called JK2.

When you set the appropriate mount points in Apache's conf files, it passes requests for things like JSP & servlets through this JK2 socket to Tomcat, which runs the Java (JSP/servlets) to create an html response, which Apache passes back to the browser.

You do not need Tomcat to run applets - all you need is Apache. You can put the applet anywhere you like really (ie somewhere in your website area). The html page that loads the applet is responsible for setting up the appropriate classpath etc to load the applet.



--------------------------------------------------
Free Database Connection Pooling Software
 
Sedj,
Thx for the response. I've seen the term "servlet container" all over the place but I have yet to see a decent definition of the term. Am I correct in assuming that it is a method of running a script on the server itself, rather than running it on the client? I.E., a "servlet" run on the server, and an "applett" runs on the client?

Sorry if my questions seem rediculous...
 
Yes, applets run on the client (uploaded to the client via the web server).

Tomcat (servlet container) recieves a request for a resource (ie Tomcat then creates an HttpServletResponse & HttpServletRequest objects, which basically hold the IO streams to the client, and the HTTP header & request data. Tomcat then invokes the servlet class with the request/reponse data, and the servlet generates HTML to output to the IO stream (response object). Simple as that !

BTW, a JSP is just a mixture of static HTML/javascript/CSS etc with embedded Java in it, and then Tomcat creates a servlet from that for you.

Everything Tomcat does is server-side (like PHP, ASP, CGI/perl is aswell).

--------------------------------------------------
Free Database Connection Pooling Software
 
I inherited a system that is running Tomcat inside JBoss with an Apache front end. Can you explain how that changes the scenario? I know Tomcat still communicates via JK2 on port 8009, but what does JBoss add to the equation?

Thanks for the previous explanation.
 
Its does not really change the situtation at all.

JBoss is just a "J2EE server" made of the following main components :

- an EJB container
- a servlet container (external, usuallly tomcat or jetty)
- an internal JMX manager (for managing internal services)
- an external RMI/JRMP server (for access to internal JNDI bound objects)
- a JNDI server (for binding internal services, sessions & EJB references)
- ... and a few others

Most of these components are indendant, but also work together on some level. Just cos they are within a single "JBoss" package does not chnage how their internal functioning works though ...



--------------------------------------------------
Free Database Connection Pooling Software
 
BTW, if you are not using JBoss for EJB, you can 99% get away with dumping it and using tomcat on its own.

--------------------------------------------------
Free Database Connection Pooling Software
 
The previous developer was more interested in learning J2EE than writing a concise, maintainable application so he uses a lot of EJB's.
 
If both APACHE and TOMCAT support HTTP and I am mainly doing Servlets (absolutely no Applets) why would I want to run APACHE? I currenly run only TOMCAT.
 
Why indeed ?!
I can't be bothered with the hassle of running Apache and Tomcat for my site, because most of the content is in JSPs, and its a fairly small site ... but at work it does make sense.

Apache is basically quicker at serving up static content (images, pdfs, html files etc) than Tomcat is - so if you have a site with a lot of static content traffic, its worth using Apache.
Also, Apache is good for URL redirects, virtual hosts etc.

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top