Deploying a servlet in tomcat 5.0

I install tomcat 5.0 in my pc
I can run HelloWorldExample in browser using the following URL:
http://localhost:8080/servlets-examples/servlet/HelloWorldExample
I copy the HelloWorldExample.class into folder :
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes
I also change the web.xml (path -- C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF)to include the following:
<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>
<servlet>
<servlet-name>HelloWorldExample</servlet-name>
<servlet-class>HelloWorldExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HelloWorldExample</servlet-name>
<url-pattern>/HelloWorldExample</url-pattern>
</servlet-mapping>
but when I type http://localhost:8080/servlet/HelloWorldExample I go an error 404 The requested resource/servlet/HelloWorldExample) is not available.
I set the JAVA_HOME to j2sdk folder C:\j2sdk1.4.2_04\
Am I missing sth in classpath?
And in tomcat 5.0, it is a must to specify all servlet in web.xml?
Is there any way I just copy the class into the folder and no need to specify the name in web.xml?
Thank you in advance!

Hi there,
actually I can run the example servlet by:
http://localhost:8080/servlets-examples/servlet/HelloWorldExample
today I change the web.xml in conf folder, I enable the following lines which are originally remarked:
(original line 90 to 102)
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
(original line 319 to 324)
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
then I have the following error when I type:
HTTP Status 500
java.util.MissingResourceException: Can't find bundle for base name LocalStrings, locale zh_TW
     java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
     java.util.ResourceBundle.getBundleImpl(Unknown Source)
     java.util.ResourceBundle.getBundle(Unknown Source)
     HelloWorldExample.doGet(HelloWorldExample.java:39)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
     org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
     org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
what should I do?
Thank you!

