Compiling Java Servlet with Depricated Methods

I have a problem of compiling Java servlets that contain depricated methods. If you compile against modern version of servlet.jar I see depricated methods error messages and if I use a very old servlet.jar it cannot find newer methods. What is is the best solution in this case?
Thank you,
Boris.

The best thing to do would be compile your code with the -depreciated option to find which methods have been depreciated and the refactor your code to remove them.
The next best thing is to ignore the messages (they are warnings not errors) and your code should still work

Similar Messages

  • Pls give me example of Java Servlet with Oracle

    Hi Guys,
    I am new to Database connectivity of JAVA Servlet with Oracle.
    So can you give me one complete example of connecting Java Servlet with Oracle 9i database.
    [ i mean Select statement, Insert statement..]
    I have tomcat server which comes built-in with NetBeans IDE.
    I need this because, i always come accross messages saying that " you need to change classpath this way " , or " you need to write connection this way "....
    So to avoid all this wrong things..i need your help.
    You guys can reply me on [email protected]
    Thanks & Appreciate..
    Dal Hit

    I got succeeded!
    I changed the three point:
    * add 'package hoo;' in HelloBean.java
    * add '<%@ page import="my.HelloBean" %>' in hello3.jsp
    * change '<jsp:useBean id="hello" class="HelloBean">
    to '<jsp:useBean id="hello" class="my.HelloBean">
    Before posting, I searched google three times but couldn't get answer.
    I could not get well if you didn't give me help...
    Thank you very much.

  • Compiling a servlet with utility class

    Hello,
    I am having trouble compiling a servlet that uses a utility class.
    The compiler doesn't seem to recognize the utility class for some reason.
    my classpath is set to:
    .;C:\ServletDevel;C:\Program Files\Apache Software Foundation\common\lib\servlet-api.jar
    the error:
    Cannot find symbol: ServletUtilities
    the servlet code:
    package coreservlets;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** test the use of packages and utilities on the server */
    public class helloservlet3 extends HttpServlet {
    public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
                   throws ServletException, IOException {
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         String title = "Hello (3)";
         out.println(ServletUtilities.headWithTitle(title) +
              "<body bgcolor=\"#FDF5E6\">\n" +
              "<h1>" + title + "</h1>\n" +
              "</body></html>");
    the utility class:
    package coreservlets;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** time saving static methods */
    public class ServletUtilities {
         public final static String docType =
         "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
         "Transitional//EN\">";
    public static String headWithTitle(String title){
    return (docType + "\n" + "<html>\n" +
              "<head><title>" + title + "</title></head>\n");
    any help wouldbe greatly appreciated.

    Nope still getting an error
    helloservlet3.java:17:cannot find symbol
    symbol : class ServletUtilities
    location: package coreservlets
    out.println(coreservlets.ServletUtilities.headWithTitle(title) +
    thanks for the help, i'll keep on trying to figure it out.

  • Using Java Servlet with CSV

    Hello!!
    I would be obliged if some one could tell me anyway of using CSV (Collaborative Source Versioning) with Java Servlets. I have searched and the only package that I have found is jCSVSlet but I can't figure out how to use it. I would be obliged if anybody could point out any other packages that can be used for File Versioning or if anybody could send me any examples of JCSVSlet or any other related software.
    Saad Tawwab

    And what do you mean by "with"? Do you want to control versions of the source code of the servlets, or do you want to write a servlet to control version of the source code of something else?

  • Compiling Java code with Japanese characters

    I have a Java code with some Japanese characters. My compiler doesn't recognise these characters and gives me error messages.
    Please help me.

    Obviously it's not the copmiler's fault. You need to fix your code.
    Here is a link to the Java Language Specification.
    The link is to section 3.8 - Identifiers.
    It describes the acceptable naming:
    http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625
    Perhaps your editor is not saving the text file in an appropriate format.
    What editor are you using?
    Try vim http://www.vim.org
    or SciTE http://www.scintilla.org/SciTE.html

  • Compiling java servlet programs

    i have Tomcat 5.0 and SDK 1.5 . I am able to compile java programs. But in servlet programs the compiler is unable to recognize the javax.servlet package(the code below). I have pushed all the JAR files of TOMCAT to the CLASSPATH . But nothing has changed.
    javax.servlet.*;
    javax.servlet.Http.*;

    hi,..
    javax.servlet.Http.*; should be javax.servlet.http.*; !
    even though you have put the jar files in the classpath .. does it point to servlet-api.jar ? if it does.. it should work. Also try out specifing the classpath using the -cp while compiling the servlet program .
    --Olakara                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Compile java servlet

    When compiling the servlet below I get the errors below:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloServlet extends HttpServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res)throws Servlet
    Exception, IOException
    PrintWriter out = res.getWriter();
    out.println("<html>");
    out.println("<body>");
    out.println("<Hello Readers>");
    out.println("</html>");
    out.println("</body>");
    Why don't these packages exist?
    Thanks!
    /usr/java/j2sdk1.4.0/bin/javac HelloServlet.java
    HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloServlet.java:5: cannot resolve symbol
    symbol : class HttpServlet
    location: class HelloServlet
    public class HelloServlet extends HttpServlet
    ^
    HelloServlet.java:7: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class HelloServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res)throws Servlet
    Exception, IOException
    ^
    HelloServlet.java:7: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class HelloServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res)throws Servlet
    Exception, IOException
    HelloServlet.java:7: cannot resolve symbol
    symbol : class ServletException
    location: class HelloServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res)throws Servlet
    Exception, IOException
    ^
    6 errors

    Those packages do exists.
    You just need to especify the JAR file where they are located in your classpath when compiling.
    Those packages are not part of the Java 2 Standard Edition (J2SE). Download the Enterprise Edition SDK (J2EE SDK) and use the servlet.jar when compiling.

  • How to parse a XML stream sent to servlet with PUT method

    Hi,
    I have to interface my servlet app with other apps communicating with XML.
    This way, My servlet will receive a XML stream in the http request, parse it and send back a XML message.
    What I've done is :
    An html page to send a XML File with a put method :
    <form enctype="multipart/form-data" method="PUT" action="http://localhost:8080/MyApp/servlet/TestUploadServlet">
         <input type="file" size="20" name="FileToUpload" value="Select File">
         <input type="submit" name="UploadFile" value="Upload">
         <input type="reset" value="Reset">
    </form>
    A servlet TestUploadServlet with :
    SAXParser parser = new SAXParser( );
    Trace.traceLine( "SAXParser" );
    parser.setContentHandler (this);
    try {
    parser.parse( new InputSource( requete.getInputStream() ) );
    catch (SAXException e) {
    Trace.traceLine( e.getMessage() );
    catch (IOException e) {
    Trace.traceLine( e.getMessage() );
    and the methods startElement, stopElement and other to work with the elements detected by the parser (already used by other programs parsing local xml files).
    And it doesn't work.
    is the html code is a good way to send a file in the http Put method ?
    is the parser.parse( new InputSource( requete.getInputStream() ) ); a good method to read the stream ?
    please help.

    I think the problemn comes from the method used to send the <XML> stream.
    Using an html form doesn't seem to be a good method.
    I tried several methods or examples found and none of them seems to work.
    here is another example in the servlet side :
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream output = res.getOutputStream();
    output.println("ContentType: " + req.getContentType() + "<BR>");
    int content_length = req.getContentLength();
    output.println("ContentLength: " + content_length + "<BR>");
    if(content_length > 0) {
    output.println("Content: ");
    ServletInputStream input = req.getInputStream();
    byte [] buffer = new byte[1024];
    int nb;
    while((nb=input.read(buffer))!= -1) {
    output.write(buffer,0,nb);
    Can somebody tell me how to write a java code sending a http request with the content of a file in the content of the request ?

  • ERROR RENDERING PDF IN SERVLET WITH FORM method="post"

    Hello,
    we are trying to render a dinamic PDF document in a servlet building with XSL:FO apache or itext.
    The problem ocurs when we sending a Form data with method post, the output of the servlet is a blank page instead of the pdf document. Also if we send the form data with method "get" we can view the pdf document corretly.
    But we need to send amount information, and can?t use method get.
    Thank

    You can always use GET to send information by generating a dynamic URL in the query string (after the '?'). Granted, you don't want to send file data that way, but it will work for small numbers of arguments where privacy is not a concern.
    As to why you see the PDF in one instance and not another, I'm not sure. There is no difference from an HTTP standpoint. You sent a request, you are getting a response. The browser should treat the response the same, regardless of GET vs POST.
    Are you setting the content-type to application/pdf? Are you doing something fishy with Javascript? Do you have conditional logic in your code that fires on a POST but not on a GET that actually has a bug in it (since GET works but it was designed for POST)?
    - Saish
    "My karma ran over your dogma." - Anon

  • How to compile java servlet

    this the error i encounter.. i have read some of the posted topics on it but i dont understand how i can create my own classpath..where should i do that..what should i write...how i have to save it...pls help me...
    C:\currentyaazmin1\java>javac login2.java
    login2.java:9: Package javax.servlet.http not found in import.
    import javax.servlet.http.*;
    ^
    login2.java:11: Package javax.servlet not found in import.
    import javax.servlet.*;
    ^
    login2.java:16: Superclass HttpServlet of class login2 not found.
    public class login2 extends HttpServlet
    ^
    3 errors
    i have already installed jdk1.3 an jsdk2.1...i also copied javax folder from jsdk2.1 and pasted in c:....still i encouter the same thing... pls help

    Download j2ee is recommended to solve any compling such as servlets and swing
    http://java.sun.com/j2ee/download.html
    Once done all you do is include j2ee.jar and you have xml, servlets, rmi the works!! :)
    However since you download the servelet component only, search in you hard drive for ".jar" file.
    You can open the .jar file with a WinZip and you can check if it as javax.servlet.http.* by looking at the far right for javax/servlet/http
    Once you know the jar file to include. Next is to put it in the classpath. The most simple way using NT example, how Windows 95/98 is similar. Go to:
    Control Panel -> Double Click on System -> Click on Environment tab
    Type below in Variable: CLASSPATH
    Type in Value: PATH TO SERVLET;.;
    Don't forget the ;.; (the dot for currnet path to run)
    If you need to add more to the classpath, seperate by classpath.
    Log off and log back in as your user. No need to reset the machine.
    The system will pick the new CLASSPATH.
    Test on dos as "echo %CLASSPATH%" to see what its set to.

  • Utility for compiling java files with options.

    i want to create a utility application in java which can compile a java source file with options like -d , -classpath,-help etc.
    there is a java.lang.Compiler class which can be used to compile a source file but how can i supply compile time options?
    help.

    Welcome to the forum!
    >
    i want to create a utility application in java which can compile a java source file with options like -d , -classpath,-help etc.
    there is a java.lang.Compiler class which can be used to compile a source file but how can i supply compile time options?
    >
    Is this an interview question? An intellectual exercise to see if you can do it?
    Why do you want to do this when there is already a freely available utility, javac, that can already do all of that?
    Please provide more information and a sample user session that shows what you are really trying to accomplish.
    And the class you mentioned is not really for the purpose you say you want
    >
    The Compiler class is provided to support Java-to-native-code compilers and related services. By design, the Compiler class does nothing; it serves as a placeholder for a JIT compiler implementation.

  • Compiling java card with Eclipse

    Hi,
    I compiled and converted Java card code both from the command prompt and Eclipse in Windows XP and it worked just fine.
    However, while doing the same in Eclipse set up on a Linux(Ubuntu) machine, I am getting the following error:
    error: export file framework.exp of package javacard.framework not found.
    I have been searching around for answers to why this might be happening. However, I haven't found any. If anyone knows why, please help me out with this.
    Thanks a lot in advance.
    Best,

    Are you converting with an Eclipse plugin? If so what are you using?
    That error is because the converter can't find the EXP files from the JCDK. You may need to update a setting in the plugin to point to the JCDK.
    Cheers,
    Shane

  • Invoking BPEL process from Java servlet with org.w3c.dom.Element as payload

    Hello,
    I'm trying to initiate a BPEL process from my servlet running under Tomcat. When I create the NormalizedMessage passing the XML as a String everything works fine. But if I use an org.w3c.domElement the BPEL server doesn't react at all (even on DEBUG log level there are no outputs).
    This works:
    NormalizedMessage message = new NormalizedMessage();
    message.addPart("payload", "<foo></foo>");
    This doesn't work:
    org.w3c.dom.Element elem;
    oracle.xml.parser.v2.XMLDocument xmlDocument;
    NormalizedMessage message = new NormalizedMessage();
    Element elem = xmlDocument.createElement("foo");
    message.addPart("payload", elem);
    Is there a known problem with payloads using Element or did I get something completely wrong? Thanks in advance,
    Hans.

    Hello,
    I'm trying to initiate a BPEL process from my servlet running under Tomcat. When I create the NormalizedMessage passing the XML as a String everything works fine. But if I use an org.w3c.domElement the BPEL server doesn't react at all (even on DEBUG log level there are no outputs).
    This works:
    NormalizedMessage message = new NormalizedMessage();
    message.addPart("payload", "<foo></foo>");
    This doesn't work:
    org.w3c.dom.Element elem;
    oracle.xml.parser.v2.XMLDocument xmlDocument;
    NormalizedMessage message = new NormalizedMessage();
    Element elem = xmlDocument.createElement("foo");
    message.addPart("payload", elem);
    Is there a known problem with payloads using Element or did I get something completely wrong? Thanks in advance,
    Hans.

  • I need something fixed this is a Java Servlet with Wireless Multicasting

    I need help I can't get this thing debugged! Its a HTTP Servlet very standard but I can't get it to work
    import java.connection;
    import javax.servlet.http.HttpSession;
    // You need to import the java.sql package to use JDBC
    import java.sql.*;
    public class LoginServlet1 extends HttpServlet
    private Connection con=null;
    public LoginServlet1(Connection con){
    this.con=con;
    public Connection getConnection(){
    return con.con;
    public void doGet(HttpServletRequest request,HttpServletResponse response){
    PrintWriter writer = response.getWriter();
    HttpSession session = request.getSession(true);
    String username = null;
    String password = null;
    String strHTML      = "";
    boolean success = false;
    if (((username=null) || (username.compareTo("null")==0)))
    strHTML = strHTML + "<title> Lab #11 Login Error </title>";
    strHTML = strHTML + "</head>";
    strHTML = strHTML + "<body bgcolor=white>";
    strHTML = strHTML + "Massive Error --- you need to provide a username ...please try again ...<BR><BR>";
    strHTML = strHTML + "Back to the login page ..<A HREF=\"../login.html\"> click here </A>";
    strHTML = strHTML + "</body>";
    strHTML = strHTML + "</html>";
    success = false;
    else if (((password=null) || (password.compareTo("")==0)))
    strHTML = strHTML + "<title> Lab #11 Login Error </title>";
    strHTML = strHTML + "</head>";
    strHTML = strHTML + "<script language="JavaScript">";
    strHTML = strHTML + "<body bgColor=white>";
    strHTML = strHTML + "Massive Error --- you need to provide a password ... please try again ...<BR><BR>";
    strHTML = strHTML + "Back to the login page ...<A HREF=\"../login.html\"> click here </A>";
    strHTML = strHTML + "</script>";
    strHTML = strHTML + "</body>";
    strHTML = strHTML + "</html>";
    success = false;
    else if then;
    try
    // Load Oracle driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    LoginServlet1 holder=(LoginServlet1) session.getValue("servletapp.connection");
    if(holder==null){
    try{
    holder= new LoginServlet1(DriverManager.getConnection("jdbcoracle:thin:@macha.wit.ie:1521:MACH"));
    session.putValue("servletapp.connection",holder);
    catch(SQLException e){
    getServletContext().log(e, "No");
    catch(SQLDatabas + i)());
    success= true;
    catch (SQLException sql.tiny() );
    strHTML = strHTML + "connection failed ....<BR>";
    if (sql.tiny.getErrorCode()=Failed Connection)
    strHTML = strHTML + "OOPS !!! wrong username or password...please try again ...<BR>";
    else
    strHTML = strHTML + "SQL Error happened ....<BR>";
    strHTML = strHTML + "Error Number = " + sqlex.getErrorCode() + "<BR>";
    strHTML = strHTML + "Error Message = " + sqlex.getMessage() + "<BR>";
    strHTML = strHTML + "ah common cheer up, it's not the end of the world...<BR>";
    strHTML = strHTML + "Back to the login page<A HREF=\"../login.html\"> click here </A>";
    success = false;
    if (success)
    try
    getServletConfig().getServletContext().getRequestDispatcher("/WEB-INF/jsp/query.jsp").forward(request,response);
    catch = null(Exception ex) {
    ex.printStackTrace ();
    ex.printHTTP();
    stmt.err();

    the problem is?

  • Calling one java program (with main method) from another

    Hello,
    How can I start another java program from one? Lets
    say I want Second.java to start by calling it from
    First.java. How do I do it? The two programs are given
    below. Any help is appreciated.
    Thanks,
    Amanda
    First.java
    import java.io.*;
    import java.lang.reflect.*;
    public class  First
         public static void main(String[] args)
              Process theProcess=null;
              System.out.println("Hello World from First.java!");
              String second=new String("Second.java");
              //System.load(second);
              //Runtime.getRuntime().load(second);
              try
                   theProcess=Runtime.getRuntime().exec( "Second.java"
                   System.out.println("after exec");
              catch (IOException ioe)
                   System.out.println(">>IOException thrown in
    First.java while calling
    Second.java."+ioe.getMessage());
    Second.java
    public class  Second
         public static void main(String[] args)
              System.out.println("Hello World from Second.java!");
    }

    Stop posting here. The crosspost remark was to alert others that there is a duplicate topic - all answers should be centralized in one so as to not waste people's time duplicating answers when they don't see both topics and the answers therein.

Maybe you are looking for

  • Passing different values to the same servlet

    Hi, Is there a way to pass different values to the same servlet? Background: I have a database that I query to acquire a list of customers, then I show each customer as a link, that when clicked will show details of that customer. (The customer table

  • DTW template for Inventory balance

    Dear All, what is the template for migration of batch wise inventory balances. also let me know what are the mandatory fields. prince

  • Multiple data sources Essbase and RDBMS in BIEE 11g

    Hi, I want to link Essbase cube with sql server in BIEE 11. I try to do it and I found that it can be linked in physical layer, but it does not allow me to set linkage in "Business Model and Mapping" layer. when I drag and drop a report and it return

  • Question about suming two columns from different tables in Subquery?

    Hello everyone, I have a subquery that works great for getting the total SUM of a Billing table, but I also need to add to that SUM the total surcharges or additional charges from a separate table.  I tried this by doing something like so: (SELECT SU

  • Lightroom color not consistant with PSCS4/Bridge. Help please.

    Hi All, I started with a search, but didn't find an answer that covered what I'm seeing. OK, first of all, let me set this. I'm running a MacBook Pro 2.2, OSX 10.6, with a 23" Apple Cinema Display (non-glossy screen) attached as my main work monitor