Apache - mod_jk - tomcat site filesystem question

hi all
we finished today to set up apache+mod_jk+tomcat togheter
we done it because in this way apache will serve static pages and tomcat jsp + servlet right?
now, a (maybe stupid) question:
how to make apache serve static pages and tomcat jsp & servlets? shall we divide our site into two directories (one, with static pages and the other with servlet and jsp) or there is a way to map our site under tomcat and apache in order to avoid such a division?
thanx a lot
sandro

thanx a lot for your answer
but i need another suggestion:
lets imagine i have my little site with this directory sistem:
directory "mysite"
here a lot of *.htm files and a directory named "dinamic" containing all the dinamic content (*.jsp and the WEB-INF/classes/*.class files)
now my question is:
can I leave this structure intact or shall i divide the *.htm files from the dinamic content?
what do the standard tell?
thanx a lot
sandro

Similar Messages

  • Apache-Mod_jk-Tomcat and SSL certificate

    Hi all.
    I have Apache 2.0.55 working with Tomcat 5.5 via mod_jk connector.
    I have generated a self-signed cerificate for Apache using openssl, and I use it to encrypt both URLs served by Apache and URLs served by Tomcat through mod_jk.
    When a "https URL" is forwarded to Tomcat, an exception is thrown by the webapp, unless the certificate has not been set as "trusted" on Tomcat side.
    So, it seems like I have to do the following:
    1) generate a a self-signed cerificate for Apache using openssl.
    2) import this certificate in a keystore
    3) set the keystore as trusted (System.setProperty("javax.net.ssl.trustStore", PATH_TO_KEYSTORE));
    I'm wondering if there's a better way to accomplish that, not forcing me to do all this steps and, above all, allowing me to "break" the link between the apache cert and the tomcat keystore.
    Any help will be very appreciated!

    usually u generate a keystore for client, and mention that in ur SSL connector of tomcat
    in apache, we need to configure things in ssl.conf

  • Content-type problems while using struts+tomcat+apache+mod_jk

    Hi!
    Could anyone tell me how to solve the following problem.
    Struts-application works under apache + mod_jk + tomcat 3.3.1. Operating system is Linux.
    It's impossible to me to make tomcat to send HTTP-answers in UTF-8.
    I was trying the following:
    1. Set <DecodeInterceptor defaultEncoding="UTF-8" /> in server.xml
    (Has no effect. Tomcat responds with Content-Type: text/html; charset=iso-8859-1)
    2. Insert <%@ page contentType="text/html; charset=utf-8"%> into each page header.
    (Works fine but when struts-application gets GET/POST-data the two-bytes national characters
    are comverted into "?"-symbols)
    Is there any way to make tomcat 3.3.1 to send HTTP-answers in UTF-8?

    I don't know what the DecodeInterceptor does... but....
    If you use number 2, you are only telling the browser what that page's output is. When you process the data, Tomcat for some reason always reads it as ISO8895-1, so you need to tell Tomcat to change it to UTF-8. You can do that by calling request.setCharacterEncoding("UTF-8"), either in the JSP page, or if you need it in a servlet, you can do that in a filter...
    It's somewhat described here how to set it up...
    http://www.mail-archive.com/[email protected]/msg01193.html

  • Tomcat and apache mod_jk or mod_webapp

    Hello,I am using linux and I am running a apache web server and I also use tomcat.
    I have upgraded from tomcat 4.0 to 4.1.24 and I am now wanting to use servlets and jsp with apache.I have messed around with servlet etc for awhile now but I wish to use them on my server,which is apache.My question is,do you know of a good website that explains how I can use the mod_jk,mod_jk2 or mod_webapp with apache 2.0 so I can use servlet with apache.I have looked but have not came up with nothing good and the stuff I have found is for older version and I am not sure if I need to use the mod_jk ,mod_jk2 or mod_webapp with the version of apache and tomcat I have.Ps,A good tut page on this would be nice.
    Thank you for your time.
    "Note" the new tomcat is a pain in the %$# to set up cause you have to uncomment the servlet invoker in the conf/xml file.Older version you did not have to do this cause it was already done for you.So this note is for people that has ever had trouble with setting up the new tomcats cause it was a pain in my @$$ figuring out why the hell the servlet was not working.
    Regards,
    D.W.A

    "Note",I cross posted this thread see
    http://forum.java.sun.com/thread.jsp?forum=54&thread=396478

  • Apache server - tomcat - jk, virtual hosts, database/context.xml question?

    Hello,
    I have an web application that runs perfectly in Tomcat 5.5 when running tomcat stand-alone.
    I also have Apache HTTP server integrated with Tomcat using the jk connector and running virtual hosts in a mod_jk.conf file, which is working for html files. When I run apache and tomcat at the same time, the jsp opens but the servlet cannot get a database connection.
    To run virtual hosts and apache and tomcat, I added this host container to server.xml:
    <Host name="www.mydomain.com" debug="0" appBase="d:/WebApps/mydomain"
    unpackWARs="true" autoDeploy="true">
    <Context path="" docBase="" debug="0"/>
    </Host>
    Does anybody see anything wrong with this? Is there some reason why the context.xml (which contains the database info) is not being read?
    Any suggestions are greatly appreciated.
    Thank you,
    Logan

    Hi,
    In the docmentation of Tomcat 5.x is written that is not recommended to put <context> element in the server.xml file. Create a file in CATALINA_HOME/conf/Catalina/www.mydomain.com/ with an XML extension. For example context.xml. In files like this you should write all of your <context> elements.

  • Apache 2, Tomcat 5, mod_jk2 configuration problem

    I am setting up a Web Server on a RedHat Enterprise Linux box. I installed the RedHat Application Server that installs Apache 2, Tomcat 5 and Mod_JK2. I can't get the mod_jk2 configured properly. I've searched the internet and haven't found any documentation that will work with this.
    I need to know how to configure the mod_jk2 with Apache2 and Tomcat 5.
    PLEASE HELP!!! Nothing I've tried from the Internet has helped. The best site that I've found is ::
    http://www.johnturner.com/howto/apache2-tomcat4127-jk-rh9-howto.html
    but its for tomcat 4 so it doesn't work for me.
    Has anyone does this before that can help me????
    Thanks in advance.

    Ended up downloading and installing the mod_jk instead of the mod_jk2 that came with RedHat Application Server.

  • Can't get Apache mod_jk To Work In Mountain Lion

    Hi,
    I'm trying to get Apache and Tomcat to communicate via mod_jk. I have had this working fine in the past on servers running 10.4 through 10.6.
    Now whenever I try to load the mod_jk module with 'JKMount /appname/* ajp13' in my virtual hosts file Apache barfs at startup with the unhelpful message...
    [Fri Jan 18 11:00:28 2013] [notice] Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/0.9.8r configured -- resuming normal operations
    [Fri Jan 18 11:00:32 2013] [notice] caught SIGTERM, shutting down
    Everything else in my config is taken directly from a setup that works under Snow Leopard and I have (after much pain and grief) compiled and installed the latest version of mod_jk under Mountain Lion.
    Has anyone got mod_jk working under Mountain Lion? Is there a better forum for this question...
    cheers

    OK, it seems that mod_jk isn't getting loaded by Apache and I can't figure out why. No error messages or anything?

  • Client authentication with apache+mod_ssl+tomcat

    Hello.
    My question is a little bit off topic.
    I try to read client certificates with request.getAttribute("javax.servlet.request.X509Certificate"), but the result is always null.
    Probably it's null because I have nothing on the session. So my tomcat does not have the certificate. I use apache + mod_ssl + mod_jk + tomcat.
    And here is my question: how did you configured apache and tomcat so that tomcat has the client cert ?
    Thanks.

    usually u generate a keystore for client, and mention that in ur SSL connector of tomcat
    in apache, we need to configure things in ssl.conf

  • Apache/SSL Tomcat config weirdness...

    I thought I read a post related to this recently, but I can't find it (the forum search is flaky lately), so I'm making my own post...
    We have Apache 1.3 with mod_ssl for SSL, Tomcat 4.1.24 and mod_jk set up. Things work fine for most of this setup, except this weird thing happening with our pushlet servlet. The pushlet is a servlet that never closes and we push data to an applet client in the browser.
    The JSP and other servlets (one that creates a chart image, for example) work fine. The weird thing is the pushlet servlet, on the other hand, will not work fine. It has multiple output modes: Javascript, Serialized Object and XML, and we use the Serialized Object mode with the client applet, but for some reason it is disregarding what mode we ask for only when using SSL. When we connect to Tomcat directly (we have port 8080 open for testing) without SSL, the pushlet stuff works fine as well. It seems that when we connect to the pushlet (testing by typing the URL in the browser) with SSL, it defaults to the Javascript mode no matter what we put in the query string of the URL, and Javascript not being serialized objects, the client barfs. (XML mode doesn't work either.)
    It's made more weird because the debug statements we put in the doGet method of the pushlet servlet don't get written either in SSL mode, but they do in non-SSL mode. Very strange, cuz basically we figured the pushlet servlet is somehow not getting the parameters of the query string in the request (which is what I thought I saw a thread about that I mentioned before).
    So clearly the obvious answer is that something isn't configured correctly between Apache and Tomcat. But I can't seem to figure out what. Any ideas?

    I wouldn't say most... you've been pretty busy yourself...
    One possible conclusion we've come up with is: We are using RedHat Linux 9, and I rebuilt Apache, mod_ssl and mod_jk myself on that system. But someone else installed it, and I recall (vaguely, and the someone else no longer around) that he had some issue running them with the mod_jk I built for RH9, so he ended up using the one we had from a RH7.2 installation (which the whole thing on a RH7.2 system works fine, SSL or not). He had said it was working with the RH7.2 mod_jk, but maybe he didn't check the right things, and I didn't follow up on it at the time cuz it wasn't important at the time.
    So the thought is that maybe it's the mod_jk that's really causing a problem for some reason. Some incompatability in the builds for the OS versions. Why it's only during SSL connections, I don't know, but the rest of the config seems to be correct.
    As for the SSL How-To, yes, I've looked thru it again (as I said, though, we have the same thing on an RH7.2 system is working fine, and in both cases I built Apache, mod_ssl and mod_jk from source for both systems). I'm considering setting up stand-alone SSL on Tomcat and taking Apache out of the loop to see if it works that way.
    We have, however, pretty much ruled out the pushlet servlet (it's 3rd party code) as the problem. We have the source, and it's too simple in what it does to be messed up, and debug statements we put in don't seem to indicate any problem.
    Well, more investigations tomorrow.

  • Apache + 2 Tomcats session replication problem.

    Greetings everyone.
    Before stating the problem, let me explain how my environment is set.
    I have two machines. One (PC1) running Apache (HTTP server 2.0.58)
    and one instance of Tomcat (5.0.28) and another machine (PC2) with
    another instance of Tomcat(5.0.28).
    The Apache server
    It is configured to handle static content, to redirect dynamic content to a
    Tomcat instance through AJP 1.3 connector.
    This process is done through the mod_jk and the workers.properties
    The workers.properties file is configured to have sticky_session = True
    so it assigns a SESSION_ID to the same Tomcat it was first assigned.
    The workers.properties file is configured to have
    sticky_session_force = True so if the Tomcat the SESSION_ID was
    assigned is not available, the server answers with a 500 error.
    The Tomcat servers
    Both have only the AJP 1.3 connector enabled
    Both have the Cluster tag from the server.xml file uncommented
    and the useDirtyFlag flag set to false, for not to allow SESSION
    replication between Tomcats.
    The workers.properties file
    workers.apache_log=C:/Apache2/logs
    workers.tomcat_home=C:/Tomcat5
    workers.java_home=C:/j2sdk1.4.2_13
    ps=/
    #Defining workers -----------------------------
    worker.list=balancer,jkstatus
    #Defining balancer ---------------------------
    worker.balancer.type=lb
    worker.balancer.balance_workers=tel1, tel2
    worker.balancer.sticky_session=True
    worker.balancer.sticky_session_force=True
    worker.balancer.method=B
    worker.balancer.lock=O
    #Defining status -----------------------------
    worker.jkstatus.type=status
    worker.jkstatus.css=/jk_status/StatusCSS.css
    #Workers properties ---------------------------
    worker.tel1.type=ajp13
    worker.tel1.port=8009
    worker.tel1.host=127.0.0.1
    worker.tel1.lbfactor=1
    worker.tel1.socket_keepalive=False
    worker.tel1.socket_timeout=30
    worker.tel1.retries=20
    worker.tel1.connection_pool_timeout = 20
    #worker.tel1.redirect=tel2
    worker.tel1.disabled=False
    worker.tel2.type=ajp13
    worker.tel2.port=8009
    worker.tel2.host=199.147.52.181
    worker.tel2.lbfactor=1
    worker.tel2.socket_keepalive=False
    worker.tel2.socket_timeout=30
    worker.tel2.retries=20
    worker.tel2.connection_pool_timeout = 20
    #worker.tel2.redirect=tel1
    worker.tel2.disabled=False
    THE PROBLEM
    I open a browser in the jk-status page to see how the Tomcat instances are
    working, and both are working fine: Stat -> OK, now as the
    loadbalancing factor is 1 on both Tomcats, an even alternating session
    distribution is set.
    While this browser is open to keep an eye on the status, I open a new
    browser (B1)to connect to my Web Application, Apache answers
    correctly and gives me a SESSION_ID for Tomcat instance 1 [both
    instances are OK], if I make a simple refresh, my SESSION_ID is still the
    same so I'm assigned to Tomcat instance 1 but this time I get an
    ERROR 503 - Service unavailable but looking at the status of the
    Tomcat instances both instances are still OK, no-one is down. And it
    stays throwing this error for as many refreshes i do.
    Now, I open a new browser (B2)and do the same process as before,
    as expected, Apache now gives me a SESSION_ID for Tomcat instance 2,
    repeating the same refreshing process, the error is thrown again, but still at
    the jk-status page, both instances are fine.
    Without closing these windows, I make a new refresh try on B1 and
    even though the jk-status says both Tomcat instances are OK, the error
    is still thrown. I open a third one (B3), and Apache again, correctly
    gives me a new SESSION_ID for Tomcat instance 1 and answers
    correctly on the first call. But once again if i repeat the refreshing process, the
    error is thrown again.
    Note: Using a different resolution to always keep and eye on the
    instances status and using a refresh rate of 1 second for status, both
    servers always were OK.
    So the main problem is that somehow when the session is replicated
    to the same tomcat, Apache confuses and thinks it is not available, when
    asking it through the jk-status it tells it is OK
    I've been trying different configurations with both Apache and Tomcat,
    but there must be something missing since I don't get it to work correctly
    Thanks in advance for all your helping comments.
    - @alphazygma

    Whew... that was quite an answer... definitely is going to help him a lot. Yeah any n00b by now should know how to use google, but that's not the point in this forums, here we are to help each other. and wether you like it or not many of us deploy applications to tomcat and stumble on this. So dont try to be cool posting this kind of answers like google this or google that if you dont have an answer please dont comment you will appear to be more noobish than you aparently are.
    Well enough talking.
    I found the following useful: (it comes in the server.xml of the tomcat configuration)
    <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
    <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">
    -->
    Enabling that entry on both machines should be enough.
    Aparently the problem is not with apache. is with tomcat since it can't retain the session apache gives.
    more information in the Tomcat help at:
    http://tomcat.apache.org/tomcat-5.0-doc/balancer-howto.html#Using%20Apache%202%20with%20mod_proxy%20and%20mod_rewrite

  • Integrating Apache with Tomcat?

    Anyone have a guide to integrating Apache with Tomcat using mod_jk?
    I followed some guides online, but they all seem really dated with some obscure references. This seems like it should be on the top of the list....

    Hi Alan.
    I've discovered the exact same problem.... 0.0.0.0 instead of 127.0.0.1
    You've obviously not had any replys here, but di you end up working it out on your own?

  • Apache with Tomcat and dispatcher class.

    I have a MVC design set up with a controller and dispatcher class. I am trynig to forward the results to a specific JSP. If I run the design completely within Tomcat, then everything works great. I have a tomcat site set up called /jsp. My servlet is within the jsp site. So if I do http://localhost:8080/jsp/mypage.jsp it will bring up the page fine. I then submit to and action of /myservlet?action=test. The servlet/dispatcher classes process and forward the request to "/jsp/mypage_result.jsp". All is fine and dandy.
    However, when I try to run this through Apache first let the MOD_JK2 send the JSP/servlet requests to Tomcat the dispatcher doesn't work. I alway get the ERROR 404 page within tomcat (see note 1 below). Even if I use a "./mypage_result.jsp", because the pages are in the same directory, I still the get the error. Can anyone help?
    What I think is happening is that when I make the inital request of http://localhost/jsp/mypage.jsp the request gets sent to Tomcat from Apache. Tomcat processes the jsp page and displays the result to the client. The user submits the data to the servlet (through Apache which pushes it to Tomcat). The servlet/dispatcher code runs and then gets ready to forward the request on. Where I get confused or I am completely guessing is that when the forward method gets called. Does it forward the request on as a HTTP request or as a request within Tomcat? I would guess it is an http request and the request comes in through Apache which (depending on the worker2.properties file) will or will not forward the request to Tomcat. This is where the problem happens. On this forward in the dispatcher class.
    Please help.
    NOTE 1:
    HTTP Status 404 - /mypage_result.jsp
    type Status report
    message /mypage_result.jsp
    description The requested resource (/mypage_result.jsp) is not available.
    Apache Tomcat/4.1.24

    After reading the documentation for the getRequestDispatcher method it seems that the file you are forwarding to must be in the same context. Well if it is in the same context within Tomcat, does it mean it is the same when I am trying to use Apache?
    Anyone out there go this to work?
    Thank you in advance for reading my post.

  • Right problem with apache and tomcat

    Bonjour;
    I use a user login "apache" to stop/start Apache and tomcat. Because never launching apache et tomcat as root.
    But I have the following problem with apache (file error.log) :
    [Tue May  6 17:26:22 2003] [error] Connection "warpConnection" cannot connect
    [Tue May  6 17:26:22 2003] [error] Cannot open connection "warpConnection"
    [Tue May  6 17:27:01 2003] [error] Re-Trying to deploy connections
    As root the error msg does'nt exists (lost)
    Best regards;
    A+;

    Run it from the shell to see whats wrong:
    # httpd

  • Which is better for servers, Apache or Tomcat?

    Which is better for servers, Apache or Tomcat?

    For some reason that link I gave you isn't working right now, but it was today, weird. I would get Tomcat simple because sun uses it in its examples and recommends it. Here's sun's link then, it's probably more useful anyway. http://java.sun.com/products/jsp/

  • Apache 2, Tomcat 4 and Oracle's XSQLServlet not working together

    Hi
    I cannot even get the basic demos in ./demo/java/xsql to work with this combination of technologies.
    I am running this on Red Hat Linux 8. Apache and Tomcat work fine, the CLASSPATH is set and I have created the Alias etc.
    I believe that the .xsql type is not being processed by my XSQLServlet, because calling up http://localhost/xsql/ brings up 3 raw xsql files in the browser.
    All the documentation I have found describes using XSQL with older Apaches and JServ. JServ is now replaced by Tomcat and Tomcat 4 is much different from earlier versions of Tomcat. Despite that I believe I have guessed and made the correct changes to httpd.conf and web.xml to make the XSQLServlet work.
    Has anyone got these to work ? I've been at this for days and am driven half mad by it ! All that has kept me at it is that this seems like a magnificent combination of technologies. Many thanks in advance... for any advice at all.
    - Des

    AndyRTR wrote:Please check the new libreoffice version in testing. It should work with openjdk6 and jre7-openjdk. Not sure if closed
    Oracle jre7 from AUR will also get detected.
    Thanks for the info. Yaourt -Syu will be my friend
    Java7 is recognized, great. Too bad java web plugin could be blacklisted because of security matters.
    Last edited by fredbezies (2011-10-05 14:58:07)

Maybe you are looking for

  • Unable to capture from VCR

    I am trying to capture some video clips from VCR into Final Cut Pro to create a historical record for the family. I have done this successfully in the past using moviebox dv however I recently upgraded my IMac and the new model has a firewire 800 por

  • Retreiving files over http or ftp.

    I was wondering what program I should use to retreive files over http or ftp. Previously I had used wget per my hosting provider's recommendation. It worked when I was ssh logged in to his server (via Mac Terminal). However, when I try using wget on

  • Itunes store does not open correctly in itunes 10

    Not sure when this started, but itunes store no longer loads correctly. Tables do not load correctly at all. Diagnostics are listed below. The same problem occurs at travelocity, but I haven't found it occurring anywhere else on the web. I have a scr

  • I want to learn how to use the creative soft synth

    please somebody throw me a bone....i need to start from the BEGINING here! where can i find a beginers guide telling me everything i need to know ...step by step ....how to configure and use the creative built in SOFT SYNTH....is there a control pane

  • Running MD06 by Vendor

    Hi, I have a vendor that we purchase about 8 different items from.  These item/vendor has been set up in purchasing info records and my source list is correctly maintained.  The problem I'm having is that when I run MD06 by vendor, I get absolutely n