Similar Messages

  • To Deploy a Servlet using Tomcat

    I am trying to deploy an example servlet in tomcat.
    my example servlet code is
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    public class HitServlet extends HttpServlet {
    private int mCount;
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String message = "Hits: " + ++mCount;
    response.setContentType("text/plain");
    response.setContentLength(message.length());
    PrintWriter out = response.getWriter();
    out.println(message); } }
    i 've placed my servlet in the directory
    webapps/midp/WEB-INF/classes/HitServlet.java
    i've successfully compiled the code. Then started the tomcat server & thro' IE tried to open the url to http://localhost:8080/midp/hits.
    but i 'm receiving the error the servlet bob is missing. i've placed the web.xml & server.xml in the folders specified in the tutorial. in server.xml i've added the code
    <Context path="/midp" docBase="midp" debug="0" reloadable="true" privileged="true"/>
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?> <!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>bob</servlet-name> <servlet-class>HitServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>bob</servlet-name> <url-pattern>/hits</url-pattern> </servlet-mapping> </web-app>
    If u can guide me to deploy the servlet it'll be very helpfull.
    With Best Regards
    Ramkumar

    one idea that I have is the CATALINA_HOME and CATALINA_BASE.
    We use CATALINA_BASE to install our stuff in another directory than that of the tomcat installation.
    in the tomcat-engine.log you should se sth similar to:
    2003-06-18 09:19:04 StandardHost[localhost]: Installing web application at context path /hits from URL file:<xxx/webapps/midp>
    2003-06-18 09:19:04 WebappLoader[/gtfn]: Deploying class repositories to work directory $CATALINA_BASE/work/Apache/localhost/gtfn
    ...

  • Deploy a servlet in Tomcat

    Hi,
    I am trying to deploy a servlet in Tom cat.
    I could not access the servlet after deployment. Plz help me.
    Here is my servlet code.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class ProcessData extends HttpServlet
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException, NumberFormatException
         res.setContentType("text/html");
         PrintWriter out = res.getWriter();
         out.println("I am in Servlet");
    I compiled it and copied the class file into the
    Tomcat classes (WEB-INF directory) folder.
    and made an entry in web.xml as,
    <servlet>
    <servlet-name>SendData</servlet-name>
    <servlet-class>SendData</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>SendData</servlet-name>
    <url-pattern>servlet/SendData</url-pattern>
    </servlet-mapping>
    WEB_INF is present here,
    D:\tomcat\tomcat-jwsdp-1.4\webapps\servlets-examples\WEB-INF
    I am trying to access the servlet by using,
    http://localhost:8888/servlets-examples/servlet/SendData

    Hi,
    I am getting this error....
    HTTP Status 404 - /servlets-examples/servlet/SendData
    type Status report
    message /servlets-examples/servlet/SendData
    description The requested resource (/servlets-examples/servlet/SendData) is not available.
    Thx,
    Babloo

  • Problem to deploy ADF application on tomcat server

    Hi all,
    i 'm using this tutorial link to deploy adf application on tomcat server.
    https://blogs.oracle.com/dana/entry/how_to_deploy_a_11g_adf_applic_1
    but when i have run my application i have got following error
    java.sql.SQLException: invalid arguments in call
    log-
    Jul 29, 2013 11:35:16 AM com.sun.faces.config.ConfigureListener contextInitialized
    INFO: Initializing Sun's JavaServer Faces implementation (1.2_04-b07-FCS) for context '/TestApacheApp_ViewController_webapp1'
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack contextInitialized
    SEVERE: ADFConnection mbean not registered for defaultApplicationName.
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack contextInitialized
    SEVERE:
    oracle.jrf.UnknownPlatformException: JRF is unable to determine the current application server platform.
      at oracle.jrf.ServerPlatformSupportFactory.getInstance(ServerPlatformSupportFactory.java:79)
      at oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack.contextInitialized(ADFConnectionLifeCycleCallBack.java:82)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)
      at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:243)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
      at java.lang.Thread.run(Thread.java:662)
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack contextInitialized
    SEVERE: Failed to register config mbean for defaultApplicationName.
    Jul 29, 2013 11:35:19 AM oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack contextInitialized
    SEVERE:
    oracle.jrf.UnknownPlatformException: JRF is unable to determine the current application server platform.
      at oracle.jrf.ServerPlatformSupportFactory.getInstance(ServerPlatformSupportFactory.java:79)
      at oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack.contextInitialized(ADFConfigLifeCycleCallBack.java:79)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)
      at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:243)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
      at java.lang.Thread.run(Thread.java:662)
    Jul 29, 2013 11:35:19 AM oracle.bc4j.mbean.BC4JConfigLifeCycleCallBack contextInitialized
    SEVERE: Not able to get Deployment Name
    Jul 29, 2013 11:35:28 AM oracle.adfinternal.controller.state.ControllerState initializeRequest
    WARNING: ADFc: Deserialization of session state detected but ADF scope HA support is not enabled.  Please enable ADF scope HA support in the adf-config.xml file to ensure correct functioning of your applicaiton.
    Jul 29, 2013 11:35:28 AM oracle.adf.share.http.ServletADFContext initialize
    WARNING: Found wrong applictionScope sticking to oldContext for oldApplication defaultApplicationName, while the current one is null
    Jul 29, 2013 11:35:28 AM oracle.jbo.uicli.mom.CpxUtils$Visitor logMainApplicationCpx
    INFO: jndi:/localhost/TestApacheApp_ViewController_webapp1/WEB-INF/classes/com/in/jagran/view/DataBindings.cpx
    Jul 29, 2013 11:35:28 AM oracle.adf.share.jndi.MDSBackingStore documentExists
    INFO: MDS-00013: no metadata found for metadata object "/META-INF/connections.xml"
    Jul 29, 2013 11:35:32 AM oracle.adf.share.http.ServletADFContext initialize
    WARNING: Found wrong applictionScope sticking to oldContext for oldApplication defaultApplicationName, while the current one is null
    Jul 29, 2013 11:35:33 AM oracle.adf.share.http.ServletADFContext initialize
    WARNING: Found wrong applictionScope sticking to oldContext for oldApplication defaultApplicationName, while the current one is null
    Jul 29, 2013 11:35:47 AM org.apache.coyote.http11.Http11AprProtocol pause
    INFO: Pausing Coyote HTTP/1.1 on http-8086
    Jul 29, 2013 11:35:47 AM org.apache.coyote.ajp.AjpAprProtocol pause
    INFO: Pausing Coyote AJP/1.3 on ajp-8009
    Jul 29, 2013 11:35:48 AM org.apache.catalina.core.StandardService stop
    INFO: Stopping service Catalina
    Jul 29, 2013 11:35:48 AM org.apache.coyote.http11.Http11AprProtocol destroy
    INFO: Stopping Coyote HTTP/1.1 on http-8086
    Jul 29, 2013 11:35:48 AM org.apache.coyote.ajp.AjpAprProtocol destroy
    INFO: Stopping Coyote AJP/1.3 on ajp-8009

    There is no guideline I know of as this depends on the app itself.
    What you should do is to deploy the application onto a test server and check the metrics of the app over a defined period of time with a defined amount of traffic.
    Timo

  • How to deploy EAR file in Tomcat?

    Is we can deploy ear file in tomcat?
    Normally we can deploy WAR file in tomcat webapps folder. When we run the tomat it will automatically extract the war file.
    But samethink I have tried EAR file. But it is not working.
    Is we can deploy EAR file or not?
    If not plz give reason.

    Hi
    Normally we can deploy the war file thats routene stuff ofcourse ..........but when u deploy ear file it will give problmes as ear structure and war structure are differeant
    The Tomcat Servlet/JSP Container      
    The Apache Tomcat 5.5 Servlet/JSP Container
         Apache Logo
    Links
    * Docs Home
    Contents
    * Contents
    * Introduction
    * Installation
    * Deployment
    * Source Code
    * Processes
    * Example App
    Application Developer's Guide
    Deployment
         Printer Friendly Version
    print-friendly
    version
    Background
    Before describing how to organize your source code directories, it is useful to examine the runtime organization of a web application. Prior to the Servlet API Specification, version 2.2, there was little consistency between server platforms. However, servers that conform to the 2.2 (or later) specification are required to accept a Web Application Archive in a standard format, which is discussed further below.
    A web application is defined as a hierarchy of directories and files in a standard layout. Such a hierarchy can be accessed in its "unpacked" form, where each directory and file exists in the filesystem separately, or in a "packed" form known as a Web ARchive, or WAR file. The former format is more useful during development, while the latter is used when you distribute your application to be installed.
    The top-level directory of your web application hierarchy is also the document root of your application. Here, you will place the HTML files and JSP pages that comprise your application's user interface. When the system administrator deploys your application into a particular server, he or she assigns a context path to your application (a later section of this manual describes deployment on Tomcat). Thus, if the system administrator assigns your application to the context path /catalog, then a request URI referring to /catalog/index.html will retrieve the index.html file from your document root.
    Standard Directory Layout
    To facilitate creation of a Web Application Archive file in the required format, it is convenient to arrange the "executable" files of your web application (that is, the files that Tomcat actually uses when executing your app) in the same organization as required by the WAR format itself. To do this, you will end up with the following contents in your application's "document root" directory:
    * *.html, *.jsp, etc. - The HTML and JSP pages, along with other files that must be visible to the client browser (such as JavaScript, stylesheet files, and images) for your application. In larger applications you may choose to divide these files into a subdirectory hierarchy, but for smaller apps, it is generally much simpler to maintain only a single directory for these files.
    * /WEB-INF/web.xml - The Web Application Deployment Descriptor for your application. This is an XML file describing the servlets and other components that make up your application, along with any initialization parameters and container-managed security constraints that you want the server to enforce for you. This file is discussed in more detail in the following subsection.
    * /WEB-INF/classes/ - This directory contains any Java class files (and associated resources) required for your application, including both servlet and non-servlet classes, that are not combined into JAR files. If your classes are organized into Java packages, you must reflect this in the directory hierarchy under /WEB-INF/classes/. For example, a Java class named com.mycompany.mypackage.MyServlet would need to be stored in a file named /WEB-INF/classes/com/mycompany/mypackage/MyServlet.class.
    * /WEB-INF/lib/ - This directory contains JAR files that contain Java class files (and associated resources) required for your application, such as third party class libraries or JDBC drivers.
    When you install an application into Tomcat (or any other 2.2/2.3-compatible server), the classes in the WEB-INF/classes/ directory, as well as all classes in JAR files found in the WEB-INF/lib/ directory, are made visible to other classes within your particular web application. Thus, if you include all of the required library classes in one of these places (be sure to check licenses for redistribution rights for any third party libraries you utilize), you will simplify the installation of your web application -- no adjustment to the system class path (or installation of global library files in your server) will be necessary.
    Much of this information was extracted from Chapter 9 of the Servlet API Specification, version 2.3, which you should consult for more details.
    Shared Library Files
    Like most servlet containers, Tomcat 5 also supports mechanisms to install library JAR files (or unpacked classes) once, and make them visible to all installed web applications (without having to be included inside the web application itself. The details of how Tomcat locates and shares such classes are described in the Class Loader HOW-TO documentation. For the purposes of our discussion, there are two locations that are commonly used within a Tomcat 5 installation for shared code:
    * $CATALINA_HOME/common/lib - JAR files placed here are visible both to web applications and internal Tomcat code. This is a good place to put JDBC drivers that are required for both your application and internal Tomcat use (such as for a JDBCRealm).
    * $CATALINA_BASE/shared/lib - JAR files placed here are visible to all web applications, but not to internal Tomcat code. This is the right place for shared libraries that are specific to your application.
    Out of the box, a standard Tomcat 5 installation includes a variety of pre-installed shared library files, including:
    * The Servlet 2.4 and JSP 2.0 APIs that are fundamental to writing servlets and JavaServer Pages.
    * An XML Parser compliant with the JAXP (version 1.2) APIs, so your application can perform DOM-based or SAX-based processing of XML documents.
    Web Application Deployment Descriptor
    The description below uses the variable name $CATALINA_HOME to refer to the directory into which you have installed Tomcat 5, and is the base directory against which most relative paths are resolved. However, if you have configured Tomcat 5 for multiple instances by setting a CATALINA_BASE directory, you should use $CATALINA_BASE instead of $CATALINA_HOME for each of these references.
    As mentioned above, the /WEB-INF/web.xml file contains the Web Application Deployment Descriptor for your application. As the filename extension implies, this file is an XML document, and defines everything about your application that a server needs to know (except the context path, which is assigned by the system administrator when the application is deployed).
    The complete syntax and semantics for the deployment descriptor is defined in Chapter 13 of the Servlet API Specification, version 2.3. Over time, it is expected that development tools will be provided that create and edit the deployment descriptor for you. In the meantime, to provide a starting point, a basic web.xml file is provided. This file includes comments that describe the purpose of each included element.
    NOTE - The Servlet Specification includes a Document Type Descriptor (DTD) for the web application deployment descriptor, and Tomcat 5 enforces the rules defined here when processing your application's /WEB-INF/web.xml file. In particular, you must enter your descriptor elements (such as <filter>, <servlet>, and <servlet-mapping> in the order defined by the DTD (see Section 13.3).
    Tomcat Context Descriptor
    The description below uses the variable name $CATALINA_HOME to refer to the directory into which you have installed Tomcat 5, and is the base directory against which most relative paths are resolved. However, if you have configured Tomcat 5 for multiple instances by setting a CATALINA_BASE directory, you should use $CATALINA_BASE instead of $CATALINA_HOME for each of these references.
    A /META-INF/context.xml file can be used to define Tomcat specific configuration options, such as loggers, data sources, session manager configuration and more. This XML file must contain one Context element, which will be considered as if it was the child of the Host element corresponding to the Host to which the The Tomcat configuration documentation contains information on the Context element.
    Deployment With Tomcat 5
    In order to be executed, a web application must be deployed on a servlet container. This is true even during development. We will describe using Tomcat 5 to provide the execution environment. A web application can be deployed in Tomcat by one of the following approaches:
    * Copy unpacked directory hierarchy into a subdirectory in directory $CATALINA_HOME/webapps/. Tomcat will assign a context path to your application based on the subdirectory name you choose. We will use this technique in the build.xml file that we construct, because it is the quickest and easiest approach during development. Be sure to restart Tomcat after installing or updating your application.
    * Copy the web application archive file into directory $CATALINA_HOME/webapps/. When Tomcat is started, it will automatically expand the web application archive file into its unpacked form, and execute the application that way. This approach would typically be used to install an additional application, provided by a third party vendor or by your internal development staff, into an existing Tomcat installation. NOTE - If you use this approach, and wish to update your application later, you must both replace the web application archive file AND delete the expanded directory that Tomcat created, and then restart Tomcat, in order to reflect your changes.
    * Use the Tomcat 5 "Manager" web application to deploy and undeploy web applications. Tomcat 5 includes a web application, deployed by default on context path /manager, that allows you to deploy and undeploy applications on a running Tomcat server without restarting it. See the administrator documentation (TODO: hyperlink) for more information on using the Manager web application.
    * Use "Manager" Ant Tasks In Your Build Script. Tomcat 5 includes a set of custom task definitions for the Ant build tool that allow you to automate the execution of commands to the "Manager" web application. These tasks are used in the Tomcat deployer.
    * Use the Tomcat Deployer. Tomcat 5 includes a packaged tool bundling the Ant tasks, and can be used to automatically precompile JSPs which are part of the web application before deployment to the server.
    Deploying your app on other servlet containers will be specific to each container, but all containers compatible with the Servlet API Specification (version 2.2 or later) are required to accept a web application archive file. Note that other containers are NOT required to accept an unpacked directory structure (as Tomcat does), or to provide mechanisms for shared library files, but these features are commonly available.
    Copyright © 1999-2006, Apache Software Foundation

  • Deploying war file on Tomcat: file path problem

    Hello all,
    i am using my eclipse ide for automatically deploy my webapplication to Tomcat. For Database connectivity i configured hibernate. To configure hibernate i am using the following code:
    package de.wfm.hibernate.hibernateUtil;
    import org.hibernate.HibernateException;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    public class ESDBFactory {
         private static SessionFactory sf;
         private static Session session = null;
         private static String pathToCfgFile = "de\\"
                             + "wfm\\hibernate\\hibernateUtil\\esdb.cfg.xml";
         public static synchronized Session getSession() throws HibernateException {
              if (session==null) {
                   if (sf==null) {
                        sf = new Configuration()
                             .configure(pathToCfgFile).
                             buildSessionFactory();
              session = sf.openSession();
              return session;
    }When i use this in the ide all is fine. But when i export my application to a war file and deploy it on Tomcat i got the exception:
    2006-07-28 10:06:10 StandardWrapperValve[Urlaubsplanung Servlet]: Servlet.service() for servlet Urlaubsplanung Servlet threw exception
    javax.faces.FacesException: #{User.doLogin}: javax.faces.el.EvaluationException: org.hibernate.HibernateException: de\wfm\hibernate\hibernateUtil\esdb.cfg.xml not foundHow to avoid this? What do i have to do to set the file path correctly?
    Regards,
    ak

    hmm.. ic
    The .war file when drop in the webapps dir and u restart tomcat, it auto create a dir with your .war filename and the content of .war file is copied to there.
    Am i rite to say so?
    And wat about the web.xml?
    If i need to add users and password how can I accomplished it in tomcat web.xml?
    Last but not least, thanks for taking the time to reply. :D

  • How to Run servlet in Tomcat 5.5.9

    hi
    How to run servlet in tomcat 5.5.9?how to set context path in server.xml of conf folder in tomcat since there is no context tag in server.xml.
    Jiten

    Hi ! I have a similar problem, well, it's along the same line ...
    I'm using NetBeans 4.1, and i've coded a servlet. Using NetBeans to launch my servlet (with the bundled Tomcat 5.5.7) works fine, however i need to deploy my application unto a Tomcat 5.5.9 server.
    Thus, i copied the WAR file generated by NetBeans into the Tomcat 5.5.9 webapps directory, and Tomcat expands it.
    Problem is when i run my JSP pages with the form tags, they do not work on the Tomcat 5.5.9 environment. Anyone knows why?
    (These work on the NetBeans Tomcat bundle 5.5.7)
    My form action :
    <form name="index" method="get" action="PageServlet">
    My web.xml :
    <servlet>
    <servlet-name>PageServlet</servlet-name>
    <servlet-class>application.PageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>PageServlet</servlet-name>
    <url-pattern>/PageServlet</url-pattern>
    </servlet-mapping>
    I'm really stumbed on why it doesn't work in Tomcat 5.5.9, any help is greatly appreciated, thanks in advance ^_^

  • How to run a servlet in Tomcat 5.0 server

    HI Everybody,
    I want to know how to run the servlet file on my tomcat 5.0 server. that is where to place a class file and deployment details.
    Thanks In ADVANCE

    Sourav_cs wrote:
    I am a biginner to start servlet i get confusion to configure servlet in tomcat 5 where it should be saved in tomcat directory and how to execute that as first timeHi,
    goto
    tomcat 5.0\webappsnow create a folder here. this is your webapplication project name. Let's suppose it as "TestApp"
    inside this create directories as follows :
    TestApp
            |
            |-----JSP/htmls( if you have any )
            |
            |-----WEB-INF(File Folder)
                       |
                       |-----web.xml
                       |-----lib ( Directory. place all the .jar files which are required for this project(if any) )
                       |-----classes ( .class files. )[all of your java code should be placed here.](servlets / beans/ pojo )this is the general Directory structure of a web application. now you've to place the compiled .class file of your servlet in the "TestApp\WEB-INF\classes" directory. make sure that you've configured the servlet in Deploment Desctiptor, i.e, web.xml.
    now start the server and type the url like : "http://localhost:8080/TestApp/TestServlet"
    the port no. 8080 is the default port no. of tomcat. you have to give your port no. if u've modified it. and TestServlet is the <url-pattern> of your servlet.
    go through some tutorials .. then you can easily know that
    Diablo

  • Is it possible to deploy Web Services to Tomcat?

    Good day,
    Can anybody tell me or it is possible to deploy Web Services to Tomcat 5.5.x ? It is possble for ADF, so I was wondering or it is possble for Web Services.
    I tried to deploy it with the following libraries:
    J2EE (excluding the servlet.jar using the filter, while this package is already present in Tomcat)
    Oracle SOAP
    Struts Runtime
    JSP Runtime
    and manually added as library:
    wsserver.jar
    wsdl.jar
    WebServicesHtmlXmlWizard.jar
    The situation at this moment is that after deployment, and execution by the a http browser the http request screens shows up as expected (I have been used Embedded stubs), but after sending I get a:
    28-Sep-2005 11:03:36 org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet MyWebService1 threw exception
    java.lang.NoClassDefFoundError: oracle/aurora/ncomp/java/ClassNotFound
         at oracle.j2ee.ws.StatelessJavaRpcWebService.getGenerator(StatelessJavaRpcWebService.java:28)
         at oracle.j2ee.ws.RpcWebService.generateWrapperClass(RpcWebService.java:461)
         at oracle.j2ee.ws.RpcWebService.generate(RpcWebService.java:414)
         at oracle.j2ee.ws.RpcWebService.getWrapper(RpcWebService.java:532)
         at oracle.j2ee.ws.RpcWebService.doGetRequest(RpcWebService.java:631)
         at oracle.j2ee.ws.BaseWebService.doGet(BaseWebService.java:1173)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)
    Any sugestions? Or is there a different behaviour between Oracle en Tomcat version caused by modifications from the apache source.
    I should appreciate it to get some more details about this issue.

    JDeveloper will only directly support deployment of web services to an Apache 2.2 Web Server.

  • Jar not loaded Error when deploying weblogic.jar in tomcat

    Hi experts,
    This time i have one more problem,
    i have deployed my application in tomcat such that when tomcat starts my java program also gets started, for my java program i had to use a weblogic library which is in "web-inf / lib / weblogic.jar" . but when i start tomcat i get error like
    INFO: validateJarFile (C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\MyApp\WEB-INF\lib\weblogic.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    Dec 4, 2006 8:27:18 PM org.apache.catalina.core.StandardPipeline registerValve
    INFO: Can't register valve org.apache.catalina.core.StandardContextValve@1362012
    org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1bc82e7 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1bc82e7
    for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
            at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
    what could be the problem in loading weblogic.jar
    my platform configuations are
    TOMCAT 5.5
    OS - windows 2000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

              have u done the servlet naminga and mapping in the web.xml file??
              Kumar Allamraju <[email protected]> wrote:
              ><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
              ><html>
              >Have you registered the servlet in web.xml?
              ><p>--
              ><br>Kumar
              ><p>Deepak Balakrishna wrote:
              ><blockquote TYPE=CITE>Hi.
              ><p>I am having trouble deploying a servlet to WLS 6.1
              ><p>a) The name of the servlet is HaServlet and it's duly noted in web.xml
              ><br>b) I created a directory
              ><br>config/examples/applications/cluster-servlet/WEB-INF
              ><br>c) Added web.xml under WEB-INF/. web.xml was created using the weblogic
              ><br>DDInit CLI
              ><br>d) Added the servlet classfile (HaServlet.class) under
              ><br>WEB-INF/classes/samples/cluster/servlet/.
              ><br>e) Tried to access it by http://host:port/cluster-servlet/HaServlet
              ><p>I get
              ><br>Error 404--Not Found
              ><p>What am I missing? I also tried restarting the app server to no avail.
              ><p>Thx,
              ><br>- deepak</blockquote>
              ></html>
              >
              

  • Execute a servlet in tomcat

    hai friends,
    I am trying to execute a simple servlet in tomcat but I couldn't..
    please help me

    Can you execute the default Servlets in Tomcat which are found in the "Examples" folder ? http://localhost:<PORT NO>/examples/
    If yes then try deploying your servlet in the examples folder and find out a file called "servlet.jar " in your server and set its classpath.
    I hope that will work.
    Shashi

  • How to DEPOLY servlet to TOMCAT

    Hi,
    I try to run Servlet from TOMCAT, but it has error. Please give me some help!
    The Servlet is to access Oracle DB. V8i. from the Travel DB that I download from Oracle site. I use Jdeveloper 3.1.1.2 to create this project. It compiles and runs fine in Jdeveloper. When I try to deploy it to TOMCAT, it has the following error message:
    Error: 500
    Location: /examples/servlet/test/test
    Internal Servlet Error:
    java.lang.NullPointerException
    at java.lang.ClassLoader.resolveClass0(Native Method)
    at java.lang.ClassLoader.resolveClass(ClassLoader.java:588)
    at org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.java:430)
    at org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoader.java:174)
    at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:265)
    at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
    at org.apache.tomcat.core.Handler.service(Handler.java:254)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
    at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
    at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
    at java.lang.Thread.run(Thread.java:484)
    It looks to me like Tomcat cannot fine the lib files.
    Also, the test.jar deployment file has sub directory. If I unzip them to F:\tomcat\jakarta-tomcat-3.2\webapps\examples\WEB-INF\classes, it will create several sub directories and jar files. How can I run the test.class file, if the file is in a sub directory say myproject? Can Tomcat get the lib and attachment file from all the sub directory?
    Thanks very much.
    kenny
    null

    You need to include the Oracle db jars (see your project properties) in your tomcat enviroment..
    This is done on Windows by changing the classpath section of tomcat-dir\bin\tomcat.bat. On Unix this is done simply by dropping the jar file in the tomcat-dir/lib directory.
    /Christian Bjxrnbak

  • How to run a servlet in tomcat 5.0.

    Hi all,
    how to run a servlet in tomcat 5.0
    please tell me the entire procedure....(directory structure)
    step by step....

    hi :-)
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
    or
    http://www.google.com.ph/search?hl=en&q=java+servlet+tutorial&btnG=Google+Search&meta=
    regards,

  • How can i deploy a servlet with eclispe

    Hello,
    will any one of u give me the steps to deploy a servlet with eclipse on portal server(J2EE Engine),
    in help of eclipse they given as, whole webapplication deployement, but that is also giving me a error, the procedure they given is, once we created a .war file for our servlet project we need to refer this to a .Ear file, and then this Ear can be deployed in to the server. Is it the same and only procedure to deploy a servlet with eclipse, or if there is any other method,please give me the steps also.
    when i am deploying with the .Ear file, it is giving the error as,
    Jun 4, 2005 11:34:31 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Deployment exception : Cannot determine sdm host (is empty). Please configure your engine/sdm correctly !
    but the sdm is working on the server with the same host, and local deployement is also done successfully, but from my system im not able to deploy!
    Thanks&Regards,
    Sireesha.

    Yeah, i am able to see the J2EE engine clusters, there the message server port is given as 3601. becoz scs instance number is 1 here. so it is not the problem,
    the error it is giving as,
    Jun 6, 2005 11:37:28 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Settings
    SDM host : obtdev9
    SDM port : 50018
    URL to deploy : file:/C:/DOCUME1/sireesha.b/LOCALS1/Temp/temp56446MyServletEAR.ear
    Deployment exception : Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
    Inner exception was :
    Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
    is this may be the problem with port number?
    i am not knowing what is happening here...
    if you know the exact error based on the error messgae please help me,
    thanks to u for helping in this problem,
    Regards,
    sireesha.

  • How to embed URL of deployed java servlet into Android code

    I have deployed my servlet code on cloud which access the database cloud , but when i try to access the URL of deployed application , it asks for my credentials (username and password)....
    Now that i want to embedd my servlet link on cloud to my android app code , how to escape the credentials , or is their any way so that i can add my username and password in my servlet code itself. This is my servlet code and it is working fine..
    Context ctx = null;
            Hashtable ht = new Hashtable();
            ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            Connection conn = null;
            Statement stmt = null;
            ResultSet rs = null;
            // out.print("system");
            try {
                ctx = new InitialContext(ht);
                javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("javatrial5196db");
              //  out.print(ds.toString());
                conn = ds.getConnection();
                stmt = conn.createStatement();
                rs = stmt.executeQuery("select * from test");
                while (rs.next()) {
                    out.println(rs.getString("id") + "   " + rs.getString("password") + "<br>");
                conn.close();
                stmt.close();
            } catch (Exception e) {
                out.print(e);

    What is the intended behavior here, how will the user be authenticated if credentials are not obtained from the user ? By default the JCS applications will be secured and the system will prompt for login, you can disable the login by adding "<login-config/>". You can also configure the authentication to use BASIC / FORM authentication instead. Hard coding credentials to servlet / DB table does not sound like a good solution to me though.. For details on security refer to this document.
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

Maybe you are looking for