Servlet Accessibility on browser with servlet running on a different folder

Hello everybody,
I have all these executed on Tomcat Server 4.1 version.
I have a servlet, say HelloServlet. I put it under the examples directory and execute it from the browser there is no problem.
the path : http://localhost:8080/examples/servlet/HelloServlet.
However, if I copy the same servlet to a different folder and try to execute it, I get a HTTP 404 error.
Can I have an idea as to how the servlet that is available in a different folder be executed.
here the url is
http://localhost:8080/docprime/servlet/HelloServlet, wherein docprime refers to my folder where I have the servlet.
Is there anything I should do with the web.xml file or properties file to do anykind of mapping.....etc..
I have been struggling with this since yesterday, but not making any kind or progress..
Kindly help..
Thanks n regards,
Sajiv
Chennai, India.

You would have add the vitual path in your server.xml. You could find this file under toplink config folder. Search for it in the toplink installation folder.
Add a <context> tag with proper inofrmation such as the path etc. Check out the document http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html.
HTH.

Similar Messages

  • Displaying *.pdf file on browser with servlet

    hi all
    this RAMESH,struggling to display a pdf file on browser from a remote mechine
    earlier i tried with servlet
    response.setContentenType("application/pdf")
    out.println();
    by this i am getting only some data as below
    endobj
    4 0 obj
    <<
    /ProcSet [ /PDF /Text /ImageB ]
    /Font << /Fo0 21 0 R /Fo12 24 0 R /Fo13 27 0 R /Fo16 30 0 R /Fo18 33 0 R /Fo19 36 0 R >>
    >>
    endobj
    For this purpose i have gone thru www.lowagie.com
    and gone thru all examples but i am not getting how to display on browser or at least awt frame
    please requesting all for suggest me some way
    tanks all
    -Ramesh

    are you trying to
    a) create a PDF dynamically
    b) send an existing PDF

  • Help; I cannot access my browser with all my bookmarks. When I press the firefox icon all that happens is that I go straight to yahoo. My e-mail is asampoh@yahoo.co.uk. Thanks for your help.

    When I press the firefox icon on my lap top I go straight to yahoo. There is no firefox browser and all my bookmarks have disappeared. What can I do to get the browser back.
    Thanks for your help.
    Adrian Asampoh

    This can be a problem with the file [http://kb.mozillazine.org/sessionstore.js sessionstore.js] and sessionstore.bak in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
    Delete [http://kb.mozillazine.org/sessionstore.js sessionstore.js] and sessionstore.bak in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder]
    If you see files sessionstore-##.js with a number in the left part of the name like sessionstore-1.js then delete those as well.
    See:
    * http://kb.mozillazine.org/Session_Restore
    See also:
    * http://kb.mozillazine.org/Firefox_crashes
    * [[Firefox crashes]]

  • Can a family member access my info with known passwords from a different phone or computer "spying"

    I was just wondering if somebody can access my personal info including web searches, emails, text messages, contact info, recent calls and photos and vioedo just about every thing done on your iPhone and PC. If they are the on accouts. I think they have my passwords.

    I'm not sure if the iPhoto for iOS forum is the right place for your question, but if someone knows your name and password on any computer they can certainly look at all your stuff. If you're using Safari you can turn on "private browsing" and it won't keep track of sites you've visited.
    -Doug

  • Two browser with same site having two different session

    Hai Experts................
    I have a problem that with session............
    when we logged in one site with our username and password, and
    then i try to log in same site with other username and password in another browser
    then how to know is there any browser is open with any other username and password in the same site.
    I want to give this checking in the client side.....

    You could use cookies, but this will only allow you to detect multiple uses of the same browser like two instances of IE. This won't work if you are using IE and you open another different browser such as Firefox.
    I think you are out of luck :)

  • [Help] To prevent timeout error of browser in clinet with servlet in server

    Hi all,
    If a browser (for example, Internet Explorer) do not get any response from a server for more than sometime (in case of IE, default is 5 min), it will stop waiting and return some timeout error message.
    But I have a servlet, which has a really long-time(at least 10 min) job to do before it could send a response to the browser. So, before the browser in client can get the result, it stops waiting.
    I know I can change the time-out setting of browser in client machines, but there are hundred of thousands.
    So, what I am asking is if it is possible to do it with servlet in server, and how?
    (for example, send something to the client every few minutes, but I do not know how to do it .)
    thanks a lot!

    What you would have to do is set up some sort of 'Buffer' servlet.
    It starts the job in the background, and then returns a page saying job started - client does not time out.
    You would have to start it in a seperate process - probably a new Thread.
    The client would then have to send back requests asking - is it finished yet?
    While the job is not finished the buffer servlet returns a "not yet" message.
    On completion, the job can be sent back to the client.
    Couple of pointers:
    It may be easier to have the background process generate the result to file - then your buffer servlet can just pick up the file when it is completed.
    To get your page to refresh multiple times, you can use javascript: window.setTimeout("[reload page]");
    Good luck,
    evnafets

  • Pb with servlet ?

    hi
    i created a web project (just for test) with WSAD, i have only one servlet (ServletForTest) and it's appear in the web.xml web project.
    when i want to access this servlet from my browser
    (http://localhost:8080/WebProject8/ServletForTest) i have a download
    dialogbox asking me if i want to open or save the ressource, i don't
    understand why does it
    happen ? the servlet is very simple, here is the code
    import javax.servlet.http.*;
    import java.io.*;
    public class ServletModified extends HttpServlet {
    long count;
    public void init() throws javax.servlet.ServletException {
    //Initisalisation du compteur
    count = 0;
    public void doGet(
    javax.servlet.http.HttpServletRequest request,
    javax.servlet.http.HttpServletResponse response)
    throws javax.servlet.ServletException, java.io.IOException {
    //Definit le format de la sortie
    response.setContentType("texte/plain");
    //Creation de la sortie
    PrintWriter pw = response.getWriter();
    pw.println("Count = " + count);
    count++;
    THANKS FOR YOUR HELP

    You have an error in your response settings:
    response.setContentType("texte/plain");
    Should be:
    response.setContentType("text/plain");

  • SSI with Servlet... tag question

    I've been trying to get the <SERVLET NAME=... tag working with WL5.1. After
              finding that the wall is indeed harder than my head after beating on it for
              a while, I need to cry for help. Can anyone spot what step I've missed? I
              used the Installshield setup, but I can't even get BEA's example SSI's to
              run for me.
              My WL5.1 doesn't seem to recognize the <SERVLET tag. My very simple .shtml
              file has: (it is shtml)
              <HTML>
              <HEAD>
              <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
              <TITLE>
              SSI test
              </TITLE>
              </HEAD>
              <BODY>
              this is in the HTML page only<P>
              <servlet name=test1 >
              this should not be seen<P>
              </servlet>
              this is in the HTML page only<P>
              </BODY>
              </HTML>
              and I get all three lines printed including the "this should not be seen",
              without output from the server. The servlet (test1) worked just fine in a
              normal servlet URL in a normal .html file (<FORM
              action=http://c00650:7001/test1 method="GET">).
              In the weblogic.properties file I have the following lines:
              weblogic.httpd.register.test1=com.eleris.bobtestservlet.Servlet1
              weblogic.httpd.register.*.shtml=weblogic.servlet.ServerSideIncludeServlet
              My classes are in
              H:\weblogic\myserver\servletclasses\com\eleris\bobtestservlet
              Can anyone tell me if you've seen this yourself, and what step I missed?
              

    Sorry, I don't think I can help you without more information.
    I created a simple Servlet, FooServlet, as follows:
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class FooServlet extends HttpServlet {
        public void service(HttpServletRequest req, HttpServletResponse res)
            throws IOException {
            PrintWriter out = res.getWriter();
            out.println("FooServlet");
    }I compiled FooServlet and placed FooServlet.class in /home/elving/app/WEB-INF/classes.
    I created /home/elving/app/index.html as follows:
    Top of index.html
    <!--#include virtual="/app/servlet/FooServlet"-->
    Bottom of index.htmlI defined a dummy web app in /home/elving/app/WEB-INF/web.xml:
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "file://d:/iplanet/bin/https/dtds/web-app_2_3.dtd">
    <web-app>
        <display-name>Foo</display-name>
    </web-app>I referenced the web app from server.xml:
    <WEBAPP uri="/app" path="/home/elving/app"/>I ensured that my server was configured to parse HTML files as SHTML (i.e. there is a type=magnus-internal/parsed-html exts=shtml,html line in my mime.types).
    However, accessing /app/ and /app/index.html produce identical, expected results, and nothing is logged to errors.

  • How does a servlet close the browser window?

    How can a servlet close the browser window it is running in?

    I'm running the servlet by calling it in a browser window, passing parameters using POST, with the parameters appearing at the end of the url.
    Is there another way to run the servlet, without it affecting the browser window? That would be a better solution.

  • Cache file(pdf) in user's browser using Servlet -Cookie, or Session

    How can I save a file (pdf) in the cache of a browser (IE 6) in a user's computer? I am using Servlet and Tomcat 4.1.24. PDF file is sitting in server (remote computer) under a URL space.
    The idea is to NOT to download the pdf file on user's computer (from the remote server) if the user has a cached copy of the pdf file and pdf file in the server is the same as the pdf file in the browser. If cached pdf is different from pdf in browser, or, if the user does not have that pdf file in cache, then download pdf file from the server.
    Can I come up with a way to use Cookie class? Cookie class does not have an API which will let me save a file in it. I could have saved the pdf file in the Cookie with 999999999 setMaxAge. Is storing that pdf file in session the only choice? I do not see session serving my purpose - session should not be valid for a longgg duration e.g. week or month.
    Also, how would I create a file whne I am given a URL to that file.
    URL fileInServer = new URL("http://www.myDomain.com/myWebApp/PDF/my.pdf);
    URLConnection conn = fileInServer.openConnection();
    Does getContent() help and what are the steps after that?
    Any help with the source code will be appreciated.
    Thanks,
    Sam
    [email protected]

    I am NOT creating this PDF file on the fly. This pdf file is sitting in the server (remote machine) under URL e.g. http://10.10.10.xxx:8081/myApp/PDF/my.pdf
    I need to check if this pdf file is in the cache in user's computer (differnt machine than the server) and if the cached pdf is the same as the pdf in the server. If that file is not in the cache, or if they are not the same, then, I need to save the pdf file from the server into user's browser cache.
    I am writing all that code in Servlet. I can save the file in session. I do NOT know how else can I cache the file, other than saving it in session. I can not think of any setHeader() which will let me save a file in user's browser cache. Headers like If-Modified-Since are of no help, as it does not let me compare file in browser cache with the file in server.
    Also, how would I create a file, given a URL to that file.
    URL fileInServer = new URL("http://www.myDomain.com/myWebApp/PDF/my.pdf");
    URLConnection conn = fileInServer.openConnection();
    Do I use getContent()? What are the steps after that?
    Thanks,
    Sam
    [email protected]

  • Caching problem of javascript with servlet

    Hi guys
    There is a problem of caching with the our project. This project contains two servlets first is getAdServlet and second is richMediaServlet. getadservlet is called thru <script src=""> following is the code:
    <script LANGUAGE="JAVASCRIPT" src="http://192.168.1.6:8080/advert_java/servlet/GetAdServlet?region=1&zone=1&type=nossi&cachevar=yes">
    </script>
    getadservlet returns the javascript statments. These javascript statments are able to create an <iframe>. Now cotents of the iframe are supplied by the second servlet ie richMediaServlet. This servlet is called like
    iframeURL = fullHttpDir+"/servlet/RichMediaServlet?";
    iframeURL += "bannerCode="+ RNBanner;
    iframeURL += "&cachebust="+ cachebust + refresh+"&getAd=y";
    iframeURL += "&hheight="+hheight+"&wwidth="+wwidth;
    out.println("document.write(\"<iframe src='" + iframeURL + "' height=" + hheight +" width="+ wwidth + " SCROLLING=no FRAMEBORDER=0 MARGINWIDTH=2 MARGINHEIGHT=2 onfocus='window.focus(); return iframeFocus()'>\");");
    out.println("document.write(\"</iframe>\");");
    This richmediaServlet returns HTML into <iframe>. when richmediaservlet is called, a parameter 'bannerCode' is passed. then richmediaServlet fatches the banner from the database and displays the banner into the <iframe>.
    Now the problem is when i run the html file containing the script tag mentioned above, and supply different bannerCodes from getAdServlet to richMediaServlet then first banner is cached and displayed every time.
    i have also used the following code to prevent the caching of both the setvlets
         long currentTime = System.currentTimeMillis();
         response.setHeader("Cache-Control", "no-cache, must-revalidate");
         response.setHeader("Pragma", "no-cache");
         response.setDateHeader("Last-modified", currentTime);
         response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
    and following in the iframe's head tag before the iframe tag in the getAdServlet.
    out.println("document.write('<head>');");
    out.println("document.write('<meta http-equiv=\"Cache-Control\" content=\"no-cache,must-revalidate\">');");
    out.println("document.write('<meta http-equiv=\"Pragma\" content=\"no-cache\">');");
    out.println("document.write('<meta http-equiv=\"Last-modified\" content=\""+ currentTime + "\">');");
    out.println("document.write('<meta http-equiv=\"expires\" content=\"Sat, 6 May 1995 12:00:00 GMT\">');");
    out.println("document.write('</head>');");
    this problem does not arises when i call the getAdServlet from a testServlet and run the testServlet thru get request.
    pl tell me what's wrong i m doing.

    First, post your code in tags if you want people to read your code...

  • Inexplicable delays in browser-to-servlet-to-browser communication

    We are seeing some inexplicable "pauses" in the round-trip from
    browser-to-servlet-to-browser communication. The browser and Weblogic
    instance are on different machines, so correlating absolute times has
    been difficult. So at this point it's hard to tell whether the browser
    request is not being received immediately by the servlet, or the servlet
    response is not being received immediately by the browser... or perhaps
    it is, but maybe the response stream isn't "closing" properly, causing
    the browser to think there's still more to come.
    If the browser request is not being received immediately by the servlet,
    it could be because the execute thread count is so low that the request
    is being blocked until a thread is availble to service it. But our
    thread count is set to 30 and this is with just a single user hitting
    the servlet.
    If the servlet response is not being received immediately by the
    browser, or is not being closed properly, what could cause that?
    Occassionally, I have been able to account for some of the "delay"
    time. Our servlet does the usual stuff: writes out to the response
    writer and then closes the writer:
    PrintWriter writer = response.getWriter();
    writer.write( htmlString );
    writer.close();
    I have seen the writer.close() method taking a long time - over 5
    seconds on one occassion! What could it be doing?
    Could some type of TCP_NO_DELAY network setting account for all of
    this? Any and all help/experiences are appreciated.
    mg
    Mike Gorman, Director of Architecture
    YOUcentric, Inc.
    Charlotte, NC
    704-643-1000 x518
    http://www.youcentric.com

    If you are using 5.1 and you have ELF turned on (see docs).
    You can specify "time" as an ELF header and this gives you the time of
    processing and the write.
    mbg
    In article <[email protected]>, [email protected] says...
    Here are a few top of the head suggestions:
    1. You can log the time when the request is received by the servlet and
    when the output stream is closed. That should give you a fair idea of
    what percentage of delay happens on the servlet side.
    2. Try flush() to send stuff to the browser after every few lines of
    write(). It helps.
    3. IE does wait for the whole HTML to come in before it displays unlike
    Netscape which shows the streaming data. So switch browser and check.
    4. Make sure you are not using the SingleThread model even though that
    does not explain the delay encountered by a single user.
    If these do not help, you would need to give more insight into the code.
    - Anshum
    Mike Gorman wrote:
    We are seeing some inexplicable "pauses" in the round-trip from
    browser-to-servlet-to-browser communication. The browser and Weblogic
    instance are on different machines, so correlating absolute times has
    been difficult. So at this point it's hard to tell whether the browser
    request is not being received immediately by the servlet, or the servlet
    response is not being received immediately by the browser... or perhaps
    it is, but maybe the response stream isn't "closing" properly, causing
    the browser to think there's still more to come.
    If the browser request is not being received immediately by the servlet,
    it could be because the execute thread count is so low that the request
    is being blocked until a thread is availble to service it. But our
    thread count is set to 30 and this is with just a single user hitting
    the servlet.
    If the servlet response is not being received immediately by the
    browser, or is not being closed properly, what could cause that?
    Occassionally, I have been able to account for some of the "delay"
    time. Our servlet does the usual stuff: writes out to the response
    writer and then closes the writer:
    PrintWriter writer = response.getWriter();
    writer.write( htmlString );
    writer.close();
    I have seen the writer.close() method taking a long time - over 5
    seconds on one occassion! What could it be doing?
    ==================================================
    NewsGroup Rant
    ==================================================
    Rant 1.
    The less info you provide about your problem means
    the less we can help you. Try to look at the
    problem from an external perspective and provide
    all the data necessary to put your problem in
    perspective.

  • Some problems with servlet.jar and tomcat 4.1.27

    Hello everybody,
    I used to work with tomcat 3.3.1 and i've decided to use tomcat 4.1.27 now. The manual explains that we have to change de version of servlet.jar, it's done with servlet-2.3.jar but on tomcat starting i have this message:
    jar not loaded. See servlet spec [...]. Offending class: javax/servlet/Servlet.class
    what can i do, i've red all de documentation and i think all versions a OK??
    thanks per advance
    antoine

    I am running Tomcat 4.1.18, so your configuration may be slightly different. I found the Servlet.class file you are missing residing in the Tomcat/common/lib directory in the Servlet.jar file. Check your path and also make sure your Servlet.jar file contains the missing class.

  • Accessing postgresql record using servlet

    Hello every body,
    I am trying to access the postgresql database using servlet. But I found the error of ClassNotFound exception: org.postgresql.Driver. One thing more I am using eclipse ide. I have used the postgresql-8.1-404.jdbc3 driver. And I have set it on class path in eclipse.
    package dbservlet.example;
    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class DbServletExample1 extends HttpServlet{
         public String getServletInfo() {
              return "Servlet connects to PostgreSQL database and displays result of a SELECT";
         private Connection dbcon; // Connection for scope of DbServletExample1
         public void init(ServletConfig config) throws ServletException { // "init" sets up a database connection
              String loginUser = "ali";
              String loginPasswd = "ali";
              String loginUrl = "jdbc:postgresql://127.0.0.1:5432/ali"; // Load the PostgreSQL driver
              try{
                   Class.forName("org.postgresql.Driver");
                   dbcon = DriverManager.getConnection(loginUrl, loginUser, loginPasswd);
              catch (ClassNotFoundException ex){
                   System.err.println("ClassNotFoundException: " + ex.getMessage());
                   throw new ServletException("Class not found Error");
              catch (SQLException ex){
                   System.err.println("SQLException: " + ex.getMessage());
         // Use http GET
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                             throws IOException, ServletException {
              response.setContentType("text/html"); // Response mime type
              PrintWriter out = response.getWriter(); // Output stream to STDOUT
         out.println("<HTML><Head><Title>Db Servelt Example</Title></Head>");
         out.println("<Body><H1>Example of Servlet with Postgres SQL</H1>");
         try {                // Declare our statement               
              Statement statement = dbcon.createStatement();
              String query = "SELECT empid, name, dept, "; // Perform the query
              query += " jobtitle ";
              query += "FROM employee ";
              ResultSet rs = statement.executeQuery(query);
              out.println("<table border>");
              while (rs.next()) {      // Iterate through each row of rs
                   String m_id = rs.getString("empid");
                   String m_name = rs.getString("name");
                   String m_dept = rs.getString("dept");
                   String m_jobtitle = rs.getString("jobtitle");
                   out.println("<tr>" +
                                       "<td>" + m_id + "</td>" +
                                       "<td>" + m_name + "</td>" +
                                       "<td>" + m_dept +"</td>" +
                                       "<td>" + m_jobtitle + "</td>" +
                                  "</tr>");
              out.println("</table></body></html>");
              statement.close();
         catch(Exception ex){
              out.println("<HTML>" +
                             "<Head><Title>" +
                             "Bedrock: Error" +
                             "</Title></Head>\n<Body>" +
                             "<P>SQL error in doGet: " +
                             ex.getMessage() + "</P></Body></HTML>");
              return;
         out.close();
    and web.xml file is
    <web-app>
              <database>
                   <driver>
                   <type>org.postgresql.Driver</type>
              <url>jdbc:postgresql://127.0.0.1:5432/ali</url>
              <user>ali</user>
              <password>ali</password>
                   </driver>
              </database>
              <servlet>
              <servlet-name>DbServletExample1</servlet-name>
              <servlet-class>dbservlet.example.DbServletExample1</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>DbServletExample1</servlet-name>
              <url-pattern>/db11</url-pattern>
              </servlet-mapping>
    </web-app>
    Thanks in advance

    That web.xml doesn't look right to me.
    what's that <database> tag? I would only expect to see a <resource-ref> in the web.xml.
    I would not touch the server.xml. Create a context.xml and put it in your META-INF directory. That should look like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/your-path" reloadable="true" crossContext="true">
        <Resource name="jdbc/your-jndi"
                  auth="Container"
                  type="javax.sql.DataSource"
                  username="your-username"
                  password="your-password"
                  driverClassName="your-driver-class"
                  url="your-url"
                  maxActive="10"
                  maxWait="60000"
                  removeAbandoned="true"
                  removeAbandonedTimeout="60000"/>
    </Context>%

  • Using Toplink with Servlets in a Clustered application server

    I am having some problems with Toplink.
    Basically, I have a collection of HttpServlets that manipulate a domain object and its various collections of objects. The general technique is to place the domain object in the HttpSession, and have each Servlet modify this object by retrieving it, modifying it, and storing it when necessary. The problem is that since this application is running in a clustered environment, the object in the session may or may not be the same object returned from Toplink. It may be a serialized clone of the object from another server on the cluster.
    This has caused several problems. First, if I am using indirction for the collections, when the domain object is deserializaed, it throws an exception when it tries to instantiate the indirection. Next, when trying to store the object, it is not registered with a unit of work, and I am not sure how to properly account for this. Third, there is a many to many relationship. The user may pick one such object, and add it to the domain object being manipulated. This seems to cause problems when the object is read from Toplink, and added to the domain object that is a serialized clone.
    Anyway, my question is, what is the general pattern for handling an object being manipulated on a HttpSession in a clustered environment, where this object(s) may or may not be the actual objects returned from Toplink? My goal is to have a factory return one DatabaseSession per cluster server, and be able to load, store, and manipulate these objects in the HttpSession.
    Here is an attempt at code:
    import java.io.*;
    import java.util.*;
    import oracle.toplink.expressions.*;
    import oracle.toplink.sessions.*;
    public class DataAccess
    private static Project project = new MyToplinkProject();
    private static DatabaseSession session;
    private UnitOfWork unit;
    public DataAccess()
    unit = getDatabaseSession().acquireUnitOfWork();
    public ArrayList getAllCustomers()
    Vector v = (Vector) session.readAllObjects(Customer.class);
    return new ArrayList(v);
    public Customer getCustomerForUpdate(Customer c)
    Customer custCopy = (Customer) unit.readObject(c);
    return (Customer) unit.registerObject(c);
    public Form getCustomer(String id)
    ExpressionBuilder builder = new ExpressionBuilder();
    Expression exp = builder.get("id").equal(id);
    return (Customer) session.readObject(Customer.class, exp);
    public void saveCustomer(Customer cust)
    unit.deepMergeClone(cust);
    unit.commitAndResume();
    private synchronized DatabaseSession getDatabaseSession()
    if (session == null)
    session = project.createDatabaseSession();
    session.login();
    session.setLog(new PrintWriter(System.out));
    session.logMessages();
    return session;
    public void destruct()
    release();
    public void release()
    unit.release();
    session.release();
    Anyway, from this code I hope you can see what I am trying to do. The basic idea is that a Customer object provided for store and update may or may not be a serialized copy. Also, the object returned from a read may be serialized before the indirction is attempted.
    Thanks for any help,
    Jason Wilson

    Hi Jason
    A single static DatabaseSession and a single static UnitOfWork is not the recommended way of working with TopLink from a servlet. Our recommendation is that you create a single ServerSession object and that every time a servlet needs to interact with a TopLink Session, the servlet first acquires a ClientSession from this ServerSession object and possibly acquires UnitOfWork from the ClientSession. A UnitOfWork is not intended to be shared by servlets, or by different clients.
    Basically, what you're attempting to do with the DatabaseSession is something we would recommend that you do instead with a ServerSession/ClientSessions combination.
    As for working with persistent objects that you store in an HttpSession, I will try to give you some relevant background. First off, the UnitOfWork is intended to be used to manage the changes to a set of objects in a SINGLE TRANSACTION. It is always much easier to manage if these transactions are short-lived (ie if there is one transaction per ServletRequest.
    However, the fact that you are talking about storing objects in the HttpSession makes me think that you are also considering long-running transactions that are may be spread out over several ServletRequests. You should definately consider this decision very carefully. If you want to continually edit an object that is stored in the HttpSession, then we need to consider how to manage when the object's changes should be committed to the database and how to manage concurrency when two users have the same object in their respective HttpSession objects.
    One idea is not to store the actual object in the HttpSession but instead to store the "id" of the object (something that you can use to find the correct object when the same user makes another request). So servlets always:
    -acquireClientSession
    -find the object that they are working with (based on information in the HttpSession)
    -if the object is to be edited then a UnitOfWork provides clones of the object (this isolates you from changes that some other user makes to the same object)
    -at the end, commit the changes to the object.
    When the user makes another request, the object they read will have their changes. So, functionally, this is the same as storing the actual object in the HttpSession, except TopLink can provide proper ACID behavior for any updates that you decide to make. And don't worry about the added "expense" of having to query at the beginning of each servlet request; if you are storing the "id" of the object in your HttpSession, then you a simple cache hit is all that is required to get back the correct object. You don't have to go the database at all.
    JIM

Maybe you are looking for

  • Need help with G4 problem

    Months ago I have a problem on my G4 MDD which intermittently shuts down after putting it to sleep. Now some new problems are coming out. First one I noticed is that sometimes even the power switch light would turn off even though the computer is sti

  • My smart playlists in iTunes match are not interpreting "date added" property correctly for some songs.

    I have many smart playlists that are dependent upon the "date added" property of my songs. I use iTunes match on a PC, my iPad (4th gen), and my iPhone 5, and my music is stored on my iMac. For some reason, (on my iPhone only) a handful of songs stub

  • Where are role and administrator settings saved?

    We have had issues in the past that have caused us to have to re-setup our site, including all administrative settings and all roles and users. Surely all of this is saved somewhere. If we just knew where, we could backup the info for an easier resto

  • Dv7 6014 fan failure message

    Is there documentation on opening a dv7-6014 to replace the cooling fan please? We got the 'detected cooling fan failure - 90? - shutting down in 15secs' during a windows update. Its running now with an external fan on the vent. Also have a dv7-5003,

  • BAPI_ACC_DOCUMENT_POST Issue with assigning Cost Objects

    Hi Forums, I am passing only the order number to this BAPI I am getting the following error. Account 654080 requires an assignment to a CO object I am passing the order number to this and should populate enough information to fill in the data? any id