Calss path in tomcat

Is there anyway to put the classes not in the standart classes lib (WEB-INF\classes) and configure the new location??

You are aware of WEB-INF/lib too, aren't you? That is on application level.
Besides, the server itself has locations for common usage. Cf. the documentation. Watch out, some libs are used by the engine itself and not by the very applications.

Similar Messages

  • Figure out the output path in tomcat

    I have the Java servlet to produce text file, and it produces to C:\hello.txt,
    but I want to output in the current directory as the Java File:
    i.e. C:\jakarta-tomcat-4.1.30\webapps\ExtendedGUI\WEB-INF\classes
    How to get the path of current directory?
    try
         PrintWriter out = new PrintWriter(new FileWriter("hello.txt"));
         out.println("HELLO");
         out.close();
    catch(IOException e)
    any ideas?? Thanks!!

    import java.io.*;
    try this way
    public class Filer{
    public static void main(String []args)
    try
    String PATH="C:/MyPath/Myfolder/";
    PrintWriter out = new PrintWriter(new FileWriter(PATH+"hello.txt"));
    out.println("HELLO");
    out.close();
    catch(IOException e)
    Hope this solves your problem
    }

  • Where exactly does the path in Tomcat start?

    I am trying to create a jsp page that outputs a random image. The jsp page is directly in ROOT. The image files are in ROOT/img/random/.
    What I did was write a simple java class(not a servlet) to read the contents of random and then just randomly choose an image in that file. This class is in ROOT/WEB-INF/classes/com/utilities/, where the package is com.utilities.
    My question is what is the proper path to the images so the java program can read its contents?
    null

    Thanks, but that really doesn't answer my question.Then ask your real question, because that's the right
    answer.
    I
    need File to be able to access files under Tomcatand
    no matter what path I try it can't read it.exists()
    always returns false. I just need to know the path.I
    will eventually move it out of ROOT, but theproblem
    I am having will still exist in any other folder
    under webapps.Wrong, wrong, wrong.Right, right, right. How do I know this? Because I tried it
    >
    I tried to put this outside of ROOT, but Tomcatwill
    not automatically redirect to that page, using the
    instructions at the Tomcat site for changing the
    default start page. Neither does using a simplehtml
    page to redirect.The correct way to access a file in a web context is
    to use the servlet context and its
    getResourceAsStream method. That way you can find it
    as long as it's in the CLASSPATH. Put the file in
    your WEB-INF/classes directory and you'll be able to
    read it. It'll work in a WAR file or in exploded
    mode. It's portable, too.This is wrong. I put that image file in classes, guess what? It still can't read the file!!!!
    >

  • Add ing to the calss path???

    HI your all going to laugh but I never done it.
    Im making an XML program and need to "make sure teh XML parser classes are in the class path".
    Can anyone tell me how this is done. ?
    Thanks
    from someone who should know better. :)

    ok so heres my class patch so far
    C:\JET\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRo
    t%\System32\Wbem;C:\Program
    Files\Symantec\pcAnywhere\;C:\BORLAND\BCC55\BIN;Er - hold on a minute! Right place, wrong variable!
    That looks more like a PATH then a CLASSPATH to me.
    PATH is the windows variable that tells it where to look for executable files.
    CLASSPATH is a java variable telling it where it can load classes from.
    These things are not the same. Putting xerces.jar into your PATH will just confuse your poor computer.
    If you are going to create one of these things, you have to create a new CLASSPATH variable.
    CLASSPATH = .;C:\j2sdk1.4.2_02/lib/xerces.jar;
    This is the base one you will need
    . = current directory
    xerces.jar for the XML stuff
    If you are writing servlets etc, you will probably want to include servlet.jar or j2ee.jar in here as well.
    I kinda agree with duffymo that setting a CLASSPATH should be done on a per project basis, but if you're gonna do it, you may as well do it properly.
    Cheers,
    evnafets

  • How to set tomcat server path in windows XP

    hi frnds,
    I am new to java technologies.I am trying to learn all alone Hw am wandering how to set class path of tomcat server in windows xp.
    it shud be in user varibles r system varibles
    Thanks everyone in advance,
    cheers........
    roopa

    What exactly are you trying to accomplish here?

  • Tomcat 4/Apache 2: Are spaces in include path a problem?

    Hi,
    Like so many before me, I am trying to make TOMCAT 4.0.4 and Apache 2.0.39 play together on Windows 2000, and am failing miserably. I followd several different approaches with no success. When I place the include directive in httpd.conf, Apache won't start.
    All of my paths to TOMCAT have spaces in them ("Program Files/Apche..."). Is this an issue? Other than that, I have no idea why it isn't working.
    Here is what I have done:
    -Downloaded mod_jk.dll and placed it in Apache/modules directory
    -Created a workers.properties file
    -Created a mod_jk.conf file
    Any help appreciated!
    - j

    If you are having difficulty with the Tomcat portion of the set-up try this guide;
    http://www.moreservlets.com/Using-Tomcat-4.html

  • How do I define my web application path in Tomcat6

    Hi friends,
    Can anybody tell me how to define and where to define my web-application path in tomcat 6 server?
    I absolutely don't want to change any files inside tomcat6\conf\ folder (like its server.xml or context.xml)
    My problem comes in the following scenario:
    i) My Webapplication path is c:\tomcat6\webapps\test-servletii) I have one html form file registration.html in c:\tomcat6\webapps\test-servlet\registration.htmliii) I have a form processing servlet in path c:\tomcat6\webapps\test-servlet\WEB-INF\classes\pkg_register\Process_Registration.classiv) web.xml file inside WEB-INF\ has contents
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       version="2.5">    
    <servlet>
         <servlet-name>Process_Registration</servlet-name>
         <servlet-class>pkg_register.Process_Registration</servlet-class>     
    </servlet>
    <servlet-mapping>
         <servlet-name>Process_Registration</servlet-name>
         <url-pattern>/Process_Registration</url-pattern>
    </servlet-mapping>
    </web-app>PROBLEM : In html <form action="/test-servlet/Process_Registration"> works fine.
    But every time I don't want to give my web application folder name in URLs( not in web.xml or in form action, it should be default relative path).
    I want to give just, <form action="/Process_Registration"> in registration.html file's form action.
    Any help is appreciated.
    Thanks.
    ---Sujoy

    Thanks...
    It solved the problem by putting <form action="Process_Registration"> instead of <form action="/Process_Registration">When I was using <form action="/Process_Registration"> it was directly taking me to
    http://localhost:8888/Process_Registration .
    But, now when i use <form action="Process_Registration"> it takes me to
    http://localhost:8888/test-servlet/Process_Registration which IS CORRECT.
    But, still i don't know why the <form action="/Process_Registration"> was taking me out of my current webapplication path. It should have given me ERROR.
    --Sujoy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with JNI and Tomcat in windows

    Hello guys...
    I have the following problem.
    I used Tomcat 4 and I have following ApiEncriptacion class, in package com.servipag.sts;
    package com.servipag.sts;
    class ApiEncriptacion
         public native String encripta(String texto, String ubicacionLlavePublica, String semilla);
         static
              System.loadLibrary("apisdark");
         public native String desencripta(String texto, String ubicacionLlavePrivada);
         static
              System.loadLibrary("apisdark");
    the LD_LIBRARY_PATH is set in following dir c:\tomcat\bice
    the dll this in the following path = c:\tomcat\bice\apisdark.dll
    I run Tomcat at the following way..
    C:\jdk1.4\bin\java.exe -jar -Djava.library.path="c:\tomcat\bice" -Duser.dir="C:\Tomcat" "C:\Tomcat\bin\bootstrap.jar" start
    but, still appear the error:
    java.lang.UnsatisfiedLinkError: encripta
         at com.servipag.sts.ApiEncriptacion.encripta(Native Method)
         at com.servipag.sts.ServiciosServiPagImpl.rescatarFirma(ServiciosServiPagImpl.java:2143)
         at com.servipag.sts.ServiciosServiPagImpl.pagarCuenta(ServiciosServiPagImpl.java:310)
         at org.apache.jsp.SBCO_0005flogin_0005fbice_0005f4$jsp._jspService(SBCO_0005flogin_0005fbice_0005f4$jsp.java:265)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:536)
    please help me
    Luis Navarro.
    Chile

    ApiEncripatcion.h
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class ApiEncriptacion */
    #ifndef IncludedApiEncriptacion
    #define IncludedApiEncriptacion
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: ApiEncriptacion
    * Method: encripta
    * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    JNIEXPORT jstring JNICALL Java_ApiEncriptacion_encripta
    (JNIEnv *, jobject, jstring, jstring, jstring);
    * Class: ApiEncriptacion
    * Method: desencripta
    * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    JNIEXPORT jstring JNICALL Java_ApiEncriptacion_desencripta
    (JNIEnv *, jobject, jstring, jstring);
    #ifdef __cplusplus
    #endif
    #endif
    ApiEncriptacion.c
    #include "jni.h"
    #include <stdio.h>
    #include "files.h"
    #include "hex.h"
    #include "rsa.h"
    #include "randpool.h"
    USING_NAMESPACE(CryptoPP)
    USING_NAMESPACE(std)
    void GenerateRSAKey(unsigned int keyLength, const char privFilename, const char pubFilename, const char *seed);
    char RSAEncryptString(const char pubFilename, const char seed, const char message);
    char RSADecryptString(const char privFilename, const char *ciphertext);
    JNIEXPORT jstring JNICALL
    Java_ApiEncriptacion_encripta(JNIEnv *env, jobject obj, jstring texto, jstring ubicacionLlavePublica, jstring semilla)
         try
              char *ciphertext = RSAEncryptString(ubicacionLlavePublica, semilla, texto);
              delete [] ciphertext;
              return(ciphertext);
         catch(CryptoPP::Exception &e)
              return ("");
         catch(std::exception &e)
              return ("");
         catch(...)
              return ("");
    JNIEXPORT jstring JNICALL
    Java_ApiEncriptacion_desencripta(JNIEnv *env, jobject obj, jstring texto, jstring ubicacionLlavePrivada)
         try
              char *decrypted = RSADecryptString(ubicacionLlavePrivada, texto);
              return(decrypted);
         catch(CryptoPP::Exception &e)
              return ("");
         catch(std::exception &e)
              return ("");
         catch(...)
              return ("");
    int main()
         return(0);     
    void GenerateRSAKey(unsigned int keyLength, const char privFilename, const char pubFilename, const char *seed)
         RandomPool randPool;
         randPool.Put((byte *)seed, strlen(seed));
         RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength);
         HexEncoder privFile(new FileSink(privFilename));
         priv.DEREncode(privFile);
         privFile.MessageEnd();
         RSAES_OAEP_SHA_Encryptor pub(priv);
         HexEncoder pubFile(new FileSink(pubFilename));
         pub.DEREncode(pubFile);
         pubFile.MessageEnd();
    char RSAEncryptString(const char pubFilename, const char seed, const char message)
         FileSource pubFile(pubFilename, true, new HexDecoder);
         RSAES_OAEP_SHA_Encryptor pub(pubFile);
         if (strlen(message) > pub.MaxPlainTextLength())
              cerr << "message too long for this key\n";
              abort();
         RandomPool randPool;
         randPool.Put((byte *)seed, strlen(seed));
         char outstr = new char[2pub.CipherTextLength()+1];
         pub.Encrypt(randPool, (byte *)message, strlen(message), (byte *)outstr);
         HexEncoder hexEncoder;
         hexEncoder.Put((byte *)outstr, pub.CipherTextLength());
         hexEncoder.MessageEnd();
         hexEncoder.Get((byte *)outstr, 2*pub.CipherTextLength());
         outstr[2*pub.CipherTextLength()] = 0;
         return outstr;
    char RSADecryptString(const char privFilename, const char *ciphertext)
         FileSource privFile(privFilename, true, new HexDecoder);
         RSAES_OAEP_SHA_Decryptor priv(privFile);
         HexDecoder hexDecoder;
         hexDecoder.Put((byte *)ciphertext, strlen(ciphertext));
         hexDecoder.MessageEnd();
         SecByteBlock buf(priv.CipherTextLength());
         hexDecoder.Get(buf, priv.CipherTextLength());
         char *outstr = new char[priv.MaxPlainTextLength()+1];
         unsigned messageLength = priv.Decrypt(buf, (byte *)outstr);
         outstr[messageLength] = 0;
         return outstr;

  • Reloading a new JSP/Jar in Tomcat Server

    HI,
    I face these problems now.
    My environment is Oracle Jdev 3.2.3 for JSP development. Tomcat4.0.1 as Application server plugged into IIS webserver and Using oracle 8i as the database
    1. Whenever I update my JSP's and Application jar files, I copy from staging area to the deployment Tomcat Server application specific directories. The files are getting copied(overwritten). After that when i try to access my context/application in Tomcat server, my browser simply tries to browse and doesn't bring up the homepage of my application(say index.jsp).
    I need to stop the tomcat server and restart again. Then I get it.
    Is there anyone who came across this error and possibly help me to solve this?
    2. I have a JSP (say emplist) which shows all the employees details with empno, ename, depyno and sal as 4 columns.
    I have a up and down arrow images near the column names. Upon clicking it, it will call the same page and sort the column either desc or asc based on the previous display order. The column on which the Arrow button displayed is stored in session variable.
    This sorting in JSP perfectly works in JDeveloper and when i run using WebToGo Server. But when i deployed in Tomcat,This sorting doesn't work.
    The page simply stands. and when i go back and front browsing my other pages of application, i lose the position of the arrow button and it behaves unexpectedly by showing up in some other columns.
    is there any reason for this kind of behaviour?
    3. In my JSP files, I log the user actions into a text file in the server. IN WTG, I am able to specify the path of the output directory.
    But in Tomcat Server, by default the output files are getting created in C:/Tomcat/bin directory.
    I donno how to set an output directory, where the files will be written to and set an input directory from where my custom application properties files will be read from.
    Can anyone help me in telling in which file and what attributes, i need to set the input and output directory path in Tomcat Server?
    Can someone help me in giving suggestions or solutions for the above problems?
    Thanks a lot in advance.
    Thanks
    Hari

    I added a Context Tag in server.xml file in the Host Tag
    <Context docBase="struts-blank">
    </Context>and so following comes up in the Server Console Window
    INFO: Starting service Catalina
    Feb 7, 2005 11:06:30 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.2
    Feb 7, 2005 11:06:30 PM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Caused by: java.lang.NullPointerException
            at java.util.Hashtable.put(Hashtable.java:396)
            at org.apache.catalina.core.StandardContext.resourcesStart(StandardConte
    xt.java:3707)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
    934)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:420
            at org.apache.catalina.core.StandardService.start(StandardService.java:4
    50)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:196
    7)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:541)
            ... 6 moreThanks in advance
    CSJakharia

  • Opening an attachment from outside the tomcat context

    I am creating a simple mail software. In my incoming message screen i'm showing all the Attachments as hyperlinks. I want that when the user clicks the hyperlink the Attachment should open in a new browser window.
    My problem is that the attachments are there in a folder outside the tomcat context i.e. in a folder outside the tomcat's folder on the server's c:/Attachments folder.
    If I put the attachments in the root folder of my application under webapps folder it is working properly. But I want to open it from the outside folder c:/Attachments, and also I can't hardcode this path in my code. It can be any path outside tomcat.
    Please help me, if u have any solution.

    Make that path a parameter in web.xml
         <context-param>     
              <param-name>beginyear</param-name>
              <param-value>2004</param-value>          
              <description>starting year of the application</description>
         </context-param>

  • Finding the Path From Servlet

    Please guys I need some help on this.
    I have created a context in my Tomcat/webapps called EcBugManager.
    My servlets are in the webapps/EcBugManager/Web-Info folder.
    I want to say in a servlet to upload files to a folder
    which is in the webapps/EcBugManager/UploadFiles folder.
    How should i give the relative path from the servlet.
    I have tried the following but with no success.
    - "..\\EcBugManager\\UploadFiles";
    - "..\\UploadFiles";
    This works, but i need the relative path
    - "D:\\Tomcat\\webapps\\ EcBugManager\\UploadFiles";
    Is the way i am trying to do is wrong. please help on this.
    Rhanks in Advance
    Shiran

    The question doesn't clear enought.
    but you may try HttpServletRequest.getPathTranslated(), which returns
    the root path of your servlet.
    then you may append the sub-directory you want to located.
    or try servlet's creatTempfile method.

  • Tomcat doesn't find servlet

    (I apologize for the strange formatting of this message. I don't know exactly how to control it.)
    I'm trying to deploy a basic "Hello World" servlet into Tomcat (6.0.18) on Mac OS X Server (10.5.6).
    When I try to access it. I get 404 (not found) error.
    This is my web.xml file:
    <?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-app23.dtd">
    <web-app>
    <display-name>Hello World</display-name>
    <description>
    Just trying to get this to work.
    </description>
    <servlet>
    <servlet-name>hello</servlet-name>
    <description>
    Say hello.
    </description>
    <servlet-class>HelloWorld</servlet-class>
    <!-- Load this servlet at server startup time -->
    <load-on-startup>5</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout> <!-- 30 minutes -->
    </session-config>
    </web-app>
    I'm using a slightly modified build.xml file from apache.org. Muy build.properties file has the following info:
    # Context path to install application on
    app.path=/helloworld
    # Tomcat 6 installation directory
    catalina.home=/Library/Tomcat
    The servlet java source is pulled form the example servlets:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Hello World!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("Hello World!");
    out.println("</body>");
    out.println("</html>");
    When I deploy the web app via 'ant install', ant responds with:
    install:
    [deploy] OK - Deployed application at context path /helloworld
    The Tomcat Web Application manager shows an entry with a path of /helloworld, which links to http://eyemac.saintmarys.edu:8080/helloworld .
    Noticeably absent is the Display Name, which I have set to "Hello World" in web.xml.
    Clicking on the /helloworld link gives be a 404 error.
    I've tried things like setting the url-pattern to something like "/hi" then going to http://eyemac.saintmarys.edu:8080/helloworld/hi (or even http://eyemac.saintmarys.edu:8080/hi) but this still results in a 404 error.
    What am I doing wrong?
    I'll post my build.xml and server.xml files, if that would help.
    Thank you.
    Message was edited by: Steve Hideg

    If I put an index.html file in WEB-INF and redeploy the web app, I can access that web page via the link in the Tomcat Web Application manager at http://eyemac.saintmarys.edu:8080/helloworld/.
    I currently have the following servlet and servlet mapping in web.xml:
    <servlet>
    <servlet-name>hello</servlet-name>
    <description>
    Say hello.
    </description>
    <servlet-class>HelloWorld</servlet-class>
    <!-- Load this servlet at server startup time -->
    <load-on-startup>5</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>hi</url-pattern>
    </servlet-mapping>
    If I go to http://eyemac.saintmarys.edu:8080/helloworld/hi or (on the server) http://localhost:8080/helloworld/hi, I get a 404 error.
    And Tomcat Web Application manager still doesn't show this web app's Display Name.

  • Deploying servlet on Tomcat using "ant install" not working. Please help.

    Hello. Normally I can find answers by using search, but I can't today for some reason. So please bare with me if this has been mentioned before. I will try to provide as much info as possible so that helping me isn't too much a chore. Thank you.
    I have downloaded and installed the JWSDP 1.3. and Tomcat is running. I am also using Ant 1.5.4 (previous installation - not one included with JWSDP) and modeled my build.xml file after the template provided here:
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/build.xml.txt.
    When I run ant on my respository, everything builds fine. But when I run Ant with the install target, I get the following error:
    BUILD FAILED
    file:C:/owl/build.xml:366: java.io.IOException: Server returned HTTP response co
    de: 401 for URL: http://localhost:8080/manager/deploy?path=%2Fowl&war=file%3A%2F
    %2FC%3A%5Cowl%2Fbuild
    Here is line 366 build.xml:
    localWar="file://${build.home}"/>
    ...which is included in this block for the target "install":
    <target name="install" depends="compile"
    description="Install application to servlet container">
    <deploy url="${manager.url}"
    username="${manager.username}"
    password="${manager.password}"
    path="${app.path}"
    localWar="file://${build.home}"/>
    </target>
    When I point my brower to the url located in the error verbose, I get the following:
    FAIL - Encountered exception java.lang.NullPointerException
    I am trying to get my environment set up correctly before I start spending time developing servlets, but I am getting tempted to just develop to servlets and "manually" installing/deploying them either by copying and pasting or by using the Tomcat manager. I would really like to do everything from Ant though if possible. Please help.

    I don't think this is at all correct:
    localWar="file://${build.home}"/>You've got to create a real WAR file - a JAR file with WEB-INF and all its minions inside it:
    http://access1.sun.com/techarticles/simple.WAR.html
    That's the file you need to refer to there. You can manage that with Ant too, of course.
    Here's what my Ant build.xml looks like for Web apps (there's a build-web.properties file that follows):
    build-web.xml
    <project name="Tomcat Build Tasks" default="clean" basedir=".">
        <target name="init-props">
            <tstamp>
                <format property="touch.time" pattern="MM/dd/yyyy hh:mm aa" />
            </tstamp>
            <filterset id="ant.filters">
                <filter token="DATE" value="${TODAY}" />
                <filter token="TIME" value="${TSTAMP}" />
            </filterset>
            <!-- Load in all the settings in the properties file -->
            <property file="build.properties" />
            <!-- Load in all Tomcat settings in the properties file -->
            <property file="build-web.properties" />
        </target>
        <target name="prepare" depends="init-props">
            <mkdir dir="${war.classes}"/>
            <mkdir dir="${war.lib}"/>       
            <mkdir dir="${manifest}" />
        </target>
        <target name="clean" depends="init-props" description="clean up temporary files">
            <delete file="${project}.war" />   
            <delete dir="${war.root}"/>
            <delete dir="${manifest}" />
        </target>
        <target name="set-tomcat-classpath" depends="prepare">
            <path id="tomcat.class.path">                  
                <fileset dir="${tomcat.home}/bin">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${tomcat.home}/shared/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${tomcat.home}/common/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${tomcat.home}/server/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
                <fileset dir="${ant.home}/lib">
                    <patternset>
                        <include name="**/*.jar" />
                    </patternset>
                </fileset>
            </path>              
        </target>
        <target name="create" depends="set-tomcat-classpath" description="create the war file">
            <!-- All files at root level -->       
            <!-- Temporarily put the JSPs at root until you figure this out -->
            <copy todir="${war.root}">
                <fileset dir="${src.jsp}"/>
            </copy>
    <!--
            <copy todir="${war.root}">
                <fileset dir="${src.html}" includes="*.html"/>
            </copy>
    -->
            <copy todir="${war.root}/css">
                <fileset dir="${src.css}"/>
            </copy>
            <copy todir="${war.root}/images">
                <fileset dir="${src.images}"/>
            </copy>
            <copy todir="${war.root}/js">
                <fileset dir="${src.js}"/>
            </copy>
            <!-- All files at the WEB-INF level and below -->       
            <copy todir="${war.web}">
                <fileset dir="${src.etc}" includes="web.xml"/>
            </copy>
            <!-- All files in the CLASSPATH lib -->
            <copy todir="${war.web}/lib">
                <fileset dir="${src.lib}" includes="**/*.jar" excludes="**/*-tests.jar, **/junit.jar"/>
            </copy>
            <!-- Put the dispatcher XML in WEB-INF/config -->
            <copy todir="${war.web}/config">
                <fileset dir="${src.etc}" includes="${project}-config.xml"/>
            </copy>
            <!-- Put XSL stylesheets in WEB-INF/xsl -->
            <copy todir="${war.web}/xsl">
                <fileset dir="${src.xsl}" includes="**/*.xsl"/>
            </copy>
            <!-- Put the project JAR file in WEB-INF/lib -->
            <copy todir="${war.web}/lib">
                <fileset dir="${deploy}" includes="**/${project}.jar"/>
            </copy>
            <!-- Create the manifest -->
            <buildnumber />
            <manifest file="${manifest}/manifest.mf">
                <attribute name="Implementation-Title"      value="${project}" />
                <attribute name="Built-By"                  value="${user.name}"/>
                <attribute name="Build-Date"                value="${TODAY}" />
                <attribute name="Major-Version"             value="${major}" />
                <attribute name="Minor-Version"             value="${minor}" />
                <attribute name="Build-Number"              value="${build.number}" />
            </manifest>
            <!-- Create the WAR file -->
            <jar jarfile="${project}.war"
                 manifest="${manifest}/manifest.mf">
                <fileset dir="${war.root}"/>
                <metainf dir="${src.etc}" includes="context.xml"/>
            </jar>
        </target>
        <target name="create-tomcat-admin-tasks" depends="set-tomcat-classpath">
    <!--
            <pathconvert targetos="windows" refid="tomcat.class.path" property="converted.class.path" />
            <echo message="CLASSPATH: ${converted.class.path}" />
    -->       
            <taskdef name="install"     classname="org.apache.catalina.ant.InstallTask"     classpath="tomcat.class.path"/>
            <taskdef name="remove"      classname="org.apache.catalina.ant.RemoveTask"      classpath="tomcat.class.path"/>       
            <taskdef name="reload"      classname="org.apache.catalina.ant.ReloadTask"      classpath="tomcat.class.path"/>
            <taskdef name="deploy"      classname="org.apache.catalina.ant.DeployTask"      classpath="tomcat.class.path"/>       
            <taskdef name="undeploy"    classname="org.apache.catalina.ant.UndeployTask"    classpath="tomcat.class.path"/>       
            <taskdef name="start"       classname="org.apache.catalina.ant.StartTask"       classpath="tomcat.class.path"/>       
            <taskdef name="stop"        classname="org.apache.catalina.ant.StopTask"        classpath="tomcat.class.path"/>       
            <taskdef name="list"        classname="org.apache.catalina.ant.ListTask"        classpath="tomcat.class.path"/>       
            <taskdef name="resources"   classname="org.apache.catalina.ant.ResourcesTask"   classpath="tomcat.class.path"/>       
            <taskdef name="roles"       classname="org.apache.catalina.ant.RolesTask"       classpath="tomcat.class.path"/>
        </target>
        <target name="install" depends="create-tomcat-admin-tasks" description="install the war file on Tomcat">
            <install    url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}"
                        config="file:/${basedir}/${src.etc}/context.xml"
                        war="file:/${basedir}/${project}.war" />
        </target>
        <target name="remove" depends="create-tomcat-admin-tasks" description="remove the war file on Tomcat">
            <remove     url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="reload" depends="create-tomcat-admin-tasks" description="reload the war file on Tomcat">
            <reload     url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="deploy" depends="create-tomcat-admin-tasks" description="deploy the war file on Tomcat">
            <deploy    url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}"
                        config="file:/${basedir}/${src.etc}/context.xml"
                        war="file:/${basedir}/${project}.war" />
        </target>
        <target name="undeploy" depends="create-tomcat-admin-tasks" description="undeploy the war file on Tomcat">
            <undeploy   url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="start" depends="create-tomcat-admin-tasks" description="start an application on Tomcat">
            <start      url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}"/>
        </target>
        <target name="stop" depends="create-tomcat-admin-tasks" description="stop an application on Tomcat">
            <stop       url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        path="/${project}" />
        </target>
        <target name="list" depends="create-tomcat-admin-tasks" description="list all applications running on Tomcat">
            <list       url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"/>
        </target>
        <target name="resources" depends="create-tomcat-admin-tasks" description="list all resources on Tomcat">
            <resources  url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"/>
        </target>
        <target name="data-sources" depends="create-tomcat-admin-tasks" description="list all data sources on Tomcat">
            <resources  url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"
                        type="javax.sql.DataSource"/>
        </target>
        <target name="roles" depends="create-tomcat-admin-tasks" description="list all user roles on Tomcat">
            <roles      url="${tomcat.manager.url}"
                        username="${tomcat.username}"
                        password="${tomcat.password}"/>
        </target>
    </project>
    build.properties
    # Properties file for setting up an Ant build.xml
    # Project specific items that change each time
    project=api-prototype
    major=1
    minor=0
    version=${major}.${minor}
    jar.name=${project}
    versiondate=${TODAY}
    # Directory structure (these should never change)
    bin=bin
    deploy=deploy
    doc=doc
    manifest=META-INF
    xml=xml
    # Everything under src should come out of a repository
    src=src
    src.bin=${src}/bin
    src.config=${src}/config
    src.data=${src}/data
    src.dtd=${src}/dtd
    src.java=${src}/java
    src.lib=${src}/lib
    src.profile=${src}/profile
    src.properties=${src}/properties
    src.schema=${src}/schema
    src.sql=${src}/sql
    src.templates=${src}/templates
    src.testdata=${src}/testdata
    src.xml=${src}/xml
    src.xsl=${src}/xsl
    # These are created and deleted by Ant each time
    javadocs=javadocs
    reports=reports
    output=output
    output.classes=${output}/classes
    output.lib=${output}/lib
    # Required for proper use of XDoclet
    xdoclet.home = C:/Tools/xdoclet-1.2b3
    build-web.properties
    war.root=war-root
    war.pages=${war.root}/pages
    war.web=${war.root}/WEB-INF
    war.classes=${war.web}/classes
    war.css=${war.web}/css
    war.js=${war.web}/js
    war.lib=${war.web}/lib
    war.tld=${war.web}/tld
    # Properties needed by Tomcat tasks
    ant.home =
    tomcat.home         =
    tomcat.manager.url  = http://localhost:8080/manager
    tomcat.username     =
    tomcat.password     = MOD

  • Probelm in getting absolute path of the application folder?

    I have problem in getting the absolute path of the application folder.
    I wriiten the following line in my action class:
    String absPath = getServlet().getServletContext().getRealPath("/");
    when i run my application 'DTH' in Tomcat server, I am getting correct path :
    C:\Tomcat\jakarta-tomcat-5.0.25\webapps\DTH
    But when i run this application in weblogic server, I am getting null value for the above line.
    Can any one help me in this?

    public java.lang.String getRealPath(java.lang.String path)
    This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
    so, getRealPath() might not be a very good approach because of its different behavior when used from a war or exploded application.
    What you could do is:
    1. pass the path as a parameter inside web.xml (config files, log files etc)
    2. For dynamic lookup of files you could make use of ClassLoader.getResource().
    Hope it helps.

  • Tomcat + wle 5.1

              i write a c++ corba object in wle5.1,and write a java client (application) to invoke
              it,sucess.
              but i chage this java client into a servlet.and execute it in tomcat 4.0.3, i use
              jdk1.2.2,and put M3envobj.jar and wleclient.jar in the path c:\tomcat\common\lib.
              but get a error:
              java.lang.ExceptionInInitializerError: org.omg.CORBA.INITIALIZE: can't instantiate
              default ORB implementation com.beasys.CORBA.idl.ORBSingleton minor code: 0 completed:
              No
                   at org.omg.CORBA.ORB.create_impl(ORB.java:298)
                   at org.omg.CORBA.ORB.(ORB.java:195)
                   at hello.to_convert(hello.java:45)
                   at hello.doGet(hello.java:17)
              and refresh IE6.0
              get error:
              java.lang.NoClassDefFoundError: org/omg/CORBA/ORB
                   at hello.to_convert(hello.java:45)
                   at hello.doGet(hello.java:17)
              can anyone told me why?
              thx
              james
              

              Does TomCat have a policy file similar to BEA WLS
              weblogic.policy. If using WLS, you may need to
              add permission java.util.PropertyPermission
              "org.omg.CORBA.ORBSingletonClass", " write";
              in the last grant section of weblogic.policy.
              You can also try to add wleorb.jar in the
              path c:\tomcat\common\lib.
              Developer Relations Engineer
              

Maybe you are looking for

  • EPM 11.1.2.3 Install - machine name change problem

    Hi, when I thought I had 99% completed an install a problem was discovered with the machine name, which was changed, is there any simple way to reinvoke the configuration options from the initial install, or to change the entries (config files / xml?

  • How to create Product, Software Component..after the XI Installation

    Hi Experts, SAP XI was installed completely. After this, I would like to test some sample File – File scenario. But I am not sure, how to create the Product, Software Component etc. I am able to login and run the SXMB_IFR to get the XI tools. Can som

  • Remote fails after several days

    I'm running ZFD 3.2, on a Netware 5.1 (sp5) box with eDir 85.27c. When I import a workstation, it will work perfectly for a few days, but then it fails to respond to Remote Control. I can still do Chat, and pinging the agent gives perfect success. Wh

  • Select element not found

    Hi,  i am using vugen 11.00 for recording an application.. It is recording correctly but while replaying the script it is showing error as " SELECT element not found in the list"... The version of IE is 8.. is it application bug or vugen recording pr

  • Load Time for executable

    Hi, I've just built an exe from a vi that loads very quickly. It takes about 10s to display the icon in the task bar and then more than 40s to display the front face. I've disabled everything in my vi so that the only thing made at start up is an app