Servlet caching ????

I input a name to a servlet and try to print out something with that name.Say , for ex. I enter "Bryan" and the output wud be "Bryan belongs to section C"
when 2 or more users enter names from different machines using the same servlet at the same time..sometimes it happens that they dont get the result with what they gave in, instead one gets output with the name another enterted.
To make it more clear..
Suppose C1 enters "Adam" as input to the servlet to get an output "Adam belongs to Section C "
C2 enters "Lisa" as input to the servlet to get an output "Lisa belongs to Section C "
C3 enters "Ted" as input to the servlet to get an output "Ted belongs to Section C "
What happens sometimes is that when C1, C2,C3 enter their value at the same time, C2 and C3 get "Adam belongs to Section C " instead of "Lisa belongs to Section C " and "Ted belongs to Section C "
When can such a thing happen?? Does servlet cache in the server??
How come the value gets passed on to the other requests as well..
Any help is appreciated..

Are you using class level or object level variables in your Servlet class to store the user entered values? (Use only local variables unless you really know what you are doing).
Are you using ServletContext attributes?
As far as I know, except for these two scenarios, there is no other way that requests will share values.

Similar Messages

  • Servlet caching in oc4j/orion

    I'm making changes to my servlet yet they do not seem to be getting picked up, even when I restart orion. I have my classes, jsp etc in a war file under applications. Is there a servlet caching issue here and if so how do i solve it. I noticed an earlier posting about classes needing to be in a jar file to get reloaded, is something similar required for servlets?
    Neil W.

    Neil,
    If you are in the development stage of your application probably you will not like to go thru the hastle of building the WAR each time your servlet or JSP is changed. Please look at the following link to how to deploy apps with Exploded Directory Format http://otn.oracle.com/docs/tech/java/oc4j/htdocs/getstart.htm#1027810. In this case each time your apps is changed you just change the timestamp on web.xml by either UNIX touch command or some other mechanism and OC4J will redeploy your new apps.
    regards
    Debu Panda
    Oracle

  • Prevent servlet caching

    I am having problem with servlet caching. My Servlet keeps displaying
    previously cached image instead of an updated image. I tried out the
    following workarounds and was not successful.
    1. Set the following Response headers
    res.setDateHeader("Expires", 0);
    res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate,
    post-
    check=0, pre-check=0");
    res.setHeader("Pragma", "no-cache");
    2. Set HTML META TAG:
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    Has anyone experienced a similar issue and can you share your
    worarounds. I even tried setting DateHeader as follows but no luck.
    res.setDateHeader("expires", System.currentTimeMillis()).
    thanks in advace

    And is this servlet actually sending the image itself, or it is sending some HTML that contains a link to the image? If it's the latter, then no amount of saying not to cache the HTML will have any effect on whether browsers cache the linked image.
    Actually now that I read your post more carefully, I see that you are sending HTML which presumably has an <img> tag referring to the image. The browser will download that image as a separate transaction. But if you change the date on the image file to something later, the browser should stop caching it.

  • Standard Servlet caching mechanism

    Gurus,
    Is there any standards on caching servlet reponse. Most of the application servers provide their own mechanism to cache servlet response.
    I am looking for application server netural standards for caching servlet resposne. If there is no standards for caching available in any of the servlet > 2 releases, probably i would send an email to servlet specification guys to think on something like this.
    Its lot of pain when you write code in some server and deploy it on some other server where the servlet caching response caching is suported.
    Any help in this will be appreciated

    Here is more explanation...
    Suppose for an example, a servlet that accepts parameter(s) and queries the database and displays a html text, may be around 100 records. ok?
    Next time when you make the same request with same set of parameters, the servlet excecutes the db query again and display the same result when it was intially called.
    Now my question, is there standard mechanism to cache the servlet reponse at server side and when the request is made with same set of parameters, it would be served from the cache instead of making db call.
    In addition to that, it should work under all the application server when you deploy
    Let me know if this clear enough, or i can add more stuff in here.

  • Servlet cacheing issue?

    hi
    i'm having a slight problem i believe may be due to cacheing.
    i'm calling a servlet within a frame that displays a generated pdf file using certain values and so forth.
    the problem is that it appears to be chacheing the servlet and never reloading it as it should given values change etc.
    i'm using tomcat 3.3.1 and apache web server. i tried adding the following :
    response.addHeader("Pragma", "No-cache");
    response.addHeader("Cache-Control", "no-cache");
    response.addDateHeader("Expires", 1);
    to my servlet but that had no effect. adding the http meta equivalents to the frame-set page, also had no effect.
    another interesting point is that this only occurs using the apache and tomcat combination. it doesn't happen using IIS and tomcat. could there be a setting in tomcat or apache i've neglected?? perhaps some other code to avoid this?
    any help would be greatly appreciated.
    thanks
    Takis

    use:
    response.addHeader("Expires", 1);
    instead of:
    response.addDateHeader("Expires", 1);

  • Flushing the Servlet Cache or buffer(maybe) ^o^

    Hi,
    I wrote a few JSPs that use servlets and scriplets using import and include attributes to extract data from a database table. Everything works fine, except when I refresh the page the results are shown multiple times.
    That is to say, the servlets seem to remember the previously generated values from the table and calculations, and displays it before showing the new results. I tried using the flush="true" attribute, but to no avail. After about 10 mins or if i restart Tomcat the servlets would clear the cache.
    I am writing these JSp for a school assignment, and so far this is the part that I am having trouble dealing with. Is there a workaround for this? or is this an implementation error in my part? Any help would be appreciated. Thanks in advance!
    Cheers,
    -Shawn

    Well thats interesting. I wrote a test Servlet program to see the newsbean output and I get the same problem now and It appends the old result. I realize that the trouble is not in the include statement, rather in the servlet itself.
    I looked over the code to see what it could be, but couldn't catch it. But maybe you might see something different. So I will include the code for the TestServlet and the dependat classes. And Philip I appreciate your effort trying to help me out with this! : )
    test Servlet class
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.ListIterator;
    import java.sql.*;
    public class NewsServlet
    extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    NewsBean NewsPiece = null;
    try
    staffMembers = new NewsBean();
    catch (SQLException ex)
    //iterating through news list
    ListIterator li = null;
    try
    li = NewsPiece.getNewsItem().listIterator();
    catch (SQLException ex1)
    String myNews="";
    while(li.hasNext()){
    NewsItem news = (NewsItem) li.next();
    myNews += news.getTitle()+" \t"
    news.getDescription()" \t"
    + news.getSubmitdate() +" \t"
    news.getEndDate()" \t"
    news.getAuthor()"<p>";
    String docType =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">\n";
    out.println(docType +
    "<HTML>\n" +
    "<HEAD><TITLE>News</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1>News</H1>\n" +
    myNews+
    "</BODY></HTML>");
    This is the newsbean class
    import package.name.sqlAdapter; //This is used to simplify database connections
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.LinkedList;
    public class NewsBean{
    private static ResultSet results;
    private static LinkedList newsItems = new LinkedList();
    public NewsBean() throws SQLException{
    //connect to DB
    sqlAdapter sqlConnection = new sqlAdapter();
    //Get Staff list
    String query = "SELECT * FROM `news` ";
    results = (ResultSet) sqlConnection.runCustomQuery(query);
    public LinkedList getNewsItem()throws SQLException{
    while(results.next()) {
    //read in columns
    String description = results.getString("description");
    String title = results.getString("title");
    String submitDate = results.getString("submit_date");
    String endDate = results.getString("end_date");
    //String author = results.getString("author");
    String picture = results.getString("picture");
    String id = results.getString("id");
    //create NewsItem object and add to list
    NewsItem news = new NewsItem(title, description, submitDate, endDate, picture, id);
    newsItems.add(news);
    return newsItems;
    Here is the NewsItem Class
    public class NewsItem
    private String title;
    private String description;
    private String submitDate;
    private String endDate;
    private String author;
    private String picture;
    private String id;
    public NewsItem(String Title, String Description, String SubmitDate, String EndDate,String Picture, String ID){
    this.title = Title;
    this.description = Description;
    this.submitDate = SubmitDate;
    this.endDate = EndDate;
    //this.author = Author;
    this.picture = Picture;
    this.id = ID;
    public static void main(String[] args) {
    //test code here
    public String getDescription(){
    return this.description;
    public String getTitle(){
    return this.title;
    public String getSubmitdate(){
    return this.submitDate;
    public String getEndDate(){
    return this.endDate;
    public String getAuthor(){
    return this.author;
    public String getPicture(){
    return this.picture;
    public String getNewsID(){
    return this.id;

  • Servlet caches when it shouldn't

    My Applet is sending my servlet a filename, the servlet the opens the file and send some info back to my applet. Now the problem comes when I want to open another file, the Servlet keeps on opening the first file I opened! The only way I get it to open the right file is by shutting down and restarting tomcat. How can I get around this? If tried putting this code in my applet after I declared the url, but it does nothing:
    URLConnection con = url.openConnection();
    con.setUseCaches(false);

    This is the code for my servlet:
    import java.io.*;
    import java.io.File;
    import java.util.*;
    import java.net.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.util.Vector;
    public class TestServlet extends HttpServlet {
         String file;
         String outputFile = "output.txt";
         PrintWriter out;
         Vector v = new Vector();
         String path;
    public void doGet(HttpServletRequest req,
              HttpServletResponse res)
              throws ServletException, IOException{
         res.setContentType ("text/plain");
         out = res.getWriter();
         path = getServletContext().getRealPath("WEB-INF/textfiles");
         file = req.getParameter("name");
         readfile();
         for(int i=0; i<v.size(); i++)
         out.print(v.elementAt(i));
    out.close();
    public void readfile(){
         try{
         FileReader in = new FileReader(path+ File.separator + file);
              int c;
              while ((c = in.read()) != -1){
              char car = (char)c;
              System.out.println(car);
              Character obj = new Character(car);
              v.addElement(obj);
         }//while
         in.close();
         //outfile.close();
         }catch(IOException except){
         }//end catch
    }//readfile
    And this is how I call it in the applet:
    String name = outField.getText();
    try {
    String host = getCodeBase().getHost();
    URL url =
    new URL("http://" + host + ":8080/servlet/TestServlet?name=" + name);
    URLConnection con = url.openConnection();
    con.setUseCaches(false);
    BufferedReader in = new BufferedReader(
                   new InputStreamReader(url.openStream()));
    Anybody know what am I doing wrong?

  • Servlet cache

    I have a html that use form tag that call a servlet, like this:
    <FORM METHOD="POST"
    ACTION="/servlet/xyz">
    Where xyz is xyz.class that I compiled from xyz.java.
    I use Netscape Web Server, how do I make the html to load the new
    xyz.class
    when the xyz.class is changed ?Regards.

    http://knowledgebase.iplanet.com/ikb/kb/articles/4339.html
    rob
    Ketung Hsiao wrote:
    >
    I have a html that use form tag that call a servlet, like this:
    <FORM METHOD="POST"
    ACTION="/servlet/xyz">
    Where xyz is xyz.class that I compiled from xyz.java.
    I use Netscape Web Server, how do I make the html to load the new
    xyz.class
    when the xyz.class is changed ?Regards.

  • Configuring Servlet Result Cache

    Greetings.
    I am trying to configure the iAS servlet result cache feature under iAS 6.0 SP2. I have the following entry for a servlet in my ias-web.xml file:
    <servlet>
    <servlet-name>MessageRouter</servlet-name>
    <guid>{CAC10848-06B4-1C5F-848B-08002085745B}</guid>
    <validation-required>false</validation-required>
    <servlet-info>
    <sticky>false</sticky>
    <encrypt>false</encrypt>
    <number-of-singles>10</number-of-singles>
    <disable-reload>false</disable-reload>
    </servlet-info>
         <caching>
              <cache-timeout>300</cache-timeout>
              <cache-size>10</cache-size>
              <cache-criteria>Xml</cache-criteria>
              <cache-option>TIMEOUT_LASTACCESS</cache-option>
         </caching>
    </servlet>
    However, it does not appear to be caching the results of this servlet because my request takes about 10 seconds to run (it's a database query). I would expect that subsequent requests would return results much faster than 10 seconds if the servlet results are in fact cached.
    So, I am hoping that someone can help me with the following questions:
    1. An example ias-web.xml with a cached servlet.
    2. Any instructions on how to monitor from iASTAT or logs or something so I can see that the servlet result is read from iAS cache.
    Thanks
    Jeffery Cann

    Check out the samples included with the appserver. There is a servlet caching sample that includes four different examples of deployment descriptors.
    Here is the servlet tag from the default:
    <servlet>
    <servlet-name>ServCache</servlet-name>
    <guid>{DD6402C6-CC11-1AA1-CF6F-080020CFEAC8}</guid>
    <validation-required>false</validation-required>
    <error-handler></error-handler>
    <servlet-info>
    <sticky>true</sticky>
    <encrypt>false</encrypt>
    <number-of-singles>10</number-of-singles>
    <disable-reload>false</disable-reload>
    <caching>
    <cache-timeout>900</cache-timeout>
    <cache-size>64</cache-size>
    <cache-criteria>inputtext</cache-criteria>
    <cache-option>TIMEOUT_CREATE</cache-option>
    </caching>
    </servlet-info>
    </servlet>
    The KXS log (assuming that you have info messages) will report servlet cache hits.
    David
    Shameless plug for my iAS book : http://www.amazon.com/exec/obidos/ASIN/076454909X/
    P.S.
    I just realized that the caching sample was only added in sp3. Even if you don't upgrade your server (the functionality is unchanged) you may want to download sp3 so that you can check out the sample. The sample goes into a reasonable amount of depth about this feature.

  • Failed to load servlet: java.lang.ClassNotFoundException

    I've been working on a project with other developers and we've all have our own sections of a large web application that we are working on. When we are each done working on our part we send our JSPs, Beans, and servlets to the lead developer that then deploys one EAR file on our Test/QA server. I now asked the tech lead if he could send me the EAR file so I can load the application in its entirety on my local machine. When I start up the server, I get the error "Failed to load servlet: java.lang.ClassNotFoundException" for each one of my servlets. Even if the servlet path is correct I still get that error. I also tried removing the servlet in the web.xml file and then adding it again, but I still get that error. Has anyone experienced anything like this before? Is this error appearing because I have two projects (my part of the application with only my code and the complete project from the EAR file) that point to the same servlets? I'm not sure how to resolve this. Any advice would be greatly appreciated. Thanks in advance!

    That's what I thought too. But I'm installing an EAR file exported directly from another persons computer and the application is working fine on his machine. So the EAR file will automatically place the servlets in their proper path and directory structure when I import it. In any case I checked the paths myself and they are correct (the servlet file does exist in the same path). I also removed the servlet from the web.xml file and added it again through the websphere UI so if there was any miss-type in the directory path it would have been corrected by websphere. I also tried making a minor change to the servlet file and resaving it thinking that it might correct something or do something that would allow my websphere environment to see/recognize the existance of the servlet, but that did not work. I'm out of ideas. Does anyone have any suggestions? Here is a part of my log file if it helps: Thanks!
    *** Starting the server ***
    IBM WebSphere Application Server, Release 4.0.4
    Advanced Single Server Edition for Multiplatforms
    Copyright IBM Corp., 1997-2001
    ************ Start Display Current Environment ************
    WebSphere AEs 4.0.4 ptf40230.02 running with process name localhost/Default Server and process id 3188
    Host Operating System is Windows 2000, version 5.0
    Java version = J2RE 1.3.1 IBM Windows 32 build cn131w-20020710 ORB130 (JIT enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM
    server.root = C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4
    Java Home = C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4\java\jre
    ws.ext.dirs = C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/java/lib;C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/classes;C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/lib;C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/lib/ext;C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/web/help;C:/Program Files/IBM/WebSphere Studio/wstools/eclipse/plugins/com.ibm.etools.websphere.tools.common_5.0.1/runtime/wasListener.jar;C:/Program Files/IBM/WebSphere Studio/wstools/eclipse/plugins/com.ibm.etools.webservice_5.0.1/runtime/worf.jar
    Classpath = C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/properties;C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/lib/bootstrap.jar;C:/Program Files/IBM/WebSphere Studio/wstools/eclipse/plugins/com.ibm.etools.websphere.tools.common_5.0.1/runtime/wteServers.jar;C:/Program Files/IBM/WebSphere Studio/wstools/eclipse/plugins/com.ibm.etools.websphere.tools.common_5.0.1/runtime/wasToolsCommon.jar
    Java Library path = C:\Program Files\IBM\WebSphere Studio\runtimes\aes_v4/bin;C:\Program Files\IBM\WebSphere Studio\eclipse\jre\bin;.;C:\WINNT\system32;C:\WINNT;C:\Program Files\CA\Dcs\DMScripting\;C:\Program Files\CA\DCS\CAWIN\;C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\CA_APPSW;C:\TNGSD\BIN;C:\Program Files\QuickTime\QTSystem\;C:\PROGRA~1\MICROS~2\Office;C:\Program Files\Microsoft SQL Server\80\Tools\BINN
    Current trace specification = *=all=disabled
    ************* End Display Current Environment *************
    [9/13/06 9:25:18:620 EDT] 64a937ec Server U Version : 4.0.4
    [9/13/06 9:25:18:636 EDT] 64a937ec Server U Edition: Advanced Single Server Edition for Multiplatforms
    [9/13/06 9:25:18:636 EDT] 64a937ec Server U Build date: Thu Sep 05 00:00:00 EDT 2002
    [9/13/06 9:25:18:636 EDT] 64a937ec Server U Build number: ptf40230.02
    [9/13/06 9:25:21:933 EDT] 64a937ec DrAdminServer I WSVR0053I: DrAdmin available on port 7000
    [9/13/06 9:25:21:995 EDT] 64a937ec ResourceBinde I WSVR0049I: Binding Session Persistence datasource as jdbc/Session
    [9/13/06 9:25:22:136 EDT] 64a937ec ResourceBinde I WSVR0049I: Binding IDS as jdbc/IDS
    [9/13/06 9:25:23:120 EDT] 64a937ec ServletEngine A SRVE0161I: IBM WebSphere Application Server - Web Container. Copyright IBM Corp. 1998-2001
    [9/13/06 9:25:23:183 EDT] 64a937ec ServletEngine A SRVE0162I: Servlet Specification Level: 2.2
    [9/13/06 9:25:23:183 EDT] 64a937ec ServletEngine A SRVE0163I: Supported JSP Specification Level: 1.1
    [9/13/06 9:25:23:292 EDT] 64a937ec ServletEngine A SRVE0167I: Session Manager is Configured - Initializing...
    [9/13/06 9:25:23:401 EDT] 64a937ec CacheManager A DYNA0011E: Servlet cache file dynacache.xml not found; caching is disabled
    [9/13/06 9:25:23:417 EDT] 64a937ec ServletEngine A SRVE0169I: Loading Web Module: IBM Universal Test Client.
    [9/13/06 9:25:23:761 EDT] 64a937ec WebGroup I SRVE0091I: [Servlet LOG]: JSP 1.1 Processor: init
    [9/13/06 9:25:23:792 EDT] 64a937ec WebGroup I SRVE0091I: [Servlet LOG]: SimpleFileServlet: init
    [9/13/06 9:25:24:511 EDT] 64a937ec ServletEngine A SRVE0169I: Loading Web Module: IDS.
    [9/13/06 9:25:24:683 EDT] 64a937ec WebGroup I SRVE0091I: [Servlet LOG]: JSP 1.1 Processor: init
    [9/13/06 9:25:24:683 EDT] 64a937ec WebGroup I SRVE0091I: [Servlet LOG]: SimpleFileServlet: init
    [9/13/06 9:25:24:698 EDT] 64a937ec WebGroup I SRVE0091I: [Servlet LOG]: InvokerServlet: init
    [9/13/06 9:25:24:714 EDT] 64a937ec WebGroup X Servlet Error-[SettingsServlet]: Failed to load servlet: java.lang.ClassNotFoundException: com.comp.ids.admin.servlet.SettingsServlet
         at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:382)
         at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:248)
         at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
         at com.ibm.ws.classloader.ReloadableClassLoader.loadClass(ReloadableClassLoader.java:79)
         at java.beans.Beans.instantiate(Beans.java:216)
         at java.beans.Beans.instantiate(Beans.java:77)
         at com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:141)
         at com.ibm.servlet.engine.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:325)
         at com.ibm.servlet.engine.webapp.WebApp.loadServletManager(WebApp.java:1218)
         at com.ibm.servlet.engine.webapp.WebApp.init(WebApp.java:145)
         at com.ibm.servlet.engine.srt.WebGroup.loadWebApp(WebGroup.java:259)
         at com.ibm.servlet.engine.srt.WebGroup.init(WebGroup.java:168)
         at com.ibm.servlet.engine.ServletEngine.addWebApplication(ServletEngine.java:652)
         at com.ibm.ws.runtime.WebContainer.install(WebContainer.java:36)
         at com.ibm.ws.runtime.Server.startModule(Server.java:617)
         at com.ibm.ws.runtime.StandardServer.initializeModules(StandardServer.java:333)
         at com.ibm.ws.runtime.StandardServer.initializeRuntime0(StandardServer.java:349)
         at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:884)
         at com.ibm.ws.runtime.StandardServer.main(StandardServer.java:519)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
         at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV4$1.run(ServerRunnerV4.java:56)
    Message was edited by:
    MCJasper

  • Cache Invalidation using Invalidation Rule -not working

    Hi,
    I am caching a JSP using servlet caching by specifying it in the cachespec.xml. I am setting a dependency id for the cache entry and have also set an invalidation rule saying if the dependency id comes as a parameter for "xyz" then invalidate the cache. The jsp is getting cached, and the value that I specify as dependency id is also appearing. But when i try to invalidate it by passing the parameter say "http://localhost/wps/myportal/dynacache?xyz=1234", the cache doesnt get invalidated.
    Please suggest as what is the issue with this approach? Why is the cache invalidation not happening as per the rule set? Is there any other approach to invalidate it other than TTL? I understand invalidation-generator can only be used for web-service client cache.
    Please reply ASAP..
    This is my cache entry
    <cache>
    <cache-entry>
    <class>servlet</class>
    <name>/_caching/jsp/html/CachingPortletView.jsp</name>
    <cache-id>
    <component id="Cached" type="attribute">
    <required>true</required>
    </component>
    <component id="locale" type="locale">
    <required>false</required>
    </component>
    <component id="" ignore-value="true" type="pathinfo">
    <required>false</required>
    </component>
    </cache-id>
    <dependency-id>test
    <component id="Cached" type="attribute">
    <required>true</required>
    </component>
    </dependency-id>
    <invalidation>test
    <component id="Cached" type="parameter">
    <required>true</required>
    </component>
    </invalidation>
    </cache-entry>
    </cache>
    Regards,
    Sariba

    This sounds like an application server specific configuration, which is off-topic here. Try a forum devoted to your application server.

  • Refresh Servlets in WLS 7

              We recently upgraded from a 6 to 7 weblogic environment, and I cannot get my servlets
              to reload without stopping and restarting the server. I have tried everything
              and this problem is driving me crazy.
              I had the same problem in 6 but was able to figure it out after reading some similar
              posts -- but there isn't enough material posted on 7 yet. Specifically, I have
              a servlet displaying as a portlet (by having the content URL as /servlet.SurveyServlet
              and mapping *.SurveySurvlet) but it is not refreshing when I change and recompile
              the code.
              What pitfalls are there when trying to avoid having a servlet cached?
              Please help...
              Laura
              

              Some developer adds all WEB-INF/classes in classpath because some third party lib
              like early version of Cocoon uses its own classloader. Just check your system
              classpath in Weblogic start script to remove any unwanted paths. Or check your
              weblogic configuration to make sure auto deploy is enabled.
              "Laura Cardinal" <[email protected]> wrote:
              >
              >What could be in my system classpath that would cause the servlet to
              >not refresh?
              >
              >-Laura
              >
              >
              >>Admin Console: YourDomain->Applications->Check Auto Deployed enabled.
              >>
              >>If it does not work, DEployments->Web Applications->Your application->redeploy
              >>each time you update something.
              >>
              >>If none works, you have something in system classpath which prevents
              >>reload.
              >>
              >>
              >>"Laura Cardinal" <[email protected]> wrote:
              >>>
              >>>We recently upgraded from a 6 to 7 weblogic environment, and I cannot
              >>>get my servlets
              >>>to reload without stopping and restarting the server. I have tried
              >>everything
              >>>and this problem is driving me crazy.
              >>>
              >>>I had the same problem in 6 but was able to figure it out after reading
              >>>some similar
              >>>posts -- but there isn't enough material posted on 7 yet. Specifically,
              >>>I have
              >>>a servlet displaying as a portlet (by having the content URL as /servlet.SurveyServlet
              >>>and mapping *.SurveySurvlet) but it is not refreshing when I change
              >>and
              >>>recompile
              >>>the code.
              >>>
              >>>What pitfalls are there when trying to avoid having a servlet cached?
              >>>
              >>>Please help...
              >>>Laura
              >>>
              >>
              >
              

  • XML transformation using XSLT and Resin 2.1.11

    I have the following problem:
    I'm using a servlet to transform the xml files in my web-app to html. The servlet caches the ones transformed results. For each request it checks if there exists a cached result and if the result is based on the most actual xml file version (checking the "lastModified" method of java.io.File that represents the requested file).
    This servlet works fine and without any errors.
    My web-app also has some other servlets that use the xml transformation to generate a fragment of html code (the menu structure of my "normal" servlets is defined in one xml file for all other files and servlets).
    After invoking these servlets (those that use the xml transformation to create their menu) the first described servlet (transformation of requested xml files) is not working "fine" any longer. All it results is the generated header and footer of the page (hard-coded in the XSL file). The complete content is lost.
    Any ideas how to solve this problem?
    Thanks in advance,
    Thof

    1. The cache:
    The Hashtable is a field of my servlet called XMLTransformerServlet. The cache is not removed or deleted and none of its items is removed or deleted.
    As I said: Caching works fine, wonderful, perfectly...
    That's definitively not the problem.
    2. Thread safety:
    I've made all my servlet methods thread safe (just checked this...)
    3. About the "anonymous" other servlet type that uses xml transformations:
    Some of my servlets use a (thread safe) method to generate a fragment of html code that will show a simple menu structure. Therefore my web-app uses a file called menu.xml - by that way there's only one menu to maintain what makes sure that all my pages get the same menu structure (finally also the xsl file I'm using for "normal" xml transformation imports/includes and interprets this menu.xml).
    The (thread safe) method has transforms the menu.xml file using a special xsl file (menu.xsl) and outputs the result to a StringWriter. From this StringWriter I obtain the code-fragment that will be returned by the method.
    Before I saw the class StringWriter the first time I've used a temporary file to output the transformation result. Next I red in the file and returned its content.
    Finally - this method is working fine and it's always returning the expected data.
    4. The problem:
    Sorry for repeating this all the time...
    What I'm processing:
    &#160;- requesting some xml files -> XMLTransformerServlet is invoked and works fine:
    &#160;&#160;&#160;-> doGet checks the resource (if resource doesn't exist HTTP404 will be responded)
    &#160;&#160;&#160;-> doGet checks the caching state for this resource
    &#160;&#160;&#160;&#160;&#160;&#160;a) resource is in cache and no newer version of the File exists -> return cached element
    &#160;&#160;&#160;&#160;&#160;&#160;b) resource is in cache but a newer version exists in the file system -> recache and return newly cached element
    &#160;&#160;&#160;&#160;&#160;&#160;c) resource is not in cache -> cache the resource and return the newly cached element
    &#160;- requesting one of the other servlets (those that use xml transformation for menu generation)
    &#160;&#160;&#160;-> servlets invoked work fine
    &#160;- requesting a xml file:
    &#160;&#160;&#160;a) current version in cache -> return cached element
    &#160;&#160;&#160;b) no current version in cache -> transform the xml file and cache it
    This last transformation of the requested xml file fails.
    It is not failing in the sense of "throwing an exception"... it seems to work 100% fine and results a String that could be responded to the browser.
    But stupidly it is not working fine...
    Maybe (as you wrote) this is a bug (maybe in Resins xml transformation api).
    Just thought someone else might have made a similar experience...

  • Webstart error: missing version response from server

    We deploy our application by Java Webstart. This works most of the time, but at the last update one client got an error when trying to update.
    The jnlp-file looks like this:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File -->
    <jnlp spec="1.0+" codebase="http://xyz/webstart/app/" href="webstart.jnlp"> 
    <information>   
      <title>xyz</title>   
      <vendor>xyz</vendor>   
      <homepage href="http://xyz"/>   
      <description>xyz</description>   
      <description kind="short">xyz</description>   
      <icon href="images/rvicon.gif"/>   
      <icon kind="splash" href="images/rvicon.gif"/>   
      <offline-allowed/> 
    </information> 
    <security>     
      <all-permissions/> 
    </security> 
    <resources>   
      <j2se version="1.5+"/>   
      <jar href="webstart.jar" version="0.52"/> 
    </resources> 
    <application-desc main-class="UseWebStartWithIsiplan"/>
    </jnlp>The webstart__V0.52.jar is located in $CATALINA_HOME/webapps/webstart/app.
    The user gets the following error:
    Exception:
    com.sun.deploy.net.FailedDownloadException: Ressource konnte nicht geladen werden: (http://xyz/webstart/app/webstart.jar, 0.52)
    at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
    at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
    at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
    at com.sun.javaws.Launcher.downloadResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.launch(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)Nested Exception:
    java.io.IOException: missing version response from server
    at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
    at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
    at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
    at com.sun.javaws.Launcher.downloadResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.launch(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)The client is running Windows XP SP2 and Java version 1.6.0_03-b05.
    The Server is Apache Tomcat 5.5.23, Java version 1.5.0_12-b04.
    Has anybody an idea what might cause this error?

    We've gotten that error when the servlet runs out of memory. The out of memory error happens when it is building the jardiff file, which can require a lot of memory to do. The servlet caches any jardiffs that it builds, so most users won't see the problem because they are requesting prebuilt jardiffs.
    We've found that the servlet runs best with 256mb of max heap. But I'd imagine we are more heavy weight users than most.
    I've done some stress testing on the 1.5 servlet and did not find any real memory leaks.
    Based on the open source version of the servlet (which I believe is pretty much the same as the one distributed with java 1.5).
    It is keeping objects in memory to track which jardiffs it has built and to track any accessed resource (jar or jnlp). If your server has enough different jars and jnlps then you need to give it enough memory to keep all these small objects in memory.
    If you want be 100% sure you've given it enough memory, then you can write a script which does a HEAD request on every possible jar and jnlp inside of the servlet. That should max out its memory usage.

  • Uploading Very Large Files via HTTP

    I am developing some classes that must upload files to a web server via HTTP and multipart/form-data. I am using Apache's Tomcat FileUpload library contained within the commons-fileupload-1.0.jar file on the server side. My code fails on large files or large quantities of small files because of the memory restriction of the VM. For example when uploading a 429 MB file I get this exception:
    java.lang.OutOfMemoryError
    Exception in thread "main"I have never been successful in uploading, regardless of the server-side component, more than ~30 MB.
    In a production environment I cannot alter the clients VM memory setting, so I must code my client classes to handle such cases.
    How can this be done in Java? This is the method that reads in a selected file and immediately writes it upon the output stream to the web resource as referenced by bufferedOutputStream:
    private void write(File file) throws IOException {
      byte[] buffer = new byte[bufferSize];
      BufferedInputStream fileInputStream = new BufferedInputStream(new FileInputStream(file));
      // read in the file
      if (file.isFile()) {
        System.out.print("----- " + file.getName() + " -----");
        while (fileInputStream.available() > 0) {
          if (fileInputStream.available() >= 0 &&
              fileInputStream.available() < bufferSize) {
            buffer = new byte[fileInputStream.available()];
          fileInputStream.read(buffer, 0, buffer.length);
          bufferedOutputStream.write(buffer);
          bufferedOutputStream.flush();
        // close the files input stream
        try {
          fileInputStream.close();
        } catch (IOException ignored) {
          fileInputStream = null;
      else {
        // do nothing for now
    }The problem is, the entire file, and any subsequent files being read in, are all being packed onto the output stream and don't begin actually moving until close() is called. Eventually the VM gives way.
    I require my client code to behave no different than the typcial web browser when uploading or downloading a file via HTTP. I know of several commercial applets that can do this, why can't I? Can someone please educate me or at least point me to a useful resource?
    Thank you,
    Henryiv

    Are you guys suggesting that the failures I'm
    experiencing in my client code is a direct result of
    the web resource's (servlet) caching of my request
    (files)? Because the exception that I am catching is
    on the client machine and is not generated by the web
    server.
    trumpetinc, your last statement intrigues me. It
    sounds as if you are suggesting having the client code
    and the servlet code open sockets and talk directly
    with one another. I don't think out customers would
    like that too much.Answering your first question:
    Your original post made it sound like the server is running out of memory. Is the out of memory error happening in your client code???
    If so, then the code you provided is a bit confusing - you don't tell us where you are getting the bufferedOutputStream - I guess I'll just assume that it is a properly configured member variable.
    OK - so now, on to what is actually causing your problem:
    You are sending the stream in a very odd way. I highly suspect that your call to
    buffer = new byte[fileInputStream.available()];is resulting in a massive buffer (fileInputStream.available() probably just returns the size of the file).
    This is what is causing your out of memory problem.
    The proper way to send a stream is as follows:
         static public void sendStream(InputStream is, OutputStream os, int bufsize)
                     throws IOException {
              byte[] buf = new byte[bufsize];
              int n;
              while ((n = is.read(buf)) > 0) {
                   os.write(buf, 0, n);
         static public void sendStream(InputStream is, OutputStream os)
                     throws IOException {
              sendStream(is, os, 2048);
         }the simple implementation with the hard coded 2048 buffer size is fine for almost any situation.
    Note that in your code, you are allocating a new buffer every time through your loop. The purpose of a buffer is to have a block of memory allocated that you then move data into and out of.
    Answering your second question:
    No - actually, I'm suggesting that you use an HTTPUrlConnection to connect to your servlet directly - no need for special sockets or ports, or even custom protocols.
    Just emulate what your browser does, but do it in the applet instead.
    There's nothing that says that you can't send a large payload to an http servlet without multi-part mime encoding it. It's just that is what browsers do when uploading a file using a standard HTML form tag.
    I can't see that a customer would have anything to say on the matter at all - you are using standard ports and standard communication protocols... Unless you are not in control of the server side implementation, and they've already dictated that you will mime-encode the upload. If that is the case, and they are really supporting uploads of huge files like this, then their architect should be encouraged to think of a more efficient upload mechanism (like the one I describe) that does NOT mime encode the file contents.
    - K

Maybe you are looking for

  • Can i merge users on the same iMac

    i've just got my first mac. I migrated files from old pc. This has created another user. Can I merge the two?

  • Query Performance Issue based on the same Multiprovider

    Hi All, I am facing a performance issue with one of the BEx Query 1 based on a particular Multiprovider. I have done all the kind of testing and came o a conclusion that the OLAP: Data Transfer time for the query is the max at around 820 Secs. The su

  • Error when trying to run Advisor

    Hi! I get the following error when trying to run the Advisor (Application Builder > Application xxx > Utilities > Advisor) over our application: Unknown type! View: APEX_APPLICATION_PAGE_PROC Column: CONDITION_EXPRESSION1 Value: WHEN_ANY_ITEM_IN_COMM

  • Fail to generate EoL/EoS Hardware Report

    Hi All, I tried to generate EoL/EoS Hardware Report through RME Report Generator. Even with correct cisco.com user name and password and correct proxy server configuration. It just keeps telling me it can't get data from cisco.com. I configured proxy

  • Error "INCLUDE report "/1CAGTF/IF_LOGFUNC_000208" not found" in SolMan.

    Hi experts, Need help, in SolMan when EWA background job executes it gives error: Short text      Syntax error in program "RDSVASAEW_DBMSS____________061 ". What happened?      Error in the ABAP Application Program      The current ABAP program "SAPL