Servlets and Tomcat/Apache

Okay,
Tomcat 4.1 running with Apache.
Installed mod_jk, piece of cake.
JSPs run through Apache like a dream.
Tomcat examples ( jsp and servlets) run through Apache perfectly ( that is no :8080 business).
My JSP's run through Apache no problem. Works great.
My SERVLETS WILL NOT RUN THROUGH APACHE FOR ANYTHING.
My context looks like this in server.xml:
<Context path="/nuweb" docBase="/home/shared/nuweb" debug="0"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="nuweb" suffix=".log"
timestamp="true"/>
</Context>
Note: that I am not under <TOMCAT_HOME>/webapps.
The reason is that I will, in production not be the Unix admin on the server. I will only have priviledges within my directory. I will not be able to drop war files in the webapps directory. I will not be able
to start and stop tomcat or apache ( there are 100 diffrent apache contexts on that machine and someday many of them will be going through tomcat for jsp and servlet support).
My servlets will only run if I put :8080/nuweb/servlet/HelloServlet in the URL. Take off the 8080 and I get Page not found. Not the tomcat 404 page, the Browswer 404 errror.
Here is my web.xml which lives in the WEB-INF directory of of /home/shared/nuweb
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>org.nu.servlet.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
In devlopment I am on a system that is very close to what the production server will look like ( Tomcat 4.1 same version of Apache, same Unix ). In development I can restart all the servers edit server.xml etc. On the production I would have to schedule that stuff. I want to be able to compile classes and drop them in the WEB-INF/classes... directory and have them run. Is that too much to ask?

