Web application Unloading classes of WL Stubs every several hours

Hello,
We have a WEB applications, which connects to Server Application using EJB technology - both deployed on the same
domain on Weblogic 10.
Recently, we started to experience a strange phenomenon - WEB application's threads get stalled and get a STUCK
state.
Sometimes, it is accompanied with the java.lang.OutOfMemoryError exception.
Only reboot helps to recover from it.
Trying to identify a problem we added some parameters to get some more information in the application logs.
What we found is that once in a while (depend on a system load), we see the following messages in console logs:
[Unloading class <class name>]
These are the examples about how often the events happen and it’s durations:
2011-01-30 10:14:11 - 2011-01-30 10:14:28
2011-01-30 12:27:51 - 2011-01-30 12:28:08
2011-01-30 13:59:46 - 2011-01-30 14:00:02
2011-01-30 14:56:59 - 2011-01-30 14:57:13
2011-01-30 14:57:46 - 2011-01-30 14:58:00
2011-01-30 17:11:21 - 2011-01-30 17:11:39
2011-01-30 18:29:24 - 2011-01-30 18:29:44
2011-01-30 20:05:34 - 2011-01-30 20:05:53
2011-01-30 21:48:39 - 2011-01-30 21:48:55
. - Each time are about 20000 - 30000 classes are unloaded.
. - About 150000 classes are unloaded daily,
........- 90% out of it are the classes, which ends with "*..Impl_1001_WLStub*"
............- 30% out of Stubs are Home Stubs, which ends with "*..HomeImpl_1001_WLStub*"
*(!) The most interesting that out of all this huge amount of classes, which are unloaded daily,*
only +23+ types of different Stubs are unloaded, whereas out of it +10+ different Home Stubs:
$> grep "Unloading class.*Impl_1001_WLStub" Web1.out | sort -u | wc -l
23
$> grep "Unloading class.*HomeImpl_1001_WLStub" Web1.out | sort -u | wc -l
10Sometimes (as I said above) it ends with the "+java.lang.OutOfMemoryError+" exception.
So, the questions are:
1. What could be a reason for such behavior of a system?
2. What message "Unloading class" says?
3. Is it normal that (as you see from above), the same type of Stubs are loaded?
It looks like a new Stub is created for every EJB invocation, isn't it?
Is it normal? If not, what could be a reason for this?
--------------- S Y S T E M ---------------
jvm_args: -Xms2048m -Xmx2048m -XX:MaxPermSize=512m
OS: Solaris 10 5/08 s10s_u5wos_10 SPARC
uname:SunOS 5.10 Generic_142900-02 sun4v (T2 libthread)
rlimit: STACK 8192k, CORE 1024000k, NOFILE 65536, AS infinity
CPU:total 64 has_v8, has_v9, has_vis1, has_vis2, is_ultra3, is_sun4v, is_niagara1
Memory: 8k page, physical 66977792k
vm_info: Java HotSpot(TM) Server VM (1.5.0_11-b03) for solaris-sparc, built on Dec 15 2006 01:18:11

You could see how your memory is managed by the JVM, by using for example a tool such as jconsole.
Unloading class means that loaded classes are garbage collected. To see when the classes are loaded
you can use the JVM option -verbose:class. I think somehow you are constantly loading the classes in the application,
maybe by creating the stub over and over again when you need it. You can create the stub once by using
a singleton pattern.
A good overview of the available tools for the Sun JVM is given here: http://www.oracle.com/technetwork/java/javase/index-137495.html

