Installing Tomcat

Posted:
in Genius Bar edited January 2014
Hello!



Im interested in installing Tomcat on my computer (Okay, i need it for Uni). But a visit to jakarta.apache.org doesn't give me instructions for OS X, and I couldn't find Binaries on the site for OS X either.



I found this website at Apple:



http://developer.apple.com/internet/java/tomcat1.html



And i've gotten Tomcat to install and its running on port 8080. Now, im having trouble installing the apache module for it. On the apple website it states the following:



Quote:

Please also note that ServerName must be defined. If you don't have a fully qualified domain name for your server, you can set ServerName to "localhost".



LoadModule webapp_module libexec/httpd/mod_webapp.so



AddModule mod_webapp.c



# port 8008 is corret, not a typo

<IfModule mod_webapp.c>



<VirtualHost 127.0.0.1>

ServerName localhost

WebAppConnection warpConnection warp localhost:8008

WebAppDeploy examples warpConnection /examples/

</VirtualHost>



</IfModule>



This lets me restart the webserver. But accessing localhost/examples gives me the following error:



Quote:

WebApp: Error 404



(File: wa_request.c Line: 197)





Web-application not yet deployed



Any suggestions ? Any help is appreciated!



.:BoeManE:.

Comments

  • Reply 1 of 9
    nttntt Posts: 18member
    You probably need to uncomment the Tomcat-Apache connector service in /usr/local/jakarta-tomcat-4.x.xx/conf/server.xml



    Remove the <!--

    from before the

    <Service name="Tomcat-Apache">



    and the -->

    after the </Service>



    Then restart both tomcat and apache.
  • Reply 2 of 9
    boemaneboemane Posts: 311member
    Quote:

    Originally posted by ntt

    You probably need to uncomment the Tomcat-Apache connector service in /usr/local/jakarta-tomcat-4.x.xx/conf/server.xml



    Remove the <!--

    from before the

    <Service name="Tomcat-Apache">



    and the -->

    after the </Service>



    Then restart both tomcat and apache.




    OK I did that, but it still gives me the same error message. I removed the comment flags for the whole block of code and then did apachectl restart and then ~/bin/stop_tomcat and then ~/bin/start_tomcat. Which is according to the http://developer.apple.com/internet/java/tomcat1.html website.



    http://localhost:8080/examples/ works just fine, but http://localhost/examples gives me the error message "Web application not yet deployed".



    .:BoeManE:.
  • Reply 3 of 9
    nttntt Posts: 18member
    Hi,



    Not sure if it makes a difference, but have you tried restarting apache _after_ you stopped and started tomcat?



    I believe tomcat may need to be restarted before the apache connector can establish a connection to port 8008 (warp connector).



    The other thing is to make sure that you uncomment the ServerName line and put in a proper hostname, such as localhost.



    If you make a change to the tomcat server.xml file you should restart tomcat and then restart apache.



    I hope that helps.
  • Reply 4 of 9
    boemaneboemane Posts: 311member
    Hi again. Thanks for a quick reply!!!



    I have tried restarting Tomcat before Apache, but it gives me the same error.



    I tried localhost/examples, but that gave me a "file doesnt exist" error. Standard Safari Error. The a visit to localhost:8080/examples/ gave me the examples directory. Not however, a visit to localhost/examples gave me the "Web-Application not yet deployed" error.



    .:BoeManE:.
  • Reply 5 of 9
    nttntt Posts: 18member
    The quick reply is because I'm in Australia, too.



    Would you be able to post up the relevant parts of your server.xml and the httpd.conf (or the whole files)?



    Or perhaps email them to me.

    Or if you'd prefer I can send you my conf files and you can check them against yours?
  • Reply 6 of 9
    boemaneboemane Posts: 311member
    Quote:

    Originally posted by ntt

    The quick reply is because I'm in Australia, too.



    Would you be able to post up the relevant parts of your server.xml and the httpd.conf (or the whole files)?



    Or perhaps email them to me.

    Or if you'd prefer I can send you my conf files and you can check them against yours?




    Either would be fine! My email address is [email protected].



    Thanks for all your help!



    .:BoeManE:.
  • Reply 7 of 9
    boemaneboemane Posts: 311member
    Quote:

    Originally posted by ntt

    Would you be able to post up the relevant parts of your server.xml and the httpd.conf (or the whole files)?



    Ok. Here are the relevant parts of the files.



    httpd.conf:



    Code:






    LoadModule webapp_module libexec/httpd/mod_webapp.so



    AddModule mod_webapp.c



    <IfModule mod_webapp.c>

    <VirtualHost 127.0.0.1>

    ServerName localhost



    WebAppConnection warpConnection warp localhost:8008

    WebAppDeploy examples warpConnection /examples/

    </VirtualHost>



    </IfModule>













    And the server.xml file:



    Code:






    <!-- Define an Apache-Connector Service -->



    <Service name="Tomcat-Apache">



    <Connector className="org.apache.catalina.connector.warp.Warp Connector"

    port="8008" minProcessors="5" maxProcessors="75"

    enableLookups="true" appBase="webapps"

    acceptCount="10" debug="0"/>



    <Engine className="org.apache.catalina.connector.warp.Warp Engine"

    name="Apache" debug="0">



    <Logger className="org.apache.catalina.logger.FileLogger"

    prefix="apache_log." suffix=".txt"

    timestamp="true"/>



    <Realm className="org.apache.catalina.realm.MemoryRealm" />



    </Engine>



    </Service>











    Also, I have the following startup script inside ~/bin/start_tomcat:



    Code:


    [jhb:~] jhb% cat ~/bin/start_tomcat

    #!/bin/sh

    export CATALINA_HOME=/usr/local/jakarta-tomcat-4.1.24-LE-jdk14

    export JAVA_HOME=/usr

    $CATALINA_HOME/bin/startup.sh









    running the script gives me the following in the terminal:



    Code:


    [jhb:~] jhb% ~/bin/start_tomcat

    Using CATALINA_BASE: /usr/local/jakarta-tomcat-4.1.24-LE-jdk14

    Using CATALINA_HOME: /usr/local/jakarta-tomcat-4.1.24-LE-jdk14

    Using CATALINA_TMPDIR: /usr/local/jakarta-tomcat-4.1.24-LE-jdk14/temp

    Using JAVA_HOME: /usr









    Is that all the information you need from me ?



    Thanks,



    .:BoeManE:.
  • Reply 8 of 9
    boemaneboemane Posts: 311member
    Since Tomcat is up and running at port 8080, i created a folder inside /usr/local/jakarta.../webapps/examples/ calles "test", and created a file called testjsp.jsp. When I try to run that file in the browser (localhost:8080/examples/test/testjsp.jsp) it gives me an FileNotFoundException.



    The files contents is:



    Code:


    [jhb:webapps/examples/test] jhb% cat testjsp.jsp

    <HTML>

    <BODY>

    Hello!_ The time is now <%= new java.util.Date() %>

    </BODY>

    </HTML>









    and the exception is:



    Quote:

    java.io.FileNotFoundException: /usr/local/jakarta-tomcat-4.1.24-LE-jdk14/work/Standalone/localhost/examples/test/testjsp_jsp.java (No such file or directory)



    Why is it trying to find the file in work/standaline/localhost/examples/test/testjsp_jsp.java ??



    Is that the correct place where Java keeps the compiled file stored ?



    .:BoeManE:.
  • Reply 9 of 9
    nttntt Posts: 18member
    Yes, that is the correct place for the compiled JSP to appear.



    Sounds like the JSPs aren't being compiled properly. Need to check that tomcat knows where the compiler is, and classpath is correct.



    Also could try installing the non-LE version of tomcat.



    Hope that helps.
Sign In or Register to comment.