Hi,
I am also facing same error.
I am not able to view my servlets via apache web server.
ie when i do "http://localhost/enlighta/logon"
I get http 404 page not found error
but when I do http://localhost:8080/enlighta/logon
all works fine
I am using apache 2 and tomcat 4.5
This is I have done:
1.I have http server running on port 80
2. appserver on port 8080
3. I have a war file enlighta.war deployed on webserevr
4. The static content like images and html page I have moved to webserver
5. The servlet context of the app on the app server is /enlighta
6. In the web.xml I have defined all the servlet maping.
the port 8009 has the connecter is running/listening.
the configuration
sever.xml on tomcat
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
httpd.conf on apache
# Load mod_jk
LoadModule jk_module modules/mod_jk.so
# Configure mod_jk
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
# First Virtual Host.
<VirtualHost 192.168.1.2:8080>
ServerAdmin [email protected]
DocumentRoot /enlighta/
ServerName localhost
ErrorLog logs/enlighta_error_log
TransferLog logs/enlighta_access_log
JkMount /enlighta/* ajp13
</VirtualHost>
workers.properties
worker.list=ajp13
# Defining a worker named ajp13w and of type ajp13
# Note that the name and the type do not have to match.
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
Now I feel I am doing something wrong on defining virtual host.
Or may be something else is wrong.
I have gone thru the previous thread but I dont have mod_jk.conf file.
Please help!!!
Thanks
Sachin

Similar Messages

  • Java servlets and Tomcat  server

    Hi friends
    i am using Sun One forte Community edition . i am trying to make a hello world servlet .
    there are 2 Files one is Index.html , HelloWorld.java (Servlet)
    I call this servlet from the index.html file.
    evertime i call it it gives me and error of Apache tomcat file not found .The tomcat server is inbuilt with the Sun One studio.
    the directory structure is
    -----HOME
    -------WEB_FOLDER
    ----------Index.html
    ----------WEB-INF
    -------------CLASSES
    -----------------myServlet (package)
    ---------------------HelloWorld.java
    -------------LIB
    The problem is I am not getting how to write the path of servlet in index.html to call the helloWorld servlet.

    Make this entry in your server.xml file located in tomcat_dir\conf.
    <Context path="/abc"
         docBase="webapps/abc"
         crossContext="true"
         debug="0"
         reloadable="true"
         trusted="false">
    </Context>
    Suppose i want to develop my servlets in another folder Let it be "XYZ".Then your package statement must be, 'package xyz;'. Place all your servlets in webapps/abc/WEB_INF/classes/xyz dir.
    Place all your Jsp(s) and Htmls in webapps/abc/pqrs dir.
    Now they all come under one context 'abc'.
    Sudha

  • Again problem with servlet and Tomcat

    My files are:
    webapps\greeting\src\GreetingServlet.java
    ................\index.html
    ................\WEB-INF\classes\GreetingServlet.class
    ........................\web.xml
    Url:http//:localhost:8080/greeting/ shows index.html but when i submit
    it showing
    HTTP Status 404 - /greeting/servlet/GreetingServlet
    type: Status report
    message: /greeting/servlet/GreetingServlet
    description: The requested resource (/greeting/servlet/GreetingServlet) is not available.
    Source code:
    1.index.html:
    <HTML>
         <HEAD>
              <TITLE>ProJava Registration</TITLE>
         </HEAD>
         <BODY>
              <H1>Welcome</H1>
              <FORM ACTION ="/greeting/servlet/GreetingServlet" METHOD= "POST">
                   <p>Your Name <INPUT TYPE= "text" SIZE= "40" NAME= "name" ></p>
                   <p>Your Email <INPUT TYPE= "text" SIZE= "40" NAME="email">
                   <INPUT TYPE= "submit" VALUE= "Submit" ></p>
              </FORM>
         </BODY>
    </HTML>
    2.GreetingServlet.java:
    import javax.servlet.* ;
    import javax.servlet.http.* ;
    import java.io.* ;
    import java.util.* ;
    public class GreetingServlet extends HttpServlet{
    protected void doPost (HttpServletRequest request,
                   HttpServletResponse response)
                        throws ServletException, IOException {
         String name = request.getParameter ("name");
         String email = request.getParameter ("email");
         String message = null;
         GregorianCalendar calendar = new GregorianCalendar();
         if (calendar.get(Calendar.AM_PM) == Calendar.AM) {
              message =" Good Morning";
         else {
              message = " Good Afternoon";
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         out .println("<HTML>");
         out .println("<BODY>");
         out .println("<p>"+message +","+name+"</p>");
         out .println("<p> Thanks ("+email+")</p>");
         out .println("<p> -The Pro Java Team.</p>");
         out .println("</BODY>");
         out .println("</HTML>");
         out .close();
    Please help me
    Thanks in advance Also thanks to st.

    Hi,
    I think you have to change server.xml, which is in conf directory of your tomcat root directory.
    search context in server.xml
    and alter like this
    <Context path="/greetings" docBase="greetings" debug="0"
    reloadable="true" crossContext="true">
    Hope this will help
    Regards
    Sekhar

  • Servlets and Tomcat

    Hope i'm in the right forum. I have tomcat installed on my pc and need to write a few servlets ok. But when I compile I get an error message saying"package javax.servlet.* not found". I can't understand why any ideas as i'm reallly stumped. Is it a tomcat issue of a vm issue as i have the J2SE5 running on my machine.
    Stone

    Hope i'm in the right forum. I have tomcat installed
    on my pc and need to write a few servlets ok. But
    when I compile I get an error message saying"package
    javax.servlet.* not found". I can't understand why
    any ideas as i'm reallly stumped. Is it a tomcat
    issue of a vm issue as i have the J2SE5 running on my
    machine.
    Stonethe javax.servlet package is not part of jse, as you've already discovered.
    tomcat does supply it in the common/lib/servlet-api.jar. put that in your classpath when you compile and you'll get past this problem.
    %

  • Servlet and Actions - Apache Struts !

    Hi,
    i defined an ActionServlet in the web.xml and some "Actions" in the struts-config.xml.
    If all the requests are managed by the servlet defined in the web.xml, in case i had a lot of requests would it be better defined more ActionServlet in the web.xml which refers to different struts-config.xml ?
    I think that having more servlet is much better to manage the load of the entire application.
    Any suggestions ?
    Cheers.
    Stefano

    No need creating more than one ActionServlet : Servlets are Threads so each request made by a client is handled by a different Thread!

  • Problem with JSP and servlet in Tomcat

    hello all,
    I have made a simple hello world in Eclipse and Tomcat, it works well on my localhost, but now that I try to run it on the server in our lab I got this exception:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Implementing class
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.IncompatibleClassChangeError: Implementing class
         java.lang.ClassLoader.defineClass1(Native Method)
         java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
         org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:869)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1322)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
         org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:127)
         org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65)
         java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         java.lang.Class.getDeclaredConstructors0(Native Method)
         java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
         java.lang.Class.getConstructor0(Class.java:2640)
         java.lang.Class.newInstance0(Class.java:321)
         java.lang.Class.newInstance(Class.java:303)
         org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:148)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    I have transfered the web.xml file and lib and classes folder in a WEB-INF folder and also all the JSP files. I can see he JSP file, but the 'hello worl' does not work and gives this exception!
    Does any one have any idea what could be the problem?
    thanks a lot
    Mitra

    seems the web Server code previously loaded a class only when it was used rather than when it was referenced,
    ask your question in the tomcat-user mailing ! !!!

  • Why do I need to restart Apache and Tomcat every time a java file is change

    If a java file is changed and complied the changes are not reflected if Tomcat is not restarted.
    The settings in server.xml are as:
    <!-- Tomcat Manager Context -->
    <Context path="/manager" docBase="manager" debug="0" privileged="true"/>
         <Context path="/cf" docBase="cf" debug="0" reloadable="false"/>
    Here "cf" is my Application folder under webapps. The reloadable property when set to "true" for standalone Tomcat on Windows98 reflects the changes for compiled java files without restarting Tomcat. But on Linux 7.1 with Apache 1.3.19 and Tomcat 4.0.3 this is not working.
    Also tried out with Manager Application of tomcat-users.xml with reloadable="false" as well as reloadable="true",
    But when I reload the application using the command
    http://servername:8080/manager/reload?path=/appli.name
    It tells me that the application is reloaded but changes in the java file are still not reflected.
    Also when reloaded through Manager Servlet, Only my load-on-startup servlet is reloaded, but other java classes are not.
    Is it neccessary to execute this reload command from the server itself. I m executing it from a remote m/c. and have mapped the application with a domain name virtually.
    Is it the case with Tomcat on Linux with Apache. Or is something going wrong on my part.
    Can someone Help out plz.
    Regards,
    Rupali

    or you can "touch" your web.xml file.
    touch web.xmlor that command is for *nix systems, not sure what the Windows command is.  But basically, when you edit the web.xml, even if it means updating the last modified time, it will restart only your application and you should see the changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Oracle9i Apache Server and Tomcat

    Hi,
    Currently I have an Oracle9i database installed which has it's own Apache Webserver installed but I don't use it. Instead I am using the latest version of Apache in another directory. What I would like to do is upgrade the version of Apache that came with the Oracle9i database installation and then delete the extra Apache Webserver I am using now? Is it as simple as replacing the contents of the ORACLE_HOME/Apache/Apache folder?
    I also use Tomcat to serve up the servlets and JSP's...does Oracle9i have anything similar to Tomcat already integrated? If not could I install Tomcat into the ORACLE_HOME/Apache folder instead of having it reside in another directory?
    TIA.

    What I would like to do is upgrade the version of Apache that came with the Oracle9i database installation and then delete the extra Apache Webserver I am using now? Is it as simple as replacing the contents of the ORACLE_HOME/Apache/Apache folder?
    r.- why do you want to do that if the Apache that comes with Oracle has more resources than the another Apache ?
    also use Tomcat to serve up the servlets and JSP's...does Oracle9i have anything similar to Tomcat already integrated?
    r.- tell me exactly what you can carry out in the web server and I will be able to tell you how do it.
    Joel Pérez

  • Apache HTTP server and Tomcat integration using mod_jk

    Hi, I'm trying to get Apache version 2 Server running with Tomcat 7 as the Java Servlet container (I'll be using Solr as the webapp next). Followed the instructions in the wiki articles Tomcat and Apache and Tomcat.
    The applications work fine separately. It's only when I modify the httpd.conf files as instructed that I get this error when I restart httpd and tomcat. This problem seems identical to this topic although the user that posted it does't know how he fixed the problem.
    Terminal wrote::: Starting Apache Web Server                                                                        [BUSY]
                               /usr/sbin/apachectl: line 84:  8640 Bus error               $HTTPD -k $ARGV       [FAIL]
    The only bit that I didn't follow to the letter is the part where it says to set TOMCAT_JAVA_HOME=/opt/java \. I have it as
    TOMCAT_JAVA_HOME=/usr/lib/jvm/java-7-openjdk. No idea why it repeats that the java home is in the /opt directory.
    I installed mod_jk from the AUR version 1.2.37-1.
    Any idea what the problem is?

    download the binary version of TomCat from
    http://jakarta.apache.org/
    and install it. but your need to set the environment variable...pls refer to
    http://www.amazon.com/exec/obidos/tg/stores/detail/-/books/1861002092/reader/18/ref=lib_dp_TT01/103-9996294-0061449#reader-link
    JSP hava some similarity of ASP. ASP is using Personal Web Server.
    heng

  • Servlet mapping with Apache + Tomcat

    I'm trying to set up my servlet with apache + Tomcat(3.2.3), and i'm using mod_jk as the Tomcat-Apache plug-in.
    The HelloWorld servlet that comes with the examples app worked fine at: http://localhost/examples/servlet/HelloWorldExample,
    but how do I change the configurations, so that it can be invoked at:
    http://localhost/examples/HelloWorldExample ?
    It appears to me that '/servlet/' is the default prefix for Tomcat's RequestInterceptor, there is no way to get around that.
    Any insights will be greatly appreciated, thanks!
    Elaine

    hi
    Try this:
    add below code in web.xml file in examples/WEB-INF
    F directory
    <servlet-mapping>
    <servlet-name>
    HelloWorldExample
    </servlet-name>
    <url-pattern>
    /HelloWorldExample
    </url-pattern>
    </servlet-mapping>
    Thanks for the reply, the web.xml is already set up this way, in fact, I'm able to invoke the servlet through tomcat(running on port 8080): http://localhost:8080/examples/HelloWorldExample,
    tomcat reads the web.xml without any problems.
    The problem comes from Apache(port 80), http://localhost:80/examples/HelloWorldExample wouldn't work, only http://localhost:80/examples/servlet/HelloWorldExample works.
    It appears to me that when requests are relayed from Apache to tomcat, you need to tell tomcat that you intend to invoke a servlet by prefixing '/servlet/', if you look in the server.xml, it has
    <RequestInterceptor
    className="org.apache.tomcat.request.InvokerInterceptor"
    debug="0" prefix="/servlet/" />
    I've tried to change this to something else, it didn't seem to make any difference.

  • Calling a servlet (in Tomcat) from a JSP Page (in Apache)

    I have a web form in my JSP Page, which upon submits, will send the params to a servlet. The servlet will then process the request and send the results back to the calling JSP Page.
    with that above senario, is there any way for me to reference a servlet (resides in Tomcat) from a JSP Page (resides in Apache HTTP Server)?
    Thanks!

    Apache HTTP server isn't a servlet/JSP engine.
    Your JSP runs on Tomcat, right where the servlet does. Apache just forwards the request.
    %

  • Install Apach web server and Tomcat

    Is it possible to install Apach web server and Tomcat into Oracle Application Server?
    If possible, which way is the best? People said that I would better install Apach web server and Tomcat in Redhat.
    If you know the answer, would you mind give me the answer or document link?
    Thanks

    Tomcat is just a servlet engine. Oracle Application Server already includes a servlet engine. Apache is a default component too.

  • Apache server and tomcat

    Today i got from apache website the Apache server 2.0.28 (for windows 2000)
    y tomcat server 5.0 , i dont know how work with them. (how setting?)(what do it?)
    i worked only with tomcat server for show my jsp pages that using servlets-
    but i got access troubles from internet (not localhost), the jsp pages only show parts.
    for that reason i want to use the Apache server and tomcat server together, but how setting
    each one of them, please help me. thanks-

    You know, it also helps if you take the time to respond to requests for more information.
    http://forum.java.sun.com/thread.jsp?thread=473507&forum=45&message=2192194
    I'm sure there were lots of other people wondering exactly which problem you were having, and if you don't answer, but keep creating new posts asking for help, people decide it's just not worth their time and effort to help you.

  • Apache web server / run Servlets and JSP

    Hello. I need to know how to run servlets and JSP's with Apache web server

    install Tomcat and use it alongise of apache. Apache cannot serve either servlets or jsp's on its own

  • Servlets, Threads and ThreadNames and Tomcat!

    Hi gurus's
    I found something interesting but am not sure if this is in the servlet container spec.....
    When a new client request comes in, servlet serves that request on a separate thread. Now I change the thread name for some requests. I found that servlet container (Tomcat 4.1.24 in my case) seems to be reusing the threads to serve client requests. i.e when another request comes in (after the first request has finished) the thread name is still set to what I had set it to during the first request....
    This implies that Tomcat actualyl re-uses the threads it creates to serve client requests. I thought that it would create a completely new thread for each request.
    Does anyone know anything about this??? Or is this in the spec for container writers where they start n number of threads and just pool these threads and re-use them to serve client requests???
    I would appreciate your help because this causes problems with my logging mechanism as I rely on unique thread name...

    The servlet specs does not require servlet containers to start a new thread for each request.
    For performance purposes, most, if not all, servlet containers re-use threads to service requests.
    You may want to switch over to the Log4J (http://jakarta.apache.org/log4j) logging mechanism. Its concept of Nested Diagnostic Contexts (NDCs) is much better than relying on the uniqueness of thread names.

Maybe you are looking for

  • Insert called before delete in a collection with unique constraint

    Hi all, I have a simple @OneToMany private mapping: private Collection<Item> items; @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL) public Collection<Item> getItems() { return items; public void setItems(Collection<Item> items) { this.item

  • Problem with wifi conection in XP

    Hi! Win XP was installed in my Macbook, using Bootcamp. All drivers are instaled after winXP was installated, but I can't connect with wifi conection. When I'll try to conect, windows says "much time for conect, out of acces. try again" buy I can't a

  • (Solved) Workflow System Verification Step 4: workitem could not be created

    Hello all We're on R/3 4.7 and I'm trying to get workflow runtime environment up and running. I've already passed through the automatic customizing (SWU3), all is green! When starting the verification workflow I get a mail in my SAP Workplace inbox t

  • The GPU Sniffer crashed...

    My copy of Photoshop CS6 is crashing after startup. I got a crash log and noticed that it says that "The GPU Sniffer crashed". My computer specs are: Windows 7 64-bit Photoshop CS6 (64-bit) Nvidia GeForce 9800 GTX+

  • Learning TopLink??? Where is the documentation???

    We just purchased TopLink. It came on one CD. I installed the entire CD to my workstation and went through all the HTML/PDF documentation and came away scratching my head regarding how to program using TopLink. The digital documentation was FAR too b