How to run servlet inside jar file

Hi
I have a problem on running a servlet class which resides in a jar file.
At first, it runs if it is located in the root directory of jar file, but if I put in inside a sub directory, I wasn't able to run it. It seems that the servlet class was not found.
Here's the contents of my jar file:(eg. application.jar)
META-INF/
META-INF/MANIFEST.MF
Business/
Business/Business.class
TransferManager/
TransferManager/Default.class
TransferManager/Application.class
DAL/
DAL/XMLDocument.class
DAL/ParameterCollection.class
DAL/ConnectionReaper.class
DAL/JDCConnectionPool.class
DAL/JDCConnection.class
DAL/JDCConnectionDriver.class
DAL/DataAccess.class
Presentation/
Presentation/IPresentation.class
Presentation/XslTransform.class
When I deploy this jar in tomcat4.0 and try to run the Default.class
in the TransferManager package, the server can not locate the class.
But if I put it in the root directory of the jar it works.
Is there any additional setting in tomcat for this? Anyone can give
me an idea for this?
Thanks in advance...

If you want to put the compiled servlet into Business/Business.class, you need for it to be in the Business package. I.e. the first line of code should be "package Business;" It looks like your jar file is in the right place, since Tomcat is finding something in it. So put your servlets in the appropriate packages and they should run. Also, you would have to change the configuration to refer to "Business.Business.class" and so on.

