| Author |
getting set up apache/tomcat
|
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
i had everything setup on old puter around year 2000. that puter went down so on new puter i got apache2 and tomcat 4.1 i copied all my files. apache only serves one page...a logon page. at first when i tried to logon i got error that MyCookieServlet could not be found. i uncommented the servlet mapper code in web.xml and now instead i get a timeout message. what do you think problem might be? i remember (vaugly) that in order to integrate tomcat with Apache i had to edit an xml file for apache (and one for tomcat too i think)...could that be the problem? duh!!! i forgot to start my redirection updater service...im still getting error MyCookieServlet could not be found im pretty sure its because i have to edit httpd.conf thanks in advance for any help [ June 15, 2005: Message edited by: Randall Twede ]
|
SCJP
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
yes i was right...had to add a line to httpd.conf include tomcat/jakarta-tomcat/conf/tomcat.conf now, however, when i try to logon, i am getting a message saying the connection was refused i see...path and filename are not the same as before...which file do i have to include? is it web.xml? [ June 15, 2005: Message edited by: Randall Twede ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
You run apache to serve just one page? Why not just let Tomcat do it and save yourself the haeadache of maintaining both servers?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
i guess just because that is how it was set up before...actually would be best to have apache serve all the static pages. im just trying to get it up again. i added this to httpd.conf include Tomcat/Tomcat 4.1/conf/web.xml but im still getting message saying the connection was refused from apache error log: [Wed Jun 15 12:14:07 2005] [error] [client 63.24.5.78] File does not exist: G:/Program Files/Apache/Apache2/htdocs/favicon.ico [Wed Jun 15 12:14:12 2005] [error] [client 63.24.5.78] File does not exist: G:/Program Files/Apache/Apache2/htdocs/examples, referer: http://javaguy.kicks-ass.org/ examples refers to this folder: G:\Program Files\Apache\Apache2\Tomcat\Tomcat 4.1\webapps\examples is where most of the html pages are from index.html in htdocs folder: <form action="/examples/servlet/MyCookieServlet" method="get"> New Visitor Name: <input type="text" name="cookievalue"><br> Return Visitors just <input type="submit" value="Log in"></form> well at least i found something interesting as a result of this: http://www.wdvl.com/Authoring/Design/Images/Favicon/ [ June 15, 2005: Message edited by: Randall Twede ] [ June 15, 2005: Message edited by: Randall Twede ]
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
hmmm this is interesting...if i click the above link using firefox it shows the logon page. if i click it using IE i get Cannot find server or DNS Error Internet Explorer hmmm apache service refuses to start. it is complaining about the include. it says include takes one argument the name of the config file. im trying to include web.xml include Tomcat/Tomcat 4.1/conf/web.xml could someone please explain to me how to do this? this seems even harder than the first time i did it. [ June 15, 2005: Message edited by: Randall Twede ] [ June 15, 2005: Message edited by: Randall Twede ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Bear Bibeault: You run apache to serve just one page? Why not just let Tomcat do it and save yourself the haeadache of maintaining both servers?
I agree. Tomcat (and the Java JVM) has come a long way since 2000. Depending on your app and traffic patterns, it may actually be more efficient to run Tomcat as a standalone than connected to Apache Httpd. Even if not, the headaches of maintaining both + the connector may not be worth the small gain in performance you will get by serving static files with Httpd.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
i was also using PHP plug-in. and before anyone asks "why do you need PHP?", it is my own personal server on my own personal machine. it is for learning, practicing, and experience. i would still like to create something with PHP someday. i never had more than a few visitors at a time. i am not creating a new app. i do not want to rewrite anything. i just want easy solution to get back online. that is why i chose to enable invoker. now that i think i have answered all concievable questions, cant someone just help me out here? even a link or the name of a file would help. [ June 16, 2005: Message edited by: Randall Twede ] [ June 16, 2005: Message edited by: Randall Twede ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
I used this page last time I had to connect the two: http://www.johnturner.com/howto/apache-tomcat-howto.html Also, I don't know if you've seen it while looking but there are quite a few resources here: http://wiki.apache.org/jakarta-tomcat/UsefulLinks
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
thank you...from the url's those both look like promising links yes, the first site tells me i need a connector dll from jakarta thanks a bunch  [ June 16, 2005: Message edited by: Randall Twede ]
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
well it still cant find the servlet but im a lot closer. had to use an older version of the .dll because i have Apache 2.0.50.0 i tried following john turners instructions they for just a very slightly older version. tomcat created the mod_jk.conf file ok, and apache found it ok the web.xml file in the conf folder said <!-- The "invoker" servlet, which executes anonymous servlet classes --> <!-- that have not been defined in a web.xml file. Traditionally, this --> <!-- servlet is mapped to the URL pattern "/servlet/*", but you can map --> <!-- it to other patterns as well. The extra path info portion of such a --> <!-- request must be the fully qualified class name of a Java class that --> <!-- implements Servlet (or extends HttpServlet), so i changed <form action="examples/servlet/MyCookieServlet" method="get"> to <form action="examples/WEB-INF/classes/servlet/MyCookieServlet" method="get"> but that didnt help maybe i try doing it the new way and map all my servlets in a web.xml file probly wont help though if anyone has suggestions about what is wrong please let me know. they have deffinately made it much harder than it used to be instead of easier.
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
here is mod_jk.conf file in case there is some clue here. could it be that i have to change the ServerName from localhost to my domain name? i am first to admit it is mostly gobbledy-gook to me. ########## Auto generated on Thu Jun 16 19:20:22 PDT 2005########## <IfModule !mod_jk.c> LoadModule jk_module "G:/Program Files/Apache/Apache2/modules/mod_jk.dll" </IfModule> <VirtualHost localhost> ServerName localhost #################### localhost:/admin #################### # Static files Alias /admin "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/admin" <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/admin"> Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.jsp </Directory> # Deny direct access to WEB-INF and META-INF # <Location "/admin/WEB-INF/*"> AllowOverride None deny from all </Location> <Location "/admin/META-INF/*"> AllowOverride None deny from all </Location> # # Use Directory too. On Windows, Location doesn't work unless case matches # <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/admin/WEB-INF/"> AllowOverride None deny from all </Directory> <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/admin/META-INF/"> AllowOverride None deny from all </Directory> JkMount /admin/j_security_check ajp13 JkMount /admin/*.do ajp13 JkMount /admin/servlet/* ajp13 JkMount /admin/*.jsp ajp13 #################### localhost:/webdav #################### # Static files Alias /webdav "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/webdav" <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/webdav"> Options Indexes FollowSymLinks DirectoryIndex index.jsp index.html index.htm </Directory> # Deny direct access to WEB-INF and META-INF # <Location "/webdav/WEB-INF/*"> AllowOverride None deny from all </Location> <Location "/webdav/META-INF/*"> AllowOverride None deny from all </Location> # # Use Directory too. On Windows, Location doesn't work unless case matches # <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/webdav/WEB-INF/"> AllowOverride None deny from all </Directory> <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/webdav/META-INF/"> AllowOverride None deny from all </Directory> JkMount /webdav/servlet/* ajp13 JkMount /webdav/*.jsp ajp13 #################### localhost:/examples #################### # Static files Alias /examples "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/examples" <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/examples"> Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.jsp </Directory> # Deny direct access to WEB-INF and META-INF # <Location "/examples/WEB-INF/*"> AllowOverride None deny from all </Location> <Location "/examples/META-INF/*"> AllowOverride None deny from all </Location> # # Use Directory too. On Windows, Location doesn't work unless case matches # <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/examples/WEB-INF/"> AllowOverride None deny from all </Directory> <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/examples/META-INF/"> AllowOverride None deny from all </Directory> JkMount /examples/jsp/security/protected/j_security_check ajp13 JkMount /examples/snoop ajp13 JkMount /examples/servlet/* ajp13 JkMount /examples/CompressionTest ajp13 JkMount /examples/*.jsp ajp13 JkMount /examples/servletToJsp ajp13 JkMount /examples/SendMailServlet ajp13 #################### localhost:/tomcat-docs #################### # Static files Alias /tomcat-docs "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/tomcat-docs" <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/tomcat-docs"> Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.jsp </Directory> # Deny direct access to WEB-INF and META-INF # <Location "/tomcat-docs/WEB-INF/*"> AllowOverride None deny from all </Location> <Location "/tomcat-docs/META-INF/*"> AllowOverride None deny from all </Location> # # Use Directory too. On Windows, Location doesn't work unless case matches # <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/tomcat-docs/WEB-INF/"> AllowOverride None deny from all </Directory> <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/tomcat-docs/META-INF/"> AllowOverride None deny from all </Directory> JkMount /tomcat-docs/servlet/* ajp13 JkMount /tomcat-docs/*.jsp ajp13 #################### localhost:/manager #################### # Static files Alias /manager "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/manager" <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/manager"> Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.jsp </Directory> # Deny direct access to WEB-INF and META-INF # <Location "/manager/WEB-INF/*"> AllowOverride None deny from all </Location> <Location "/manager/META-INF/*"> AllowOverride None deny from all </Location> # # Use Directory too. On Windows, Location doesn't work unless case matches # <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/manager/WEB-INF/"> AllowOverride None deny from all </Directory> <Directory "G:/Program Files/Apache/Apache2/Tomcat/Tomcat 4.1/webapps/../server/webapps/manager/META-INF/"> AllowOverride None deny from all </Directory> JkMount /manager/list ajp13 JkMount /manager/deploy ajp13 JkMount /manager/html/* ajp13 JkMount /manager/resources ajp13 JkMount /manager/start ajp13 JkMount /manager/stop ajp13 JkMount /manager/install ajp13 JkMount /manager/servlet/* ajp13 JkMount /manager/*.jsp ajp13 JkMount /manager/roles ajp13 JkMount /manager/remove ajp13 JkMount /manager/sessions ajp13 JkMount /manager/serverinfo ajp13 JkMount /manager/reload ajp13 JkMount /manager/undeploy ajp13 </VirtualHost> [ June 16, 2005: Message edited by: Randall Twede ] [ June 16, 2005: Message edited by: Randall Twede ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
maybe i try doing it the new way and map all my servlets in a web.xml file probly wont help though
Yes, with modern versions of Tomcat, you will need to map your servlets in xml. The invoker is still there but only for backward compatibility. In order to use it, you would have to uncomment it's entry in the global web.xml file. If you're considering doing so, read these first: http://jakarta.apache.org/tomcat/faq/misc.html#evil http://faq.javaranch.com/view?InvokerServlet One tip: Try hitting your servlets/JSPs with the standalone connector built into Tomcat to make sure your app is running OK before getting too involved with the connector. Both the standalone HTTP server and the connector can run at the same time. This way, if you can't hit your servlet, you can test by hitting localhost:8080/yourapp/yourservlet and KNOW that the problem is with the connector, not your app.
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
the reason i said it probly wouldnt work is because the first thing i did when things didnt work was uncomment the invoker as i suspected, that did no good...just to make sure i did that correctly: in G:\Program Files\Apache\Apache2\Tomcat\Tomcat 4.1\webapps\examples\WEB-INF\web.xml <servlet> <servlet-name>MyCookieServlet</servlet-name> <servlet-class>MyCookieServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>MyCookieServlet</servlet-name> <url-pattern>MyCookieServlet</url-pattern> </servlet-mapping> in G:\Program Files\Apache\Apache2\htdocs\index.html <form action="examples/MyCookieServlet" method="get"> MyCookieServlet.class is in G:\Program Files\Apache\Apache2\Tomcat\Tomcat 4.1\webapps\examples\WEB-INF\classes there is no package [ June 17, 2005: Message edited by: Randall Twede ]
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
Ok something is wrong with Tomcat i stopped Apache, then i used both browsers and type in http://localhost:8080/examples/JavaGuy.html which is a static page in the examples folder firefox says waiting for localhost IE hangs saying opening page. i open task manager and it says tomcat.exe is PID 488 and uses 20,392K but CPU Time only 0:00:05 and after watching it for several minutes it never once used the CPU i remember from the instructions from john turner something about what i edited in conf\server.xml was changing port i try with this url http://localhost:8080/JavaGuy.html also, and this http://localhost:8080/ same thing and to think some people do this for a living...i would go insane :roll: [ June 17, 2005: Message edited by: Randall Twede ] [ June 17, 2005: Message edited by: Randall Twede ] [ June 17, 2005: Message edited by: Randall Twede ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
This is the order in which I would install/test the components. Install Java Install Tomcat Test Tomcat by typing: http://localhost:8080 into my browser's URL window. Install my app -> test -> debug -> configure -> test Install Apache Test all of the above Install and configure the connector Test all of the above
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
is too late for that (i could uninstall tomcat and apache and start over though). i found this in tomcats documentation: The most common hiccup is when another web server (or any process for that matter) has laid claim to port 8080. This is the default HTTP port that Tomcat attempts to bind to at startup. To change this, open the file: $CATALINA_HOME/conf/server.xml ...and search for '8080'. Change it to a port that isn't in use, and is greater than 1024, as ports less than or equal to 1024 require superuser access to bind to. Restart Tomcat and you're in business. Be sure that you replace the "8080" in the URL you're using to access Tomcat. For example, if you change the port to 1977, you would request the URL http://localhost:1977/. i think ill try that. i dont know how to find out which ports are not in use though Windows 2000 Pro ill just try 1977 is most likely not in use [ June 17, 2005: Message edited by: Randall Twede ]
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
well that did not help. i guess all i can do is uninstall and start over thanks for the help and the links
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
This conversation seems to have drifted to: http://www.coderanch.com/t/85111/Tomcat/connect-localhost-but-not-domain Randall, The conversation will be a lot easier to follow if you keep it in one thread. This is especially true for people searching the archives later on.
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
i see your point, but it is really a slightly different topic. here i wanted to connect tomcat and apache. i gave up on that idea for now. in the new thread im trying to solve problems using new tomcat as a standalone. in fact the problem mentioned in new thread title is a problem i didnt have before. but thanks for providing link for anyone searching in the future. [ June 18, 2005: Message edited by: Randall Twede ]
|
 |
 |
|
|
subject: getting set up apache/tomcat
|
|
|