This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The apache can connect to tomcat. When I run http://localhost/examples/servlet/MyHelloWorld, it works now. I did not setup Virtualhost. However, I have many users like localhost/~userA. I tried to add JkMount /*.jsp ajp13, JkMount /servlet/* ajp13 to httpd.conf in-between <Directory /home/*/html> </Directory>. However, the apache cannot be started because they cannot be added in-between <Directory>. I also tried to add <Host name="localhost/~userA"> <Context path="" docBase"/home/userA/html" /></Host> to server.xml. But, it still did not work. So, how should I configure httpd.conf, worker.properties and server.xml or other files in order to make it work? And advice?
You probably would have gotten more responses if you'd asked this in the Apache/Tomcat Forum. Ypu might be able to convert the URLs from the "~" shorthand to explicit paths using mod_rewrite, but I don't guarantee it, since mod_webapp has been known to be greedy and grab stuff before other Apache modules can see it. Maybe Apache 2.0 is better equipped to handle that. Mod_webapp was supposed to get friendlier in that regard, but if it has, it's been within the last 6 months, since that's when I last researched it.
An IDE is no substitute for an Intelligent Developer.