Invoking Tomcat 5 servlets through Apache

Hello,
I have Apache 2.0.45, Tomcat 5.0 and mod_jk1.2.2 running on Redhat 8.0.
I am trying to get Tomcat's jsp-examples and servlets-examples to run through Apache (http://localhost). They work as expected through Tomcat (http://localhost:8080).
I added the following to httpd.conf:
Alias /jsp-examples /jakarta-tomcat-5/webapps/jsp-examples
Alias /servlets-examples /jakarta-tomcat-5/webapps/servlets-examples
JkMount /jsp-examples/servlet/* Worker1
JkMount /jsp-examples/*.jsp Worker1
JkMount /servlets-examples/servlet/* Worker1
JkMount /servlets-examples/*.jsp Worker1
With the above included in Apache's config I am able to invoke the index.html for each of the above apps. However, when I click on any of the example links I get "Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request"
One of the links for the servlets-examples I am testing is:
http://localhost/servlets-examples/servlet/HelloWorldExample
And HelloWorldExample.class is in the /servlets-examples/WEB-INF/classes
directory.
With the above configuration shouldn't Apache route the request for the servlet through to Tomcat? What more do I need to add to either Apache's or Tomcat's conf files to get this to work? As I said, they work fine through Tomcat, so I don't think I need to tweak the web.xml(s)... or do I?
TIA
pwp

Here's a snippet of my configuration:
# mod_jk configuration file - Windows version
<IfModule !mod_jk.c>
LoadModule jk_module modules/mod_jk-1.3.27.dll
</IfModule>
JkWorkersFile "H:/tomcat-4/conf/workers.properties"
JkLogFile "H:/tomcat-4/logs/mod_jk.log"
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkRequestLogFormat "%w %V %T"
# begin: examples
Alias /examples "H:/tomcat-4/webapps/examples"
JkMount /examples/servlet/* ajp13wkr1
JkMount /examples/*.jsp ajp13wkr1
<Location "/examples/WEB-INF">
AllowOverride None
Order allow,deny
Deny from all
</Location>
<Location "/examples/META-INF">
AllowOverride None
Order allow,deny
Deny from all
</Location>
# end: examples
In Apache's http.conf add:
Include H:/tomcat-4/conf/jk/mod_jk.conf
Don't forget to restart both Tomcat and Apache
http://localhost/examples/jsp and http://localhost/examples/servlets should give you the std Tomcat JSP and Servlets examples

Similar Messages

  • Java Servlet Setup Apache/Tomcat

    How do I setup a CLASSPATH to a file called serverhub.jar in a folder. (ex. c:\javaclient/serverhub.jar)
    Then I need to name the Servlet "hub" and give it a class name of com.peregrine.hub.HubServlet
    Then I need to give it initialization arguments
    servers=servername:6000
    default=servername
    threads=500
    Can someone tell me where to setup these items for a tomcat jserver and an apache http server. I already have the jserver and apache server up and running.

    You set this up under the TOMCAT_HOME/webapps/"servlet context"/WEB_INF directory. This directory should contain a classes directory, which contains your servlet class. It should also contain a lib directory, where you put the jar files. Finally, it should contain a web.xml file. This XML file is where you specify the servlet name, servlet class and initialization parameters.
    You can follow the examples located in TOMCAT_HOME/webapps/examples or see http://jakarta.apache.org/tomcat/tomcat-3.2-doc/appdev/index.html

  • Tomcat 4.0 and Apache 2.0.35

    Hello,
    I am trying to install mod_jk or mod_webapp.so with Tomcat 4.0 and Apache 2.0.35, running on Windows XP Professional. When I try to start Apache, it fails to see it the new module in the modules/ directory, even though it's most definitely there. Anybody have any thoughts?

    The Tomcat 4 has different settings compared to the previous releases (Tomcat 3.3.x and Tomcat 3.2.x). If the previous releases use mod_jk.dll and/or mod_jk.so, the version 4 uses different modules. I have obtained the following from the server.xml file from Tomcat 4.0.3.
    The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat 4.0
    as its servlet container. Please read the README.txt file coming with
    the WebApp Module distribution on how to build it.
    (Or check out the "jakarta-tomcat-connectors/webapp" CVS repository)
    To configure the Apache side, you must ensure that you have the
    "ServerName" and "Port" directives defined in "httpd.conf". Then,
    lines like these to the bottom of your "httpd.conf" file:
    LoadModule webapp_module libexec/mod_webapp.so
    WebAppConnection warpConnection warp localhost:8008
    WebAppDeploy examples warpConnection /examples/
    The next time you restart Apache (after restarting Tomcat, if needed)
    the connection will be established, and all applications you make
    visible via "WebAppDeploy" directives can be accessed through Apache.

  • Trying to run my first servlet through Eclipse + XAMPP

    I'm trying to run my first servlet through eclipse, I'm using XAMPP + Tomcat add-on as my webserver. How do I even try and compile my servlet? I've added the external jar Servlet-api.jar to my project as stated in here, http://www.theserverside.com/discussions/thread.tss?thread_id=37924
    But eclipse wouldn't compile it, because there just isn't a main() in my servlet program..
    Do I need to install the WPT plugin for eclipse? I'm guessing I'm not setting my CLASSPATH correctly - Do I need to set it up manually?

    Nevermind, there were lots of Issues going the XAMPP way, so I just installed Tomcat separately and all is fine now.
    I used instructions from http://www.scribd.com/doc/495993/Installing-Apache-Tomcat-6-and-Using-It-With-Eclipse and it was a walk-in-the-park..

  • Compile problem using TOMCAT 5.0 and Apache ANT

    I got some sample from book.
    i just follow the step, place it the class file. it work. it run. show all the detail.
    but when i wan to compile it from java file, error came out
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Error allocating a servlet instance
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         java.lang.Thread.run(Unknown Source)
    root cause
    java.lang.NoClassDefFoundError: com/jspbook/HelloWorld (wrong name: HelloWorld)
         java.lang.ClassLoader.defineClass1(Native Method)
         java.lang.ClassLoader.defineClass(Unknown Source)
         java.security.SecureClassLoader.defineClass(Unknown Source)
         org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
         org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         java.lang.Thread.run(Unknown Source)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.in CMD:
    set java_home = C:\Program Files\Java\jdk1.5.0_08
    set classpath = C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib
    and Apache tomcat originally dont have servlet.jar but servlet-api.jar, i copy the servlet.jar from my friend
    i compile it using Apache ANT
    here the build.xml
    <?xml version="1.0" ?>
    <project name="jspbook" default="build" basedir=".">
      <target name="build">
        <echo>Starting Build </echo>
        <!-- Turn Tomcat Off -->
        <antcall target="tomcatOff"/>
        <!-- Compile Everything -->
        <antcall target="compile"/>
        <!-- Turn Tomcat On -->
        <antcall target="tomcatOn"/>
        <echo>Build Finished </echo>
      </target>
      <target name="tomcatOff">
        <echo>Turning Off Tomcat </echo>
        <exec executable="bash" os="Windows">
          <arg value="../../bin/shutdown.bat"/>
        </exec>
        <exec executable="bash" os="Linux">
          <arg value="../../bin/shutdown.sh"/>
        </exec>
      </target>
      <target name="tomcatOn">
        <echo>Starting Tomcat </echo>
        <exec executable="bash" os="Windows">
          <arg value="../../bin/startup.bat"/>
        </exec>
        <exec executable="bash" os="Linux">
          <arg value="../../bin/startup.sh"/>
        </exec>
      </target>
      <target name="compile">
        <javac
          srcdir="WEB-INF/classes"
          extdirs="WEB-INF/lib:../../common/lib"
          classpath="../../common/lib/servlet.jar"
          deprecation="yes"
          verbose="no">
          <include name="com/jspbook/**"/>
        </javac>
      </target>
    </project>compile success, but error in IE
    paste the sample class file in,restart tomcat. i work again!
    what is the problem!
    even i compile the code inside the Jcreator, after set required libraries to servlet.jar or servlet-api.jar
    compile it, success then run it in IE, same error!!!.
    what should i do.
    stil a beginer in servlet and jsp anyway.

    and Apache tomcat originally dont have servlet.jar but servlet-api.jar, i copy the servlet.jar from my friend servlet.jar is an OLD version, you should only use servlet-api.jar!
    wrong name: HelloWorldPerhaps there is a mistake in the class or packagename of the source file. Post the source here.

  • How I can run servlets in Apache 1.3.2.7

    hi i am using JSP as Interface..and Servlets as controller...
    also Using Apache Httpd server,verion is 1.3.2.7
    plz tell me how i can use apache to run my servlets.
    Rahul.

    To run servlets in Apache you need the mod_jk module. But as the previous post, it is better to use Tomcat and putting both, Apache and Tomcat, working together. Tomcat will serve all the java related things, and the Apache, the html, php, etc.

  • Tomcat JSP/Servlet... free server?

    I have been trying to do some research on JSP/Servlet servers. Is the Tomcat addition to the Apache web server free to use (like Apache itself)?
    If not, are there any JSP modules / plugins that are free?
    TIA
    Rich

    free as in beer and free as in speech
    source and binaries on the left
    the license

  • Tomcat loading servlet ..twice..

    Hello,
    I have a web application in which I am facing one wiered pbm. I see tomcat loading servlet twice , on which my application logic is failing and quits.
    Getting below error in log file.
    My findings : One thing I did was , inside comp folder I made a copy of website folder and renamed it to website_old. Now both folders contains servlet.jar. Will it be causing a pbm???
    ==========================================================
    Jan 29, 2009 10:48:34 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFO: validateJarFile(.\comp\website_old\WEB-INF\lib\servlet.jar) - jar no
    t loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    ==========================================================
    Ani

    One more findings :
    I have
    Server.xml has an entry of below
    <Context docBase="C:\Program Files\Avaya/comp/website" path="/website" reloadable="false" crossContext="true" />
    So tomcat should look for website folder in the specified directory, but in the C:\Program Files\Avaya/comp directory, there are two directories , website and website_old.
    Why tomcat is searching for C:\Program Files\Avaya/comp/website_old application if it gets the C:\Program Files\Avaya/comp/website . ??
    I have tomcat6.
    Any reason??

  • Servlets and Apache 1.3.21 ???

    I'm really new to servlets and am having problems.
    Can I run servlets using Apache HTTP Server 1.3.21 ?
    I also have Tomcat 4.0 (on Windows 2000), but I don't know where to put my servlet class files so they can run?
    Please help!

    create a classes directory under tomcat home, and put your servlets classes.(ex:MyServlet.class)
    <tomcat home>/classes/MyServlet.class
    use http://host:port/servlet/myservlet

  • Unable to access Workspace through Apache web server

    Hi,
    I have configured Hyperion 9.3.1. products in windows.
    I am getting the following error message when trying to access Workspace through Apache web server(port 19000). But, able to access through Weblogic Application server(port 45000).
    please assist me in resolving this issue.
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    More information about this error may be available in the server error log.
    Apache/2.0.63 (Win32) mod_jk/1.2.8 Server at nasbydapp04 Port 19000
    Thanks,
    Siva

    I re-configured the BIPlus components and even now, i am unable to access workspace through Apache web server.
    But now, i am getting a different error
    Error:
    HTTP 404 - File not found
    Internet Explorer
    Can anyone help me in resolving this issue.
    I have updated httpd.conf and HYSL-Weblogic.conf file in Apache server.

  • Error while executing servlet through a HyperLink.

    Hi
    When i am trying to execute a servlet through the HyperLink using this statement
    where CallStatusDetailsAssign is my servlet.then i am getting this error :
    The Following is the Alert Message.
    1. Microsoft InterNet Explorer
    http://localhost:8080/examples/servlets/CallStatusDetails?Call_ID=1&EMP_NO=1
    ** Download of the specified Resource has failed.
    & also getting this error:
    2. IE Cannot open the Internet Site
         ** Operation has been Cancelled.
    If i refresh the screen by clicking on refresh button in the Internet Explorer.the Page is getting displayed properly.
    Is there any problem with my servlet code ??or some other Problem.
    Can Anyone Please help me on this & give me the Solution for my Problem.
    Rashmi

    I'm not sure if this is cause of your problem but the anchor tag should look like this:
    some text</ a>
    ... in the code the quotes are missing
    spieler

  • Apache+Tomcat access to static apache data from Tomcat

    Hi,
    Apache is in path /opt/apache
    and tomcat is on /opt/apache/tomcat
    I have to access to static data (/opt/apache/data) that is handled by my apache http server from my tomcat web application. Is there a way to do this in a clean way without doing things like this :
    getServletCoontext().getRealPath(xxx) and doing some ../data manipulations
    Thanks

    I'm not completely sure I fully understand your problem.
    I do not recommend opening sockets to your own WLS instance. That is a
    recipe for deadlock.
    Can you just include the static file in your response?
    -- Rob
    Yol. wrote:
    We have a WebApplication which is running on a WebLogic Server 6.1.
    The clients access to the application via an Apache hosted in another machine.
    The Apache server redirects the requests to the server except the static files
    which are served by the Apache Server.
    Nevertheless, we have a few static resources that are not requested by the external
    clients but are requested by the application in the WLS. The problem is that to
    make this, it access the resource via the WLS, that is, via an url. That makes
    the WLS open at least one socket. This cause that after a few time, there are
    too many sockets in the machine opened in TIME-WAIT state.
    For some reasons it is not possible to change the configuration of the sockets
    in the server hosting the WLS.
    We would like to access to this resources that are in the war of the WebApllication
    without opening a socket.
    Is it possible? Any ideas or suggestions?
    Many many thanks in advance,
    Yol.

  • Tomcat Java Servlets, how to log System.out.println() messages

    I have recently installed a new (x86) Mac OS Xserve, and am porting some Java application Servlets from an existing older Mac OSX server. All the servlets were working (I am connecting via port 9006). I have carefully used the old JDK 1.4 compiler, edited my server.xml (for port 9006) and web.xml files, etc. The Tomcat example servlets work fine, and all my (other) servlets work fine, with one exception, where I get the typically vague "java.io.IOException: Server returned HTTP response code: 500" message.
    Trouble is, I cannot get the Java System.out.prinln statements to go to the Tomcat/logs/ log files (they are all there and updating with Tomcat HttpServlet messages), in order to properly debug.
    Is there a server.xml value somewhere I can make the change?
    On another minor (possibly related) point, does anyone know what the path info ='null' means in the Tomcat access log? e.g.,
    StandardContext[/my_servlets]: Mapped to servlet 'myServlet' with servlet path '/myServlet' and path info 'null'
    It is the only other suspicious message I get in all the logs.
    One other point: my java application that fails uses threads. All the individual classes that use the threads work when run interactively, but as soon as I call them from final Serlet class that extends HttpServlet, I get a null pointer exception. Is there something unique about the Tomcat 4.1 threading that could be causing it?
    I want to avoid upgrading to Tomcat 5 at this point, if I can avoid it. My applications are modest in scope, and the last time I upgraded to Tomcat 5, it took me days to get it working properly, and I lost all access to it from the Server Admin application.

    I have found a solution: Via the Tomcat Admin web page I set the Context field "Swallow Output" to "true".

  • How i can run servlets on Apache 1.3 ?

    hi,
    i want to run my servlets on apache 1.3, could any one help me regarding it?
    thx in adcance

    use jserve module.

  • Invoking ADF 11g pages through BPM

    Hi,
    It would be appreciate if anyone can guide me on Invoking ADF 11g pages through BPM.
    Thanks
    MC

    I know this is a very old post but I was strugglign for quite some time to find a proper reply to this hence thought to update this post for others to save time.
    Check hbuelow's reply @ Unable to see the application in BPM Workspace for Sales Quote tutorial

Maybe you are looking for

  • USB Device Not Recognized (&IPOD WILL NOT TURN ON)

    I have had an iPod Shuffle G2 for 6 months now with no problems until today. It went flat when I was at my friends place so when I got back to my mums I plugged it into my laptop and it told me "USB Device Not Recognized One of the USB devices attach

  • Adobe Photoshop CS6 Extended Activation Issue

    After installing Adobe Photoshop CS6 Extended with the Serial Number, it became Trial version. Telling me to insert Serial Number every so often. Any Solution?

  • Can i hide "Open Web Part Page in maintenance view" link when editing wiki page properties

    I am working on an Enterprisewiki site collection inside SP 2013, and currently when contributor users edit the wiki page properties by going to "Page Option >> Edit Properties" , then will find the following link, named "Open Web Part Page in mainte

  • Message as yellow error

    Hi friends, I wanted to know abt message in report. I am fetching the records from two different database table i.e. kna1 & lfa1. Suppose I am not getting the data for kna1 but the data is available for lfa1. My req. is like if no data is available f

  • Phone and SMS Spam

    I am getting unwanted Phone calls and SMS messages from Spammers on my iPhone. Can I set up my iPhone in such a way Calls and SMS messages from any one not in my contacts list, will not be responded to or sent to voice mail, indicating to the Spammer