Problems with exec() in Servlet

Hi All,
In my project i have used exec()in servlets to get the ouput from the c- program.I am using linux 8.0 and the server is tomcat-4.1.24.so that i try this following code:-
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletExecute extends HttpServlet
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
String[] command={"/bin/csh","-c","home/anand/Ananth/grpmaschk.run sptest S"};/*Here the grpmaschk.run is a c-program which genarates an output that is passed to sptest as parameter and S is a argument which indicates the action is done from Servlet*/
res.setContentType("text/plain");
PrintWriter out=res.getWriter();
Process p=null;
Runtime rt=Runtime.getRuntime();
try
p=rt.exec(command);//Executing the action on command string
catch(Exception e)
out.println("The Error Message is:"+e.getMessage());
try
FileInputStream fin=new FileInputStream("/home/Ananth/sptest");/*
Once the output is generated from the c-program it will be stored in the sptest in /home/Ananth */
BufferedReader br =new BufferedReader(new InputStreamReader(fin));
String line=null;
while((line=br.readLine())!=null)
out.println(line); //From there i am reading the contents in it to be displayed in the browser
} catch(Exception e1)
out.println("The error message was:"+e1.getMessage());
Whren it is displayed in the browser i am getting an error
/home/Ananth/sptest not found which means that exec() is not working (or)executing.What is the problem here ???Plz. do provide a solution for this.It is quite Urgent.I will be waiting for ur replies.
Thanx,
m.ananthu

Hi sir,
Sorry for the mistake i did there but by using /home/....
also the output is not coming.
Here is the code again for ur reference:-
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletExecute extends HttpServlet
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
String[] command={"/bin/csh","-c","/home/anand/Ananth/grpmaschk.run","home/anand/Ananth/sptest S"};//corrected one
res.setContentType("text/plain");
PrintWriter out=res.getWriter();
Process p=null;
Runtime rt=Runtime.getRuntime();
try
p=rt.exec(command);
catch(Exception e)
out.println("The Error Message is:"+e.getMessage());
try
FileInputStream fin=new FileInputStream("/home/anand/Ananth/sptest");
BufferedReader br =new BufferedReader(new InputStreamReader(fin));
String line=null;
while((line=br.readLine())!=null)
out.println(line);
} catch(Exception e1)
out.println("The error message was:"+e1.getMessage());
Here exec(....) is going through but the path in FileInputStream is showing an error.The error message i got when i run it in the browser is :-
The error message was:/home/anand/Ananth/sptest (No such file or directory).Which means exec() function itself is not executed???. Is there any thing to do with security reasons or anything u need to configure in the tomcat configuration file??? Where i found that
when i give /home/anand/Ananth/grpmaschk.run only in the exec() then the output is diaplyed in the browser.So i think exec() is workuing well but not with this huge argument
String[] command={"/bin/csh","-c","/home/anand/Ananth/grpmaschk.run","home/anand/Ananth/sptest S"};
Pls. do provide a solution for this problem.I will be waiting for ur replies.....
Thanx,
m.ananthu