Similar Messages

  • Get installation path of web application from class file

    Can anybody tell me how I can get the path on disk to the root of my web application from a class file. Im running under Tomcat 5.5 and I have 3 copies of the same webapp under 3 differenet directories:
    C:\xxx\dev\yyy
    C:\xxx\test\yyy
    C:\xxx\prod\yyy
    Based on which directory the web-app, I need to do a lookup on a properties file to pull the right jdbc connection to connect to the appropriate database. So it would be similar to using getServletContext().getRealPath("/") from a .jsp file.
    Thanks,
    Jason

    Sorry for not clarifying. I have a properties file with name/value pairs. I know where this properties file is and I can do a lookup in it. In this file, I have jdbc connection names which point to corresponding jdbc resources in my context.xml file.
    jdbcDevDatabase=jdbc/tfmDev
    jdbcTestDatabase=jdbc/tfmTest
    jdbcProdDatabase=jdbc/tfmProd
    These connections are for dev, test and prod databases. Now based on where the web-app is installed on disk, i.e-dev dir, test dir, prod dir, I want to retrieve the corresponding connection. The problem is I don't know how to get a handle to the web apps real path on disk without access to the request object or using getServletContext().getRealPath("/") which are not available to me in a class file.
    Thanks,
    Jason

  • Web Applications questions

              Hi,
              I read through the Web Application documentation and I could not find answers to some questions, so I thought that someone on these forums might be able to help.
              1) Can two or more web applications share code? Or, in other words, can a web application use classes that do not belong to it? If yes, where should these classes reside?
              I tried sharing the code to get a database connection and the Class.forName("weblogic.jdbc.pool.Driver") instruction fails with the error ClassNotFoundException: weblogic/jdbc/pool/Driver.
              2) Can two web applications cooperate? Or, in other words, can one web application use services provided by another web application (like servlets, .jsp pages, images, etc.)?
              I tried linking to a servlet in a web application from another web application and got the error NoClassDefFoundError: javax/servlet/http/HttpServletRequest.
              3) If two web applications can cooperate, can they still cooperate if they reside on two different machines? Or even two different clusters?
              Thanks,
              Vladimir
              

              Alexander Petrushko <[email protected]> wrote:
              >vladimir wrote:
              >
              >> Hi,
              >>
              >> I read through the Web Application documentation and I could not find answers to some questions, so I thought that someone on these forums might be able to help.
              >>
              >> 1) Can two or more web applications share code? Or, in other words, can a web application use classes that do not belong to it? If yes, where should these classes reside?
              >
              >> I tried sharing the code to get a database connection and the Class.forName("weblogic.jdbc.pool.Driver") instruction fails with the error ClassNotFoundException: weblogic/jdbc/pool/Driver.
              >
              >Set your weblogic.class.path correctly and it will work. Look at the shell/bat scripts supplied with the server distribution.
              >
              >> 2) Can two web applications cooperate? Or, in other words, can one web application use services provided by another web application (like servlets, .jsp pages, images, etc.)?
              >
              >Yes, use RequestDispatcher and the correct path.
              >
              >> I tried linking to a servlet in a web application from another web application and got the error NoClassDefFoundError: javax/servlet/http/HttpServletRequest.
              >
              >That's a CLASSPATH/weblogic.class.path issue.
              >
              >> 3) If two web applications can cooperate, can they still cooperate if they reside on two different machines? Or even two different clusters?
              >
              >If webapps A and B are on different machines (VMs), your webapp A can use sendRedirect() to have the client go to webapp B or read B's output stream and proxy it back to the client. Look at
              >java.net.HttpURLConnection if you want to use the latter method. Your webapp A would be no different from the browser or any other HTTP client when talking to webapp B.
              >
              if you go from webapp A to webappB, how do you maintain session state (without saving it in a database) ?
              >Cheers,
              >
              >Alex
              >
              

  • Order of class loading in a Web Application

    Hi,
    I have been trying to find out if there is a defined order in which classes contained in WEB-INF/classes
    and/or WEB-INF/lib should be loaded.
    There doesn't appear to be any mention of class loading order in either the J2EE 1.3 or J2EE 1.4
    specifications. That does not mean that there isn't a defined class load order, it just means I haven't found one.
    Typical behaviour from servers such as Tomcat (reference implementation of the Servlet Engine) show
    that classes in WEB-INF/classes are loaded before classes contained in jars under WEB-INF/lib.
    Because there doesn't appear to be a mandated class load order I cannot assume that the same
    behaviour holds for all servers, unless someone here knows better of course.
    The reason for the question is that relying on the exhibited class load order means we can patch web applications by simply putting the patch under the WEB-INF/classes directory.
    If this should not be relied upon then patches will have to be applied directly to the affected jar files,
    this is not a problem in itself however it is nice to be able to keep the patches out of the jars for
    ease of rolling back patches without having to copy jar files all over the place.
    Any insights would be welcome.
    Thanks

    If you say that it is server specific i don't find
    that to be the correct answer b'cozI didn't give an answer, I am looking for one. I gave an example of the behaviour that Tomcat 4.1.x
    exhibits, one that we currently make use of for patching web applications. My question was about
    whether or not this behaviour can be relied upon.
    the class files are depended on the jar files which
    need to checked in first before getting loaded b'coz
    it should check for dependent files before only while
    getting deployed.This is why the class load order is important.
    Is the Web Application Classloader going to look in WEB-INF/classes first every time followed
    by WEB-INF/lib everytime, is the order undefined, or is it reversed?
    More over if you just think of class loading mechanism
    of classes folder only then it is loaded in the order
    specified in the web.xml file.
    in this we specify the order of loading.As far as I know web.xml does not allow you to specify where classes should be loaded from and in
    which classpath order, you define which classes should be used for application components.
    The only load order you can specify is the load order of servlets on startup.
    If you know different I would love to know how you would configure web.xml to specify the classpath order
    in which classes are loaded.

  • SSIS is not running in 64 bit production server - Error Class cannot be found while running from c# web application

    Full error message:
    An Integration Services class cannot be found. Make sure that Integration Services is correctly installed on the computer that is running the application. Also, make sure that the 64-bit version of Integration Services is installed if you are running a 64-bit
    application
    I have developed SSIS package in my development machine where the OS is 64 bit and sql server 2012 is installed.
    The package has excel source and oledb destination. Excel files can be both .xls and .xlsx format. Since i want to run both xls and xlsx format i have installed
    32 bit Microsoft Acess database engine form the below link, then both xls and xlsx format worked.
    .xls - 32 bit
    .xlsx - 32 bit and 64 bit is available. So in common i have to run it in 32 bit.
    I have set Run64BitRuntime to False and ran package. it is working fine. I cannot set Run64BitRuntime to True and run the packages. Because i have office products installed on my machine which is 32 bit. if try to install 64 bit Microsoft Acess
    database engine redistributable pacakage from below link , it is throwing error saying that, already office 32 bit product is installed so uninstall 32 bit product and install 64 bit.
    Excel connection string is Ace database engine only. everything works fine.
    microsoftcom/en-us/download/details.aspx?id=13255
    Now i am trying to invoke package from c# code by using Microsoft.SqlServer.ManagedDTS.dll and it is also working fine in my dev machine.
    When i deploy the web application in production am getting the error while invoking package. the full error message is posted in 1st line of this thread.
    Then i tried to execute the package in production server by using dtexec utility, it is working fine. I tried both 32 bit and 64 bit dtexec utility by going to specific path (program files(x86) and Program files) via command prompt.
    It is all working fine. So the error coming when i invoke from web application. My guess is ManagedDTS causing problem.
    Where can i find 64 bit Microsoft.SqlServer.ManagedDTS.dll
    or is it because of any other problem. i have checked below links, still problem not resolved.
    social.msdn.microsoftcom/Forums/sqlserver/en-US/491384d2-02f7-4178-a1c3-bcbd58e57fce/an-integration-services-class-cannot-be-found-make-sure-that-integration-services-is-correctly?forum=sqlintegrationservices
    forums.aspnet/t/1990417.aspx?Issue+deploying+SSIS+Package+in+production+web+server

    1) "I have set Run64BitRuntime to False and ran package" -> this is not valid outside of your development environment, it is made for simulation purposes as all the dev tools are 32 Bit
    2) "Where can i find 64 bit Microsoft.SqlServer.ManagedDTS.dll " is basically SSIS. It is quite possibly the culprit. I am inclined to think you attempt to run the package where there no SSIS installed.
    Arthur
    MyBlog
    Twitter

  • Getting class cast exception in Web application.

    I have a web application deployed using standard specs for deployment. I
              have and web-inf directory with a web.xml file set up. All the servlet
              classes are in the classes sub-directory of web-inf.
              If I deploy this application using the Tomcat application server,
              everything works as expected. When I deploy this application using the
              Weblogic software, I can get to the initial page, put once I select a
              link that calls the main servlet, I get a classcast exception. Both the
              Tomcat and Weblogic software point to the same directory for the
              application.
              I double checked and made sure that no other instances of my servlet
              classes exist anywhere else in the class path.
              Any one have any thoughts or suggestions. I am perplexed that this web
              app runs fine under the Tomcat software and yet...
              Thanks.
              Paul Garduno
              

    Thanks for your reply. I am not using any EJBs. From what I have
              gathered since writing my message, this may be the "dreaded" class cast
              exception (although I don't know why since it runs under Tomcat).
              Basically, the initial page is displayed. When you select the SEARCH
              button (for example), the request goes to a servlet which puts a vector
              of custom classes into a session parameter. The request is then
              forwarded to the JSP page which uses the information in the classes to
              help build some information on the page. The first line in the JSP is
              processed (a simple output line to the system console) and then the
              classcast exception occurs.
              According to the info that I have seen, this shouldn't happen since I am
              not changing either the servlet or JSP files which would mean that
              nothing should be re-compiled.
              I have a call into tech support. I will post their answer and copy you
              on the message.
              Thanks.
              Paul
              Cameron Purdy wrote:
              >
              > Are you using EJBs hosted on the same instance of WebLogic? If so, delete
              > the home/remote interfaces from your web deployment. Otherwise, post the
              > exception listing ....
              >
              > Cameron Purdy, LiveWater
              >
              > "Paul Garduno" <[email protected]> wrote in message
              > news:[email protected]...
              > > I have a web application deployed using standard specs for deployment. I
              > > have and web-inf directory with a web.xml file set up. All the servlet
              > > classes are in the classes sub-directory of web-inf.
              > >
              > > If I deploy this application using the Tomcat application server,
              > > everything works as expected. When I deploy this application using the
              > > Weblogic software, I can get to the initial page, put once I select a
              > > link that calls the main servlet, I get a classcast exception. Both the
              > > Tomcat and Weblogic software point to the same directory for the
              > > application.
              > >
              > > I double checked and made sure that no other instances of my servlet
              > > classes exist anywhere else in the class path.
              > >
              > > Any one have any thoughts or suggestions. I am perplexed that this web
              > > app runs fine under the Tomcat software and yet...
              > >
              > > Thanks.
              > >
              > > Paul Garduno
              

  • Dynamic class reloading in modular web application

    Hi.
    My web application has these requirements:
    A. Functional modularization (like plug-ins). Modules will be simple jars containing application logic classes: dto beans, business logic services, dao (jpa), framework stuff (Struts2), etc...
    B. At runtime and without restarting the application "class loading" must be aware of classes inside new, changed and removed modules.
    C. Some of these jars will be outside the web application folder (WEB-INF/lib), possibly outside the container itself too.
    My question:
    1. Can I achieve all or some of my requirements with a Java web application?
    2. How should I manage the modules?
    3. Do I need some special web container feature (maybe osgi)?
    4. Can I use a custom class loader in my application?
    The architecture objectives are:
    I. Provide scalability.
    II. Efficient development process (independent deployment and no application restart required).
    III. Better production support (no application restart required for changes).
    More on the architecture:
    a). Functional scalability, meaning this that my application may functionally grow up to an indeterminate number of small functional modules.
    b). Modules will be developed, deployed and maintained independently so the application discovers and loads classes on demand.
    c). Avoid a big .war file containing all the small modules because a small change in one module would involves deploying all the other modules (possibly hundreds o even thousands of them) and restarting the application.
    d). Above point involves dynamic class reloading.
    I guess this is addressed by OSGI (looks like heavy to deal with), Jigsaw (still under development) and maybe others. I think the key point is the class loader. I will develop a custom class loader but maybe you have some advice for me before starting to develop.
    Thanks and regards.

    Classes maintained by the container should not be loaded by an application. You want the container to read those classes and react accordingly. Most of those classes are read when the container starts up a container restart will be required. Trying to leverage another container within a container does not sound like it will be worth (if you can get it to work).
    Perhaps you should state the problem that you are trying to solve with these modules so that others may suggest more feasible solutions to achieve your target goals.

  • Web application restarts when JSP or .class files on disk change

    Hello,
    I am deploying a Spring enabled web application into WLS 12 using IntelliJ11.
    I am building an exploded war in a target directory and have my WLS domain's config.xml set up to pick up the application from that directory directly. I am not using a staging approach.
    The application starts up fine in debug mode in IntelliJ 11. I am able to make changes to Java classes, hit Ctrl+F9 to "Make the Project" and changed Java classes get reloaded and I see the changes I have made.
    All this happens without WLS reloading the web application, which is as it should be.
    When I try to make changes to JSPs, I start seeing a different behavior. This is how I'm changing my JSPs:
    1) I edit the file in IntelliJ.
    2) I hit Ctrl+F9....nothing happens, I don't see my changes in the JSP, I don't see any web application restarts. This is because with a Ctrl+F9, IntelliJ does not update the JSP in the target directory.
    3) When I hit Ctrl+F10 instead, i.e. "Update application", IntelliJ presents me with a choice to "Update resources", "Update classes & resources", "redeploy", "restart the server".
    I choose "Update resources"
    When I do this, I see on the file system that IntelliJ has changed the JSP in the target directory. As it should. WLS is also using this directory, so it should see the changed JSP and recompile and show me my changes.
    Now when I access the application, I see varying behavior.
    Sometimes I see my JSP changes just fine and sometimes instead of seeing my changes, my entire web application starts shutting down and attempts to restart. Note, I said the web application and not the WLS server.
    It's almost as if I've hit a Redeploy.
    I have disabled "Fast Swap", as I cannot get my Spring application context to load when this is enabled. So, I'm just using Hot Swap.
    Why is WLS restarting my web application once in a while when my JSPs change?
    And this is not restricted to JSP files only. If I choose the option to "Update classes & resources", any Java classes I've changed get updated on the disk in the target directory. Now WLS once in a while decides that it needs to restart my web application. I can get away with hitting Ctrl+F9, which does not update the .class on the disk and only in the JVM, and see my changes.
    But I have no such option for JSPs. So hot swap essentially is erratic for JSPs in my deployment in WLS 12.

    There is a workaround for this. Not pretty, but it works for me.
    Instead of having IntelliJ update the exploded war when I do a Make (Ctrl+F9), I tell IntelliJ to NOT do any updates to the artifact on the disk.
    That is, just compile. As explained before, that works for changes to Java classes. IntelliJ/Java does a hot swap in memory, so your Java changes are seen.
    Now for JSPs. Write an ant target that copies the JSPs into the deployed exploded war.
    For some reason, when ant does the copying, WLS doesn't freak out and decide to restart the web application. I have no idea why. I did a directory compare when IntelliJ did the copying, and the only thing that had changed was the JSP I had modified.
    Anyways that's one solution.
    The other is, as my colleague tested out, run in Production mode, and have the jsp reload check parameter set to 0, which means check the JSPs always. This is needed because in Production mode, -1 is the default value, which means never check for JSP changes.

  • Using a VB Class from a Java Web Application

    Hi,
    I need to instance a VB class, and then to invoke their methods, from a java web apllication. The code is:
    Set object = CreateObject("AS2.OBJECTS")
    If object.PutName(sCadenaError, sEntidad) Then
    Array1 = object.getData(sCadenaError, iEntorno, False)
    End if
    "AS2" is the VB dll library. "OBJECTS" is the class to instance. And "PutName" and "getData" are the methods that the web application has to call.
    Can I instance the class from Java, and use the methods with the same data types? What steps have I to do in JNI?
    Thanks in advance,
    Mary

    You are right, I guess my question is a good candidate for RTFM!
    I should have searched also on help.ondemand.com
    I just looked into SDN and ui5 sdk help.
    Thanks for your help
    Regards
    Vincenzo

  • Deploying web application to OC4J  - servlet class not found

    Hi,
    Im trying to deploy war file with web application,
    that I run before on Tomcat.
    During deployment procces everything seems to be OK.
    But when I try to log on web, I get 500 error...
    log file:
    07/07/12 15:10:14.562 webapp1: Servlet error
    javax.servlet.ServletException: Error instantiating servlet 'org.apache.jsp.index_jsp'. Servlet class org.apache.jsp.index_jsp not found in web-application webapp1
    where org.apache.jsp.index_jsp is path from web.xml and servlet index_jsp.class is in
    Web-Inf/classes/org/apache/jsp/ dir.
    Any Idea?
    Thanks a lot.
    H.

    Hi Steve,
    thanks for your answer, because my question is quite stupid, I know.
    But I'm not so much interested in pre-translated jsp files dependences on java container.
    Yes, my application use some parts of catalina lib, but I would like to just get index.jsp
    and this compiled class (org.apache.jsp.index_jsp.class) is "catalina lib free" I think?
    Or should I change my build.xml?
    Thanks.
    H.

  • File Class in Web Applications

    Hallo, i am creating a web Application but i need to know the fullpath of a file. I see that in the web based application i can call that FileReference class but with this class i can only get the name of a file and not the fullname. I can do this with the File Class which is avaible in Air Applications. How can i do it with my FlashPlayer application??....
    Thanks for all
    Max

    You can't get that with FileReference on the web (Security reasons). It was
    possible to get it with an HTML form and Javascript but I am not sure Firefox 3
    is still delivering the full path. Also not sure it works in all the browsers.
    C

  • EJB accessing web application classes

    Hi,
    what is the right method to enable packaged EJB to access classes of a
    web application? Packaging both the EJB and web application in same
    ear is not possible in this situation. We are running WebLogic 6.0 and
    ejb is in
    wlserver6.0/config/mydomain/applications/EJB.jar
    and the classes it should use are in
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes,
    i.e. not packed into war -package. adding
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes
    to WebLogic's CLASSPATH enables the ejb to deploy but seems to screw
    other deployments.

    Please address calling and EJB from a JSP using the EJB to JSP tags...?I'm throwing
    ClassCast errros on Object...
    William Kemp <[email protected]> wrote:
    This is addressed numerous times in this newsgroup and others. So, if
    you are
    insterested in additional explanations, a search of the newsgroups will
    be
    productive.
    The WLS 6.x classloading scheme for enterprise apps, ejbs, and webapps
    does
    not permit and ejb to access webapp classes in the WEB-INF/classes directory
    unless those classes are placed in the java system classpath, which,
    you have
    found, creates other problems.
    If classes are needed by both webapp and ejb, place them in a utility
    jar file
    that is packaged in the ear with the ejb, or webapp, or both, and refer
    to
    them with the Class-Path manifest directive in the ejb jar file or the
    webapp
    war file.
    For the details, see:
    http://e-docs.bea.com/wls/docs61/programming/packaging.html#1029830
    and the 7.0 stuff is good, too:
    http://edocs.bea.com/wls/docs70/programming/classloading.html#1029830
    Bill
    janne wrote:
    Hi,
    what is the right method to enable packaged EJB to access classes ofa
    web application? Packaging both the EJB and web application in same
    ear is not possible in this situation. We are running WebLogic 6.0and
    ejb is in
    wlserver6.0/config/mydomain/applications/EJB.jar
    and the classes it should use are in
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes,
    i.e. not packed into war -package. adding
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes
    to WebLogic's CLASSPATH enables the ejb to deploy but seems to screw
    other deployments.

  • On Mac OS - I'm debuggig a huge web application. Firefox crashes often flushes 10 MB image cache every time. How to restart with "filled" cache?

    - Mac OS
    - I'm debuggig a huge web application on https. When it starts, it downloads 10MB images.
    - Firefox crashes often during debugging.
    - Every time, it flushes the images frow the cache and downloads the 10MB again.
    - I often work from different places and sometimes have rather slow internet connections so then this is really annoying for me
    - Having a possibility to start Firefox in "Cache-Safe" mode for debugging would be perfect - when it crashes then, the cache should not be flushed completely but restored to the o.k. situation before entering the mode
    - Any advice?

    Please update to Firefox 25 before continuing, do you still have an issue there?

  • Application Main Class Lost Every Run

    In Studio One I set application main class and run/debug it successfully, but the next time I run/debug the main class seems to get lost and I need to at least click in the main class source file in source editor.
    Does Sun One lose the main class value or I miss something?
    Thanks,
    Alex

    Yes I also found that the main class is lost everytime.
    Then you have to click on it and press execute or left click and press execute from pop-up menu.
    Well Sun One is far from perfect.
    LiNks

  • How to run background process with web application

    Hi,
    I have a web application , a servlet. I would like to have a background process that collecting data for my servlet.
    How can I achieve this? can someone point me to a tutorial or example?
    Also, would it be possible to share an object between the background process and myservlet?
    Thanks,

    Thanks for the idea.
    I had the background process running. :)
    But I'm still do not understand this part to share an object such as Java Map (<id,myobject>), what do you mean by "task a property of my ServletContextListener" ?
    BalusC wrote:
    If you make the task a property of your ServletContextListener implementation and put the implementation in the application scope, then you can access it from any servlet.Do you mind explain to me a bit more I'm still fairly new with this or maybe if you know an example.
    Here's my code snippet so far. How can I share myList to MyServlet?
    public class MonitorTimer extends TimerTask
           private Map<String, Channel> myList;
         @Override
         public void run()
              System.out.println("Monitor Timer times up");
              //Clear the map before fill with the new data
              if(myList!= null)
                   myList.clear();
              loadConfig();
            private void getData()
               //fill myList with data
    public class MyContextListener implements ServletContextListener
         @Override
         public void contextDestroyed(ServletContextEvent arg0)
              // TODO Auto-generated method stub
         @Override
         public void contextInitialized(ServletContextEvent arg0)
              System.out.println("Context Initialized");
              Timer timer = new Timer();
              //Run MonitorTimer every 2 minutes
              timer.scheduleAtFixedRate(new MonitorTimer(), 10*1000,2*60*1000);
    public class MyServlet extends HttpServlet implements Servlet
         @Override
         public void destroy()
              // TODO Auto-generated method stub
              super.destroy();
         @Override
         protected void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException
    }Thank you so much for your help,
    Edited by: geek.shrek on Nov 4, 2009 1:50 PM

Maybe you are looking for