Similar Messages

  • How to run our own jar files on Nokia 3100

    Hi,
    I am new to J2me.
    I have written an J2me application using CLDC1.1
    and MIDP 2.0 it works well on emulator but
    when i tried to run it on device(Nokia 3100) it displays an error "Invalid File"
    please answer my question as soon as possible

    Look at this link http://www.j2mepolish.org/devices/Nokia/3100.html and check to see if you aren't using some API which is not supported by your Nokia 3100 phone, or if the jar size is to big, stuff like that.
    Also, use a Nokia emulator for the Series 40 to test and see if it works.
    Mihai

  • How to run my own jar file on nokia 6600?

    i am in urgent need of that. please let me know. i will be grateful to you.

    Look at this link http://www.j2mepolish.org/devices/Nokia/3100.html and check to see if you aren't using some API which is not supported by your Nokia 3100 phone, or if the jar size is to big, stuff like that.
    Also, use a Nokia emulator for the Series 40 to test and see if it works.
    Mihai

  • How to protect the class files inside jar file.

    Hi Group,
    pls help me.
    my need is i created a executable jar file with certain classes.
    and i'm supposed to send it to my client.
    but if the client needs he can extract the class files from the jar and with the
    help of some decompilers he can convert class file to .java source code and read the whole
    stuff.
    how can i protect my jar file from these.
    is there any security mechanism for that
    pls help me.
    Regards,
    Ranjith.M

    In order to protect my jar file I tried the jar signer technology but it only protects the jar from modification so I need to know how to protect jar file from decoding of the contents inside.

  • How to run servlet in weblogic 8.1

    hi!
    i m new to weblogic.how to run servlet in weblogic8.1.i get lot of errors when i compile it in command prompt.but when i do the same thing in tomcat,i dont get errors & it runs successfully.help me out.how to compile servlets in weblogic 8.1.some say i have to create .jar file.pls tell me the procedure.i m new to j2ee.i have installed jdk1.5 .
    pls its urgent

    a lot of error....
    mmmm no sorry, i don't see
    it remembers me when i was dating sarah,it was very difficult... but now i'm dating anne it's really easier... any idea on what was going wrong with sarah?
    ok sorry for this allegory, just tired to ask always the same thing:
    WHAT ERRORS???

  • How to run Servlet in Tomcat 5.5.7 Server

    Hi,
    How to run Servlet in Tomcat 5.5.7 Server. I mean where I should copy my *.class file.
    Thanks in Advance.
    bbye.

    In order to complile the servlet you need to tell java where to find the servlet libary (as stated above by setting the class path). or (much easier IMO)
    copy the servlet-api.jar to
    JavaInstallDirectory\jre\lib\ext

  • How to run servlet codes in WebServer 6.1?

    I am new to Java Web Server and at our place we had installed WebServer 6.1. How to run Servlets in this - the default directory is
    http//win2000:81/Sun/WebServer6.1/docs
    I have'nt insatlled any new virtual class / servers - just running with the default class and servers.
    I could not find any virtual directory named servlet (similar to JavaWebServer 2.0) here.
    Someone kindly tell me how to post servlet files and run them.

    Refer "Sun ONE Web Server 6.1 Programmer's Guide to Web Applications"
    http://docs.sun.com/app/docs/doc/817-1833-10
    Meena

  • 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 ^_^

  • Run a Remote Jar file

    How can I run a remote jar file?
    There is a runnable jar (Java Application) file on server and my client program wants to run it on the client. What should I write for my client code to do this?
    It is possible to load it directly into client memory and run it?
    And basically, does a Jar file completely load into memory, when we are deploying it, or only required resources load?

    I suppose you are not speaking of applets.
    If Iunderstand your question correctly, you are looking for a way, the client always has newest software downloaded from the server.
    If that is what you are looking for, try JavaWebStart.
    You find tutorials on javasoft.com.
    If you just want the client to download an application (like an .exe) use a runnable jar!

  • How to run servlets in tomcat

    Hi ,
    How to run servlets in tomcat server. I created two files html and servlet file.
    Html file
    callservlet.html
    <html>
    <body>
    <form method=post action="servletcalled.class">
    <input type=submit value="submit">
    </form>
    <body>
    </html>
    servlet file
    servletcalled.java contains
    public void doPost(HttpServletRequest req,HttpServletResponse res ){
    java.io.PrintWriter out = req.getWriter();
    out.println("Hi, executed");
    i put the callservlet.html in webapps/examples/ and servletcalled.class was in webapps/examples/Web-inf/classes/
    After starting the tomcat and running the program html file is getting exceuted but when i click on the submit button this error is prompted
    type Status report
    message servletcalled.class
    description The requested resource (servletcalled.class) is not available.
    Thanks in advance

    Thanks,
    I created a new directory in webapps
    s "webapps/test".
    Test directory contains
    1. callservlet.html file
    2. another directory Web-inf (i.e,
    webapps/test/Web-inf)
    Web-inf directory contains
    1. web.xml file
    2. another directory classes (i.e,
    webapps/test/Web-inf/calsses)
    classes directory contains
    1. servletcalled.class file
    web.xml file contains
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>Example</servlet-name>
    <servlet-class>Example</servlet-class>
    </servlet>
    </web-app>
    -->should be: <servlet-class>servletcalled</servlet-called>
    then in the <web-app> scope define this:
    <servlet-mapping>
    <servlet-name>Example</servlet-name>
    <url-pattern>/servlets/Example</url-pattern>
    </servlet-mapping>
    >
    thanks in advance i am working hard on that but
    notable to get the solutionbtw by reading the documentation of tomcat and tutorials of jave on the java site (here), you would have known this!

  • How can I create a jar file

    Hello!
    How can a create a jar file?
    I want to run an application just clicking in a icon.
    How can I do this?
    Thanks a lot.
    K�tia.

    Get to the command prompt
    change directories to the directory where the main class resides.
    Open your text editor and type the following in it:
    Manifest-Version: 1.0
    Main-Class: NameOfMainClass //Just name without ".class"!!!
    Created-By: Your Name Here
    Save this file as whatever you want to name it with ".mf" as the extension.
    Then go back into the command prompt and type the following:
    jar cfm "NameOfJarFile".jar "NameOfManifestFile".mf *.class
    (without the quote marks of course)
    Hit "Enter"
    This will jar it up and make it executable.
    If you have any images associated with the program you can add them in the same way as above. Just add *.gif or *.jpg after the *.class portion.
    Good luck!
    LEEMAX I. T.

  • How to run servlet in java webserver2.0

    how to configure java webserver2.0 and how to run servlet in that

    Hi Friend,
    Try changing the servlet code to this and just tell wat happens after this.
    and wat can you see on your Browser Screen.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class login extends HttpServlet {
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
    if (req.getParameter("t1") == null || req.getParameter("t2") == null)
    out.println("Enter User Name And Password");
    String uid=req.getParameter("t1");
    String pwd=req.getParameter("t2");
    res.setContentType("text/html");
    PrintWriter out=res.getWriter();
    out.println("<html>"); out.println("<head>");
    out.println("<title>Login</title>"); out.println("</head>");
    out.println("<body>");
    try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(ClassNotFoundException e)
    out.println("<h3>"+e+"</h3>");
    try{
    Connection con=DriverManager.getConnection("jdbc:odbc:ms","scott","tiger");
    PreparedStatement psm=con.prepareStatement("select * from reg where uid1=? and pwd=?");
    psm.setString(1,uid);
    psm.setString(1,pwd);
    ResultSet rs=psm.executeQuery();
    if(rs.next())
    { out.println("<html><head><title>WELCOME</title></head>");
    out.println("<body><b><i>Hello user "+uid+"</b></i>");
    out.println("</body></html>"); }
    else
    res.sendRedirect("http://localhost:8080/login.html");
    } catch(SQLException e)
    { e.printStackTrace();}
    rs.close();
    con.close();
    out.close();
    After this try creating a odbc for oracle database at control panel with the name ms.
    Please inform me wat happens after this and friend do give some information about wat kind of web-server are you using.Because calling of your servlets differs the way your configure your web-server and the default configurations differ from web-server to web-server.
    Regards,
    RAHUL

  • How do you create a jar file in JDeveloper 11.1.2.0.0

    How do you create a jar file in JDeveloper 11.1.2.0.0

    1) Select the project for which you would like to generate the jar.
    2) Right Click the selected right and select 'Project Properties'
    3) Select the 'Deployment' in the left tab.
    4) Click on 'New' to create a new deployment profile and in the popup dialog, select 'Jar File' profile type and provide the name.
    5) Press 'ok' to save the changes.
    6) Select the project and right click and select 'Deploy to' and select the jar profile name you have specified.
    The Jar library is generated and the full path to the library jar is shown in the log window.
    Thanks,
    Navaneeth

  • Applet : How to use Images in Jar file

    I want to put all images into a jar file to improve speed of loading.
    But how to invoke images from Jar file?
    Thanks.

    @Op. It's very important for a developer to know how to find information, and that skill usually comes with experience. Google is one of the best ways to find information and solutions to the most common problems.
    Kaj

  • How to call function in jar file?

    First, I can't write english well.(I'm korean.. ) sorry about that.
    I have known function in jar file.
    but I don't know how to call function in jar file.
    how can I this work?
    My project and another project are respectively developing D-project with me and other man.
    so i need it. or I can't do this work.
    I will paste other's source code in my source code.
    and then recomplie , build it.. but it is not my wish!
    thanks for reading my sentence.

    If you have a jar file with a class that you wish to use, then you must add the jar file to your class path ($CLASSPATH on unix, linux, etc. and %CLASSPATH% on Windows).
    Then you can use the class normally, just as you would if it were not in the jar.
    If you meant something else, you'll need to explain what you meant.

Maybe you are looking for