Similar Messages

  • Problem with Sessions in Servlets

    Hi,
    I'm having a problem with sesions with servlets. It seems that if someone logs into my website, which is running on all servlets, while another person is logged on, the second person gets the session of the first person.
    I'm using
    HttpSession session = request.getSession(true);to get the session in each page. The session contains a user object which shows if the user is logged in and what permissions.
    The session should be unique to the client computer right? Or am I jsut screwing this up big time?

    Yes, each client will have their own session. However, you may be testing incorrectly:
    In Firefox, for example, all instances of the application running on the same machine will share the same cookies, therefore the same session, and would be considered one client.
    MS IE will do the same if you use File - New to open a new wondow rather than clicking on the desktop icon.
    If the different clients are using different machines and still getting shared data, then you may be using class-level variables in the servlet, which would not be thread safe and could lead to your problems...
    public class MyServlet extends HttpServlet {
      String data;  //bad
      int moredata; //bad
      public void doGet(...) ... { ... }
    }

  • Problem with logout in servlet After logging out i need to expire the pages

    I have a problem in logout using servlet.
    I introduced sessions in my page and while logout i used
    session.removeAttribute("name");
    session.removeAttribute("password");
    res.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
         res.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
         res.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
    String user=(String)session.getAttribute("name");
              System.out.println(user);
              if(user==null)
                   System.out.println("hi");
                   req.setAttribute("Error", "Session has ended. Please login.");
                   res.sendRedirect("http://localhost:8080/homepage.html");
    and after i logout im redirected to login page but after clicking back button im getting back to restricted pages(the pages b4 logout).
    what should i do?????

    Thanks Dear BalusC,
    I tried with this,
    rs.getString("DATA_SCAD1")// where the source from .xls files
    String pattern = "yyyy-MM-dd";
    SimpleDateFormat format = new SimpleDateFormat(pattern);
    try {
    Date date = format.parse("DATA_SCAD1");
    System.out.println(date);
    } catch (ParseException e) {
    e.printStackTrace();
    System.out.println(format.format(new Date()));
    this out put gives me Tue Apr 03 00:00:00 IST 2007
    But I want to display the date format in yyyy-mm-dd.
    regards,
    maza

  • Problem with running multiple servlet in same webapplication with tomcat 3

    Hi all,
    I am using Tomcat 3.0 as webserver with jdk1.3, Servlet 2.0,
    Templates for html file and oracle 8i on UNIX platform.
    I have problem with multiple servlet running same webapplication.
    There are two servlet used in my application. 1) GenServlet.class
                   and 2) ServletForPrinting.class
    All of my pages go through GenServlet.class which reads some property files
    and add header and footer in all pages.
    I want reports without header & footer that is not possible through GenServlet in my application.
    So I have used another servlet called ServletForPrinting --- just for reading html file.
    It is as follow:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ServletForPrinting extends HttpServlet {
    public void service (HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IOException
    // set content-type header before accessing the Writer
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    File f1 = null;
    String report = null;
    String path = request.getPathInfo();
    try{
    String p = "/var/home/latif/proj/webapps/WEB-INF/classes" + path;
    System.out.println(p);
    f1 = new File(p);
    p = null;
    if (f1.exists()) {
    FileReader fr = new FileReader(f1);
    BufferedReader br = new BufferedReader(fr);
    report = new String();
    while ((report = br.readLine()) != null) {
    out.println(report);
    }catch(Exception e) {
    out.close();
    report = null;
    path = null;
    f1 = null;
    } // end class
    It works fine and display report properly.
    But now Problem is that if report is refreshed many times subsequently,
    WebServer will not take any new change in any of java file used in web-application.
    It works with the previous class only and not with updated one.
    Then I need to touch it. As soon as I touch it, webserver will take updated class file.
    Anybody has any idea regarding these situation?
    Is there any bug in my ServletForPrinting.java ?
    Any solution ????? Please suggest me.
    Suggestion from all are invited. That will help me a lot.
    Thanks in advance
    Deepalee.

    Llisas wrote:
    I solved the problem, I just had to wire the blocks in a sequential way (I still don't know why, but it works).
    Feel free to delete this topic.
    I would strongly suggest at least reading this tutorial to give you an idea of why your fix worked (or maybe only appeared to work).  Myself, I never just throw up my hands and say, "Whatever," and wash my hands of the situation without trying my best to understand just what fixed it.  Guranteed you'll run into the same/similar problem and this time your fix won't work.
    Please do yourself a favor and try to understand why it is working now, and save yourself (or more likely, the next poor dev to work on this project) some heartache.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Problems with file uploading servlet, the form action doesnt capture url

    Hi, i have one problem. I am working on a project , i have created a servlet that takes uploaded files and processses them and links them back to user to download. The servlet works perfectly from my computer, I am using apache-tomcat-6.0.16 and java 1.6 , I have two forms called encrypt.html and decrypt.html, I will post both of them, now the problem is when somebody access it on the internet while i am running apache, they get a connection was reset on a firefox browser and same stuff on Internet Explorer.
    i have checked my server logs and saw nothing unusual there, So please if you can help me, it is my project.
    I am pasting html file and error message that other users where getting remotely.
    <html>
    <head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <title>Stego Form</title>
    <link rel='STYLESHEET' type='text/css' href='encrypt.css'>
    </head>
    <body>
    <center>
    <form name='encrypt' enctype='multipart/form-data' method='POST' action='http://localhost:8080/examples/temp2
    ' accept-charset='UTF-8'>
    <input type='hidden' name='sfm_form_submitted' value='yes'>
    </input>
    <input type='hidden' name='eord' value='e'>
    <select name='encryption' size='1'>
             <option value='Select an encryption' selected>
             Select an encryption
             </option>
             <option value='DES'>
             DES
             </option>
             <option value='Tripple DES'>
             Tripple DES
             </option>
    </select>
             <input type='file' name='overt' size='20'>
             <input type='file' name='covert' size='20'>
             <input type='submit' name='submit' value='Submit'>
    </form>
    </center>
    </body>
    </html>so it works for me even if i access the page with my ip , but for others it doesnt work,
    now the user got this xhtml page that i will show, i cant find attach button so i am pasting here.
    here is the servlet coding
    import java.io.*;
    import java.util.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    import org.apache.commons.fileupload.*;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    public class temp2 extends HttpServlet
        FileInputStream fin;
        String filenames[] = new String[2],fieldname,fieldval;
        String keyfile,IVfile;
        String names[] = new String[2];
        public temp2()
            super();
        @Override
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
            doPost(request, response);
        @Override
        public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
            String eord="";
            List lst = null;
            boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
            if (!isMultiPart) // check whether the post request is actually multipart
                System.out.println("ERROR NOT MULTIPART");
                System.exit(0);
            DiskFileItemFactory fif = new DiskFileItemFactory();
            ServletFileUpload sfu = new ServletFileUpload(fif);
            sfu.setSizeMax(10000000);
            try {  lst = sfu.parseRequest(request);  }
            catch (FileUploadException ex)
            { System.out.println("ERROR IN PARSING FILES" + ex); System.exit(0);  }
            if(lst.isEmpty())  // check whether request is empty
                System.out.println("ERROR LIST SIZE NOT GOOD : " + lst.size());
                System.exit(0);
            Iterator x = lst.iterator();
            int i = 0;
            FileItem f = (FileItem)x.next();
            f = (FileItem)x.next();
            System.out.println(f.getFieldName());
            if(f.getFieldName().equalsIgnoreCase("eord")) // check hidden field to know the case : encrypt or decrypt
                eord = f.getString();
                System.out.println(f.getString());
            else // if it is not first field exit
                System.out.println("Invalid FORM");
                System.exit(0);
            f = (FileItem)x.next(); // next field
            if(f.getFieldName().equalsIgnoreCase("encryption")) // type of encryption des / tdes
                fieldname = f.getFieldName();
                fieldval = f.getString();
                System.out.println(f.getString());
            if(eord.equalsIgnoreCase("e")) // if it is encryption form only file required
                while(x.hasNext())
                    f = (FileItem)x.next();
                    if(!f.isFormField())
                        int check = f.getName().lastIndexOf(File.separator);
                        System.out.println(File.separator);
                        if(check==-1)
                            System.out.println(f.getName());
                            System.out.println("Unsupported browser : " + check);
                            System.exit(0);
                        File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
                        names[i] = ff.getName(); // original file names
                        try
                            f.write(ff);
                            filenames[i] = ff.getAbsolutePath();
                        // renamed    
                            ff.deleteOnExit();
                        }catch(Exception e) {System.out.println("Error writing file"+ ff.getAbsolutePath()); System.exit(0);}
                        i++;
                    try { System.in.read(); } catch(Exception e) {}
                }// endwhile
                if(fieldval.equalsIgnoreCase("DES"))
                    System.out.println("DES 1"+filenames[1]);
                    javades o = new javades(filenames[1]); // the file to be encrypted   
                    filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
                    System.out.println("should be original" + filenames[1]);
                else if(fieldval.equalsIgnoreCase("Tripple DES"))
                    javatdes o = new javatdes(filenames[1]);
                    filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
                    System.out.println(filenames[1]);
                System.out.println("Calling stego");
                filenames[0] = "e:\\apache\\webapps\\temp\\" + names[0];
                System.out.println("file 1 "+ filenames[0]);
                System.out.println("file 2"+ filenames[1]);
                try { System.in.read(); } catch(Exception e) {}
                stego s = new stego(filenames[0],filenames[1]);
                System.out.println("mainext " + s.mainext);
                // encryption done, and new files are loaded, now lets hide
                if(s.mainext.equalsIgnoreCase("wav"))
                    s.encodewav();
                    System.out.println("Encoded wave");
                else if(s.mainext.equalsIgnoreCase("bmp"))
                    System.out.println("Encoded bmp");
                    s.encodebmp();
                System.out.println("done !");
                PrintWriter pr = response.getWriter();
                pr.println("Greetings , Your work is done and saved, now download the following files");
                pr.println("The secret key file is needed for getting back your hidden file, so download that too");
                pr.write("<a href=\"/temp/files/IV.txt\">click here</a>");
                pr.write("<br/><a href=\"/temp/files/key.txt\">click here</a>");
                pr.write("<br/><a href=\"/temp/files/"+names[0]+"\">click here</a>");
                return;
            // if it is decryption case
            else if(eord.equalsIgnoreCase("d"))
                while(x.hasNext())
                    f = (FileItem)x.next();
                    if(!f.isFormField())
                        int check = f.getName().lastIndexOf(File.separator);
                        System.out.println(File.separator);
                        if(check==-1)
                            System.out.println(f.getName());
                            System.out.println("Unsupported browser : " + check);
                            System.exit(0);
                        File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
    // else if ladder to store paths of stegofile keyfile and IVfile                   
                        if(f.getFieldName().equalsIgnoreCase("stegofile"))
                            filenames[0] = ff.getAbsolutePath();
                        else if(f.getFieldName().equalsIgnoreCase("keyfile"))
                            keyfile = ff.getAbsolutePath();
                        else if(f.getFieldName().equalsIgnoreCase("IVfile"))
                            IVfile = ff.getAbsolutePath();
                        try
                            f.write(ff); // writes whole file at once
                        }catch(Exception e) {System.out.println("Error writing file"); System.exit(0);}
                }// endwhile
                System.out.println("Calling stego");
                System.out.println("file 1 "+ filenames[0]);
                stego s = new stego(filenames[0]);
                System.out.println("mainext " + s.mainext);
                if(s.mainext.equalsIgnoreCase("wav"))
                    s.decodewav();
                    System.out.println("Encoded wave");
                else if(s.mainext.equalsIgnoreCase("bmp"))
                    s.decodebmp();
                    System.out.println("Encoded bmp");
                System.out.println("done !");
                ////// hidden file has been retrieved , now lets decrypt it
                System.out.println("ext " + s.ext);
                filenames[0] = "e:\\apache\\webapps\\temp\\"+s.filename;
                System.out.println(filenames[0]);
                System.out.println(keyfile);
                System.out.println(IVfile);
                if(fieldval.equalsIgnoreCase("DES"))
                    javades o = new javades(filenames[0],keyfile,IVfile); // the file to be encrypted   
                    filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
                    System.out.println("should be original" + filenames[0]);
                else if(fieldval.equalsIgnoreCase("Tripple DES"))
                    javatdes o = new javatdes(filenames[0],keyfile,IVfile);
                    filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
                    System.out.println(filenames[0]);
                PrintWriter pr = response.getWriter();
                pr.write("Greetings, you have successfully retrieved your hidden file, now download it from here <br>");
                pr.write("<a href=\"http://localhost:8080/temp/files/" + (new File(filenames[0]).getName())+"\">Click here</a>");
    }and here is the xhtml file the user receives, whe he clicks the submit button,
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html [
      <!ENTITY % htmlDTD
        PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "DTD/xhtml1-strict.dtd">
      %htmlDTD;
      <!ENTITY % netErrorDTD
        SYSTEM "chrome://global/locale/netError.dtd">
      %netErrorDTD;
    <!ENTITY loadError.label "Problem loading page">
    <!ENTITY retry.label "Try Again">
    <!-- Specific error messages -->
    <!ENTITY connectionFailure.title "Unable to connect">
    <!ENTITY connectionFailure.longDesc "&sharedLongDesc;">
    <!ENTITY deniedPortAccess.title "This address is restricted">
    <!ENTITY deniedPortAccess.longDesc "">
    <!ENTITY dnsNotFound.title "Server not found">
    <!ENTITY dnsNotFound.longDesc "
    <ul>
      <li>Check the address for typing errors such as
        <strong>ww</strong>.example.com instead of
        <strong>www</strong>.example.com</li>
      <li>If you are unable to load any pages, check your computer's network
        connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that &brandShortName; is permitted to access the Web.</li>
    </ul>
    ">
    <!ENTITY fileNotFound.title "File not found">
    <!ENTITY fileNotFound.longDesc "
    <ul>
      <li>Check the file name for capitalization or other typing errors.</li>
      <li>Check to see if the file was moved, renamed or deleted.</li>
    </ul>
    ">
    <!ENTITY generic.title "Oops.">
    <!ENTITY generic.longDesc "
    <p>&brandShortName; can't load this page for some reason.</p>
    ">
    <!ENTITY malformedURI.title "The address isn't valid">
    <!ENTITY malformedURI.longDesc "
    <ul>
      <li>Web addresses are usually written like
        <strong>http://www.example.com/</strong></li>
      <li>Make sure that you're using forward slashes (i.e.
        <strong>/</strong>).</li>
    </ul>
    ">
    <!ENTITY netInterrupt.title "The connection was interrupted">
    <!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
    <!ENTITY netOffline.title "Offline mode">
    <!ENTITY netOffline.longDesc "
    <ul>
      <li>Uncheck "Work Offline" in the File menu, then try again.</li>
    </ul>
    ">
    <!ENTITY netReset.title "The connection was reset">
    <!ENTITY netReset.longDesc "&sharedLongDesc;">
    <!ENTITY netTimeout.title "The connection has timed out">
    <!ENTITY netTimeout.longDesc "&sharedLongDesc;">
    <!ENTITY protocolNotFound.title "The address wasn't understood">
    <!ENTITY protocolNotFound.longDesc "
    <ul>
      <li>You might need to install other software to open this address.</li>
    </ul>
    ">
    <!ENTITY proxyConnectFailure.title "The proxy server is refusing connections">
    <!ENTITY proxyConnectFailure.longDesc "
    <ul>
      <li>Check the proxy settings to make sure that they are correct.</li>
      <li>Contact your network administrator to make sure the proxy server is
        working.</li>
    </ul>
    ">
    <!ENTITY proxyResolveFailure.title "Unable to find the proxy server">
    <!ENTITY proxyResolveFailure.longDesc "
    <ul>
      <li>Check the proxy settings to make sure that they are correct.</li>
      <li>Check to make sure your computer has a working network connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that &brandShortName; is permitted to access the Web.</li>
    </ul>
    ">
    <!ENTITY redirectLoop.title "The page isn't redirecting properly">
    <!ENTITY redirectLoop.longDesc "
    <ul>
      <li>This problem can sometimes be caused by disabling or refusing to accept
        cookies.</li>
    </ul>
    ">
    <!ENTITY unknownSocketType.title "Unexpected response from server">
    <!ENTITY unknownSocketType.longDesc "
    <ul>
      <li>Check to make sure your system has the Personal Security Manager
        installed.</li>
      <li>This might be due to a non-standard configuration on the server.</li>
    </ul>
    ">
    <!ENTITY sharedLongDesc "
    <ul>
      <li>The site could be temporarily unavailable or too busy. Try again in a few
        moments.</li>
      <li>If you are unable to load any pages, check your computer's network
        connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that &brandShortName; is permitted to access the Web.</li>
    </ul>
    ">
      <!ENTITY % globalDTD
        SYSTEM "chrome://global/locale/global.dtd">
      %globalDTD;
    ]>
    <!-- ***** BEGIN LICENSE BLOCK *****
       - Version: MPL 1.1/GPL 2.0/LGPL 2.1
       - The contents of this file are subject to the Mozilla Public License Version
       - 1.1 (the "License"); you may not use this file except in compliance with
       - the License. You may obtain a copy of the License at
       - http://www.mozilla.org/MPL/
       - Software distributed under the License is distributed on an "AS IS" basis,
       - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
       - for the specific language governing rights and limitations under the
       - License.
       - The Original Code is mozilla.org code.
       - The Initial Developer of the Original Code is
       - Netscape Communications Corporation.
       - Portions created by the Initial Developer are Copyright (C) 1998
       - the Initial Developer. All Rights Reserved.
       - Contributor(s):
       -   Adam Lock <[email protected]>
       -   William R. Price <[email protected]>
       -   Henrik Skupin <[email protected]>
       -   Jeff Walden <[email protected]>
       - Alternatively, the contents of this file may be used under the terms of
       - either the GNU General Public License Version 2 or later (the "GPL"), or
       - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
       - in which case the provisions of the GPL or the LGPL are applicable instead
       - of those above. If you wish to allow use of your version of this file only
       - under the terms of either the GPL or the LGPL, and not to allow others to
       - use your version of this file under the terms of the MPL, indicate your
       - decision by deleting the provisions above and replace them with the notice
       - and other provisions required by the LGPL or the GPL. If you do not delete
       - the provisions above, a recipient may use your version of this file under
       - the terms of any one of the MPL, the GPL or the LGPL.
       - ***** END LICENSE BLOCK ***** -->
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Problem loading page</title>
        <link rel="stylesheet" href="temp2_files/netError.css" type="text/css" media="all"/>
        <!-- XXX this needs to be themeable -->
        <link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAICSURBVHjaYvz//z8DJQAggJhwiDPvnmlzc2aR0O+JGezt+AwACCCsBhxfYhn59N41FWtXIxZOLu70niRGXVwGAAQQNgNYHj96O8HaWYdJW5ubwd4/mI2Ng7sblwEAAYRhwMm1URk/vn4SUNWVYGD8+YZBXZOZm5OLzRjoCmNsBgAEEKoBN82Y7l851GLrqMjM8Oc7A8O/3wwMP54wuAQFCXNycUzGZgBAAKEYcOaKZO2/f//5FbUVgBrfMoRVcgHpNwyKGjKMXDwCan0prFboBgAEELIBzDcvXyy2cVZhYPj9GWj7H4jo/38MDJ9OMDj7O/KzsjH3oxsAEEBwA/bNNipiZf7FI6cqwcDw8x2qqp8fGORUpVn4BEXlgGHhhCwFEEAwA9gfP3hdZ+Oizcjw+wvCdjgAuuLrFQbXIH9hTm7uqcgyAAEENuD4ctcebm5mbikFYRTbV7V/Q6j88Z5BSuY7q4CQgAjQFR4wYYAAAhtw89L5ZFsnRaDtn4CW/YXrAQcisit+PGVwDgrnZ2NnnwATBQggpsNLvGYLCAmxi8tLARWg+h3FBVBXSEj/ZZWQkRcCuiIQJAQQQCyvnj5KMDTkZ2JgYmRg4FchnHv+vmEwttLmeXT3VjKQtx4ggFgk5TXebV63UfT3ijOMxOZAVlZWdiB1EMQGCCBGSrMzQIABAFR3kRM3KggZAAAAAElFTkSuQmCC"/>
        <script type="application/x-javascript"><![CDATA[
          // Error url MUST be formatted like this:
          //   moz-neterror:page?e=error&u=url&d=desc
          // Note that this file uses document.documentURI to get
          // the URL (with the format from above). This is because
          // document.location.href gets the current URI off the docshell,
          // which is the URL displayed in the location bar, i.e.
          // the URI that the user attempted to load.
          function getErrorCode()
            var url = document.documentURI;
            var error = url.search(/e\=/);
            var duffUrl = url.search(/\&u\=/);
            return decodeURIComponent(url.slice(error + 2, duffUrl));
          function getDescription()
            var url = document.documentURI;
            var desc = url.search(/d\=/);
            // desc == -1 if not found; if so, return an empty string
            // instead of what would turn out to be portions of the URI
            if (desc == -1) return "";
            return decodeURIComponent(url.slice(desc + 2));
          function retryThis()
            // Session history has the URL of the page that failed
            // to load, not the one of the error page. So, just call
            // reload(), which will also repost POST data correctly.
            try {
              location.reload();
            } catch (e) {
              // We probably tried to reload a URI that caused an exception to
              // occur;  e.g. a non-existent file.
          function initPage()
            var err = getErrorCode();
            // if it's an unknown error or there's no title or description
            // defined, get the generic message
            var errTitle = document.getElementById("et_" + err);
            var errDesc  = document.getElementById("ed_" + err);
            if (!errTitle || !errDesc)
              errTitle = document.getElementById("et_generic");
              errDesc  = document.getElementById("ed_generic");
            var title = document.getElementById("errorTitleText");
            if (title)
              title.parentNode.replaceChild(errTitle, title);
              // change id to the replaced child's id so styling works
              errTitle.id = "errorTitleText";
            var sd = document.getElementById("errorShortDescText");
            if (sd)
              sd.textContent = getDescription();
            var ld = document.getElementById("errorLongDesc");
            if (ld)
              ld.parentNode.replaceChild(errDesc, ld);
              // change id to the replaced child's id so styling works
              errDesc.id = "errorLongDesc";
            // remove undisplayed errors to avoid bug 39098
            var errContainer = document.getElementById("errorContainer");
            errContainer.parentNode.removeChild(errContainer);
        ]]></script>
      </head>
      <body dir="ltr">
        <!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
        <!-- PAGE CONTAINER (for styling purposes only) -->
        <div id="errorPageContainer">
          <!-- Error Title -->
          <div id="errorTitle">
            <h1 id="errorTitleText">The connection was reset</h1>
          </div>
          <!-- LONG CONTENT (the section most likely to require scrolling) -->
          <div id="errorLongContent">
            <!-- Short Description -->
            <div id="errorShortDesc">
              <p id="errorShortDescText">The connection to the server was reset while the page was loading.</p>
            </div>
            <!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
            <div id="errorLongDesc">
    <ul>
      <li>The site could be temporarily unavailable or too busy. Try again in a few
        moments.</li>
      <li>If you are unable to load any pages, check your computer's network
        connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that Firefox is permitted to access the Web.</li>
    </ul>
    </div>
          </div>
          <!-- Retry Button -->
          <xul:button xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="errorTryAgain" label="Try Again" oncommand="retryThis();"/>
        </div>
        <!--
        - Note: It is important to run the script this way, instead of using
        - an onload handler. This is because error pages are loaded as
        - LOAD_BACKGROUND, which means that onload handlers will not be executed.
        -->
        <script type="application/x-javascript">initPage();</script>
      </body>
    </html>thank you for your prompt reply in advance,
    Regards,
    Mihir Pandya

    Hi, thank you for your replies, I found out few things about my servlet, and its portability
    and i have few questions, although i marked this topic as answered i guess its ok to post
    I am using javax.servlet.context.tempdir to store my files in that servletcontext temporary directory. But i dont know how to give hyperlink
    of the modified files to the user for them to download the modified files.
    What i am using to get the tempdir i will paste
    File baseurl = (File)this.getServletContext().getAttribute("javax.servlet.context.tempdir");
    System.out.println(baseurl);
    baseurl = new File(baseurl.getAbsolutePath()+File.separator+"temp"+File.separator+"files");
    baseurl.mkdirs();so i am storing my files in that temp/files folder and the servlet processes them and modifies them, then how to present them as
    links to the user for download ?
    and as the servlet is multithreaded by nature, if my servlet gets 2 different requests with same file names, i guess one of them will be overwritten
    And i want to create unique directory for each request made to the servlet , so file names dont clash.
    one another thing is that i want my servlet to be executed by my <form action> only, I dont want the user to simply type url and trigger the servlet
    Reply A.S.A.P. please..
    Thanks and regards,
    Mihir Pandya

  • Problem with my applet-servlet comunication

    Hello:
    I'm using a dynamic chart on my applet, which gets the data from a servlet, by URLConnection. These service work, but after a moment, the chart scroll is stopped and I get the next error on java console:
    java.security.AccessControlException: access denied (java.net.NetPermission
    getProxySelector)
    at
    java.security.AccessControlContext.checkPermission(AccessControlContext.java
    :264)
    at java.security.AccessController.checkPermission(AccessController.java:427)
    at
    java.lang.SecurityManager.checkPermission(Ljava.security.Permission;)V(Unkno
    wn Source)
    at
    sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:6
    61)
    at jfch.AppletGraphic$DataGenerator.sendCommand(AppletGraphic.java:307)
    at jfch.AppletGraphic$DataGenerator.actionPerformed(AppletGraphic.java:259)
    at javax.swing.Timer.fireActionPerformed(Timer.java:271)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
    va:234)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
    :163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.
    The applet make request to servlet by URLConection permanently, which gets
    the data from SQL Server.
    I'm using JVM 1.5.
    The applet makes requests to servlet by normally url, not access to local resources (or file system).
    Please can anyone help me?
    Regards, Ulises.

    http://java.sun.com/j2se/1.5.0/docs/api/java/net/ProxySelector.html
    Selects the proxy server to use, if any, when connecting to the network resource
    referenced by a URL. A proxy selector is a concrete sub-class of this class and is
    registered by invoking the setDefault method. The currently registered proxy selector
    can be retrieved by calling getDefault method.
    The getDefault Throws:
    SecurityException - If a security manager has been installed and it denies
    NetPermission("setProxySelector")
    http://java.sun.com/j2se/1.5.0/docs/api/java/net/NetPermission.html
    getProxySelector
    The ability to get the proxy selector used to make decisions on which proxies
    to use when making network connections.
    Malicious code can get a ProxySelector to discover proxy hosts and ports on
    internal networks, which could then become targets for attack.
    I checked my java.policy for my w2k jre 1.5 installation but could not find any specific
    NetPermission in there. I never had this problem using URL and URLConnections
    in 1.5 but it sounds strange that creating an URL in an applet could throw a
    SecurityException with the default jre 1.5 installation (both objects are introduced
    since 1.5).
    If you are using windows could you open the java control panel and select "use
    browser settings" in the General tab after clicking the "Network settings" button?
    I have this option in my jre settings and never got that Exception.

  • Problems with EJB and Servlet

    I'm doing a simple servlet that invokes an EJB taht returns an ArrayList with a values.
    My problem is that I do trace of my execution an this woks well in the EJB but when my remothe method do the return the app finish and never return to servlet that invoked it. I don't know 'cause this happend.
    I'm using WASD 5.0.1 as my Web y EJB container.
    Help would be appreciate

    What does that ArrayList contain?
    Could you post the code please.

  • Problem with form or servlet???

    hello..
    i am trying to send some form data to a servlet for processing..
    here is the code for the form
    <table border="0">
    <form action="details.upd" method="post" name="upd">
    <tr><td>Username</td><td><input name="uname" type="text" size="25" maxlength="30"
    value=<%=session.getAttribute("user") %> /></td>
    </tr>
         <tr>
    <td>password</td><td><input name="pass" type="password" size="25" maxlength="30" />
    </td></tr>
    <tr><td>confirm password</td><td><input name="pass2" size="25" maxlength="30" type="password"/></td></tr>
    <tr><td>Email</td><td><input name="mail" type="text" size="25" maxlength="30"
    value=<%=session.getAttribute("EMAIL") %> /></td></tr>
    <tr><td align="center"><input name="submit" type="button" value="Update" /></td></tr>
    <tr><td align="center"><input name="ch" type="hidden" value="det"/></td></tr>
    </form>
    </table>
    here is the web.xml entry for my compiled servlet
    <servlet>
    <servlet-name>update</servlet-name>
    <description>
    Servlet used for updates sent from landlord sessions
    </description>
    <servlet-class>UpdateServlet</servlet-class>
    <load-on-startup>5</load-on-startup>
    </servlet>
         <servlet-mapping>
    <servlet-name>update</servlet-name>
    <url-pattern>*.upd</url-pattern>
    </servlet-mapping>
    the problem is that when i click the submit button to send the data, nothing happens....absolutely nothing. the page just stays as it is...please can u spot any fatal error in the code?
    I have looked and looked without success..please help

    yeah..i solved that.. but now i am getting another
    problem...
    why does this code...
    Stringuser=(String)session.getAttribute("user");
    gives me a class cast exception????
    please helpBecause the object named "user" in your session isn't
    a String.ok...thks

  • Problem with JSP and servlet in Tomcat

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

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

  • Problem with name of Servlet Class

    Hi to all,
    I have a class named AClassName and it work fine when a spider come in my web site he try to connect to the class named aclassname. I try to create a class with all lower case letter, but in windows system it's not possibile to have in the same directory a file named AClassName.class and one with the name aclassname.class
    Any help will be appreciated
    Regards
    Rinaldo

    you can solve this using servlet mapping,
    which is the correct way to call servlets,
    instead of using the invoker
    <servlet-mapping>
       <servlet-name>ListaLoc</servlet-name>
       <url-pattern>/listaloc</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
       <servlet-name>ListaLoc</servlet-name>
       <url-pattern>/ListaLoc</url-pattern>
    </servlet-mapping>

  • Intermitten problem with POST to servlets

    Our java application sends a POST method to a servlet, which in turn executes an RMI method to validate a login/password stored in an oracle database. Three times in the last month, users where unable to get their login/password validated.
    Checking the access log, I found the log did not have POST records in it, only GETs. Restarting IPlanet would correct the problem.
    Need help.

    Web Server only logs requests after the response has been sent. Perhaps the Servlet was hanging waiting for a response?

  • Problem with EXEC services Job

    Hi,
    We are facing problem in Solution Manager 3.0 with EWA report generation. For the scheduled date of EWA , the job RDSMOPBACK_AUTOSESSIONS failed with an error CONNE_ILLEGAL_TRANSPORT_HEADER.
    Can anybody , faced or have an solution for the same.
    Regards,
    Narender

    Hi Narender,
    usually, this kind of dump is related to a corrupted data collection for the EWA session.
    I recommend to delete the download (run DSA, enter the 13 digits session number, choose display and click on the truck symbol, there should be possibility to delete the data). The processing job will run again. You may collect the data in SDCCN again or just create a new EWA session in Solution Manager.
    Best regards
    Ruediger Stoecker

  • Problem with Accessing Deployed Servlets Please help, very urgent.

    Inspite of going through lots of Docs. I am not able to access the JSP which is deployed using JDeveloper 3.2 in the browser? What should be the URL and where should I place the JSP and the related files in the Apache Server (Specific directory)?
    Please help, this is very Urgent.
    Could I get some sites where I can get detailed description of how to deploy and access Servlets and JSPS using JDeveloper 3.2 for OAS 9i?
    Thanks in advance,
    Regards,
    Kavita.
    null

    Hi Kativa,
    In answer to your first question: In most apache installs, you want to place all your JSPs under the Apache/htdocs directory. This htdocs directory becomes the root directory of your HTTP request, so, for example, to access the file
    Apache/htdocs/mydir/myJSP.jsp
    you'd point your browser to
    server:port/mydir/myJSP.jsp]http://server:port/mydir/myJSP.jsp
    As to your second question: Do you mean Oracle 9iAS? If so, look at this HOWTO: http://technet.oracle.com:89/ubb/Forum2/HTML/006398.html
    JDeveloper 3.2 does not support deployment to OAS (the predecessor to iAS), but there was no OAS 9i.
    null

  • Problems with my first Servlet

    Hello,
    I'm using tomcat 5 and Java SDK 5.0
    I have compiled a Java class called HelloServlet.class, which is in the package foo/bar.
    Now I have copied the class to the tomcat directory \webapps\servlets-examples\WEB-INF\classes.
    According to my book it should work now, but it doesn't.
    under http://localhost:8080/servlets-examples/fo/bar/HelloServlet I get an Error Message HTTP-Status 404
    What could I did wrong?

    Have you made an entry for the your servlet in the web.xml of Examples?
    you would have to include something like:
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>foo.bar.HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/foo/bar/HelloServlet</url-pattern>
    </servlet-mapping>

  • Problems with runtime.exec()

    Hi All,
    I am having a problem using runtime.exec()
    in servlet to call a java file from the server.The server is a linux one and i am using a tomcat server-4.1.24 the server contains
    some java files which i need to invoke with the help of the servlet program so i try to use exec() in servlet to invoke a particular java file in the server.The program is compiling well but no information
    is displayed on the browser.Where in the servlet program i try to print the details of the particular java program that is in the server.For ur
    reference i will post the code :-
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    public class ExeServlet extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
    try
    String path = getServletContext().getRealPath("/var/jakarta/webapps/examples/WEB-INF/classes/ServletExample.java");
    /*Where it is the path of the java file that resides in the server machine(linux)Which i want to invoke and print its details on the browser*/
    Runtime runtime=Runtime.getRuntime();
    Process proc=runtime.exec(path );
    BufferedReader br=new BufferedReader(new InputStreamReader(proc.getInputStream()));
    res.setContentType("text/html");
    PrintWriter pw=res.getWriter();
    pw.println("<b>");
    String line=null;
    while((line=br.readLine())!=null)
    { pw.println(line); //Displaying the details of the ServletExample.java file in the browser
    pw.println("</b>");
    catch (Exception e)
    pw.println("Listener *not* started!");
    What is the problem here?I was so frustrated with this.Pls. do provide an immediate reply if there is any code regarding this is working pls. do provide it.It is Urgent.I will be waiting for ur reply.
    Thanx,
    m.ananthu

    Hi Leo,
    Thank u for the reply i still have the problem with exec() in servlets.Has i said earlier in my previous mail by using exec() i trying to execute the output of a c-program for eg,Hello.run which provides an output of "HelloWorld" which is a sample eg.The Hello.run is the directory /var/jakarta/webapps/examples/WEB-INF/classes which is also the directory where my servlet program is.Where i am using a tomcat server-4.1.24 on the linux machine 7.3.Which is the server ofcourse.
    Here by using a servlet program i try to exceute the Hello.run c-program and display the output in the browser.This is what i need to do.
    I also used a sample core java class put the exec() there in a method and i try to call the method in the servlet.Which is also not working.
    Here is that example :-
    The core java program:-
    public class UsingExec
    public String ExeDisplay()
         try
    System.out.println("ExeDisplay");
         Runtime rt=Runtime.getRuntime();
         Process p=rt.exec("/var/jakarta/webapps/examples/WEB-INF/classes/Hello.run");
    p.waitFor();
    return "true";
         catch(Exception e)
    return "false";
    public static void main(String args[])
    UsingExec ue=new UsingExec();
    ue.ExeDisplay();
    When i run this program only ExeDisplay at the top is displayed.
    Here is the Servlet program:-
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    public class ExeServlet extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
    try
    res.setContentType("text/html");
    PrintWriter pw=res.getWriter();
    UsingExec ue=new UsingExec();
    String line=ue.ExeDisplay();
    pw.println(line);
    catch (Exception e)
    When i display this program on the browser only "false" is displayed from the UsingExec.java & nothing is displayed.
    Thanx,
    m.ananthu

Maybe you are looking for

  • 1333Mhz Ram showing up as 1600Mhz MacBook Pro 15 Late 2011

    Hi All, I have a weird problem here. I have a late 2011 15inch Macbook Pro. I recently upgraded it to 1333MHZ 8GB (4X2) transcend RAM - (Transcend RAM Model JM1333KSH-4G) Now the problem is that the transcend RAM specifications show that these are 4G

  • Using Apple Remote for Power Point

    Is it possible to use the Apple Remote (that comes with IR iMac G5s) to control & scroll through Power Point presentation files on my iMac? If so, is it necessary to link that file through Front Row (of which none of the current choices include Power

  • How to Transport Standard Text

    Hi all, I'd like to transport Standard text from one server to another. Pls guide me.

  • BADI or User-Exit for Adding New Input Field in 0VTC

    Hi Experts, Has any of you worked on enhancing transaction 0VTC (Define Routes and Stages)? I have a requirement right now to add two new input fields in New Transport Routes screen. Could anyone provide a BADI or customer exit that I could use to mo

  • What is the use of change pointer concept in ale?

    what is the use of change pointer concept in ale? Edited by: Alvaro Tejada Galindo on Feb 6, 2008 5:10 PM