• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Can tomcat log which reflect test2 is actually for test ?

 
Ranch Hand
Posts: 534
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did a test over my current web host and then I observed the following tomcat log.

NFO: Deployment of web application archive /media2/xxx/public_html/test2/ROOT.war has finished in 736 ms
Mar 19, 2019 9:52:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8138"]
Mar 19, 2019 9:52:29 AM org.apache.catalina.connector.MapperListener findDefaultHost
WARNING: Unknown default host [localhost] for connector [Connector[AJP/1.3-8138]]
Mar 19, 2019 9:52:29 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4585 ms

I am puzzled that the war file is uploaded to test but the deployment shows test2 instead.

So, my question is why tomcat is showing test2 ?

Here's the directory structure :

public-html
->cgi-bin
+ROOT
-test
->cgi-bin
+ROOT
-test2

 
Bartender
Posts: 20938
127
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is all messed up. That directory structure looks more like Apache httpd than Apache Tomcat.

 
tangara goh
Ranch Hand
Posts: 534
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:This is all messed up. That directory structure looks more like Apache httpd than Apache Tomcat.



So is this a common set up in most hosting company - using Apache httpd and Apache Tomcat to work together?

Furthermore, I have subscribed to a dedicated JVM but the IP address is shared so it is all very confused to me now.

What is the norm out there in terms of hosting a Java EE web App with jsp ?

 
Tim Holloway
Bartender
Posts: 20938
127
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is very common for Tomcat to be proxied by a non-Java webapp server like Apache, Nginx, or IIS, yes.

There are two reasons why this is a good idea.

First, it allows a single web address to handle both Java and non-Java webapps, since a program like Apache can proxy for Tomcat, but Tomcat isn't set up to proxy for Apache.

Secondly, and in many respects, more importantly, this is a more secure solution than exposing Tomcat directly to the Internet.

That's because TCP/IP assigns magical properties to ports less than 4096 - including the http port (80) and https (443). To be able to listen to the "magic" ports, the application has to run as an administrative (root) user. Otherwise the OS will reject the listening request.

Running as root is a serious security risk. You NEVER want to run as root if you don't have to, and ESPECIALLY when you're directly connected to a hostile environment like the Internet.

Apache and its relatives can deal with this, because while they launch as root apps, they change their user identities after they open the port to non-root users. Tomcat cannot do that, because Tomcat is written 100% in Java (write once/run anywhere) and there's no universal way for a Java application to change its OS user ID. In fact, Java isn't even supposed to know if the OS even has user IDs (MS-DOS, for example, did not).

So by configuring Apache as a "reverse proxy", incoming URLs destined for Tomcat can be received by Apache and forwarded via a private tunnel protocol to Tomcat (mod_proxy or mod_jk) and all is happy, if slightly more complicated.

But the Apache and Tomcat servers themselves should be completely separate (don't even have to be on the same machine), so you shouldn't be putting Tomcat application resources in an Apache directory or vice versa.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!