Global static variable. I just CANNOT get global for everything

Hi,
I copied a connection pool example from oracle web site. It uses static variable. Its not a servlet, its a javabean. I can run a million times in one session and everything is great. If I open up another session, it creates another instance and creates more connections when it should be seeing the previous instance.
My question is how to make a static variable global to the entire application? Do i have to initialize it in the servlet container? All im doing is calling a JSP page which calls this bean. If instance is null, create 5 new connections. Well like i stated above, it works for a single session. It appears that each session gets its own instance. I have been working and debugging this for a long time and I just cannot come up with a solution...
Any ideas???
Thanks as always

Declar it as static within the servlet class.
public class MyServlet extends HttpServlet {
public static ConnectionPool pool;
Then you can access it from any JSP/Servlet using MyServlet.pool but you may have to import the class into the JSP/Servlet.
Be aware that there may be synchroniztion issues when you access this static object so you may want to synchronize access to the pool.
  synchronized (application) {
       if (MyServlet.pool == null) { //initialize pool code here }

Similar Messages

  • Question: I cannot start my iPhone 4. It just "died". I connected it ti my Mac, but tha Mac doesn´t recognise it. Any ideas how to wake the phone.The battery is fine, I just cannot get it working!

    Question: I cannot start my iPhone 4. It just "died". I connected it ti my Mac, but tha Mac doesn´t recognise it. Any ideas how to wake the phone.The battery is fine, I just cannot get it working!

    See Here for
    Frozen or unresponsive iPhone
    Try this first... You will not lose any Data...
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...
    http://support.apple.com/kb/ht1430
    If that does not work... try letting the battery fully drain.
    Then Charge for an Hour and try the suggestions again.

  • Authentication failed. Cannot get kdc for realm

    There is something missing from the log file that I need to see. When a user logs in you should see what was submitted in the std.out (since you have enabled JDK tracing with debug=true in the bsclogin.conf)
    "Cannot get kdc for realm ECM-INC.COM"
    Without seeing the entire error message it seems that java cannot communicate with the KDC you have defined under the ECM-INC.COM realm (this would be the suspect KDC ECM-ADC.ECM-INC.COM) can you ping it? is it a domain controller?, is the global catalog enabled?
    run the set command from a DOS window and try replacing that ECM-ADC part with the value in the logon server (all CAPS).
    Also verify the problem exists by typing BOinstall\javasdk\bin\kinit username
    Regards,
    Tim

    Hi Tim,
    I am getting the following error, I have a case in with SAP but have not recieved a response. I noticed that you are an SAP employee, is it possible to get you involved with my case? Either way below is the error I'm getting.
    C:\Program Files (x86)\Business Objects\javasdk\bin>kinit.exe CHI\biadauth
    Password for CHI\[email protected]:######
    Exception: krb_error 6 Client not found in Kerberos database (6) Client not foun
    d in Kerberos database
    KrbException: Client not found in Kerberos database (6)
            at sun.security.krb5.KrbAsRep.<init>(KrbAsRep.java:66)
            at sun.security.krb5.KrbAsReq.getReply(KrbAsReq.java:486)
            at sun.security.krb5.KrbAsReq.getReply(KrbAsReq.java:444)
            at sun.security.krb5.internal.tools.Kinit.sendASRequest(Kinit.java:310)
            at sun.security.krb5.internal.tools.Kinit.<init>(Kinit.java:239)
            at sun.security.krb5.internal.tools.Kinit.main(Kinit.java:106)
    Caused by: KrbException: Identifier doesn't match expected value (906)
            at sun.security.krb5.internal.KDCRep.init(KDCRep.java:133)
            at sun.security.krb5.internal.ASRep.init(ASRep.java:58)
            at sun.security.krb5.internal.ASRep.<init>(ASRep.java:53)
            at sun.security.krb5.KrbAsRep.<init>(KrbAsRep.java:50)
            ... 5 more
    A little bit of background on this. We use a single lable domain with multiple forest and multiple domains in those forest. I realize that the kinit.exe tool only test a single domain so I picked out only one domain to test with but I still get the error above. Any thoughts?
    Thanks,
    Tammy

  • I cannot get Icloud for windows update 4.0.2 to install on my Win 8.1 PC

    I cannot get Icloud for windows update 4.0.2 to install on my Win 8.1 Pro PC its an AMD 64 bit processor.
    I get a message that saysI cannot get Icloud for windows update 4.0.2 to install on my Win 8.1 Pro PC
    I get the update notification and authorize its installation and it try's but fails.
    I have down loaded the update and tried installation manually but it doesn't work.
    I get the following message after it fails:
    Errors occurred while installing the updates.  If the problem persists, choose Tools > Dowmnload only and try installing manually.
    I have tried this many times to no avail

    I have been getting the same message for a few days now. Apple must have an a bug in this update

  • Slmodem/wvdial: cannot get information for serial port

    Hi,
    I have the following problem when trying to set up my Intel WinModem with arch:
    After configuring wvdial I get an error when trying to launch it
    /dev/ttySL0: Cannot get information for serial port
    Does anybody know about this problem? There is absolutely no information about it on the internet.
    Thanks for any help!!!!!

    Hi,
    I have the following problem when trying to set up my Intel WinModem with arch:
    After configuring wvdial I get an error when trying to launch it
    /dev/ttySL0: Cannot get information for serial port
    Does anybody know about this problem? There is absolutely no information about it on the internet.
    Thanks for any help!!!!!

  • I want to change my Apple ID for IPad because forgot password and all email addresses changed so cannot get informations for password reset. What can I do?

    I want to change my Apple ID for IPad because forgot password and all email addresses changed so cannot get informations for password reset. What can I do?

    I was wondering if you ever figured this out. I have the same issue. When I try to use the support communities, there are so many with the same problems and never seem to be any replys?? Not very helpful and I can not get Apple to return my emails.

  • Cannot get workspace for compartment

    Hi
    I'd created a track in CE EHP2.
    While creating any of the project from NWDS, i'm getting erorr
    Cannot get workspace for compartment abc_DEMOCE2_1
    Exception getting workspace by URL:Internal problem. See trace for details
      The exception was caught in the attached stack.
      com.sap.ide.dii05.util.api.log.Stacktrace
         at com.sap.ide.dii05.util.api.log.LogManager.internalCreateCaughtStatus(LogManager.java:326)
         at com.sap.ide.dii05.util.api.log.LogManager.createCaughtStatus(LogManager.java:297)
         at com.sap.ide.dii05.lib.internal.util.DtrLegacyUtil$1.doInWorkerThread(DtrLegacyUtil.java:146)
         at com.sap.ide.dii05.util.api.job.JdiJob$1.doInWorkerThread(JdiJob.java:77)
         at com.sap.ide.dii05.util.internal.job.InternalJdiJob$3.run(InternalJdiJob.java:215)
         at com.sap.ide.dii05.util.internal.job.BusyBackgroundIndicator.showWhile(BusyBackgroundIndicator.java:74)
         at com.sap.ide.dii05.util.internal.job.InternalJdiJob.internalRun(InternalJdiJob.java:189)
         at com.sap.ide.dii05.util.internal.job.InternalDiiJob.runInternal(InternalDiiJob.java:306)
         at com.sap.ide.dii05.util.internal.job.InternalDiiJob.runR(InternalDiiJob.java:204)
         at com.sap.ide.dii05.util.internal.job.InternalDiiJob.run(InternalDiiJob.java:192)
         at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
    Please share some pointers on this.
    Thanks
    Puneet

    Hello,
    please take care about the description letters of the track. If you use special character you cannot import the track in nwds. (i.e. no "ü", "ä" ...)
    Cheers

  • Problem with method just cannot get it to work

    hi. i got a problem in this part of my program. i am to read in a text file and store it in the arrys before printing it out.but i cannot get the file to be read into the array and to be printed out correctly.
    my text file to be read in is something like this:
    Question0
    what is your name
    a: nick
    b: john
    c: peter
    d: jane
    c
    Question1
    what is your most prefered colour
    a: red
    b: blue
    c: green
    d: yellow
    a
    but when i run the code i have written it keeps printing out like this:(excally what is printed out). the entire order is being messes but with no "questionO" which there should be and the "what is your name question being repeated twice, and the second time without the answer.
    what is your name
    a: nick
    b: john
    c: peter
    d: jane
    c
    what is your name
    a: nick
    b: john
    c: peter
    d: jane
    Question1
    what is your most prefered colour
    a: red
    b: blue
    c: green
    d: yellow
    a
    please can you advice me if in any part of this i have gone wrong, and what should i do to solve the probelm. i really need this help thanks.
    my code is:
    static int questionIndex = 0;
    static int mainMenuOption = 0;
    static String []question = new String[20];
    static String []answer = new String[20];
              do {
                   mainMenu();
                   mainMenuOption = Console.readInt("Enter Choice(1-3) :");
                        if (mainMenuOption==2)
                             takeTestOption();
              } while (mainMenuOption!=3);
              public static void mainMenu() {
                   System.out.println("2.Take Test");
                   System.out.println("3.Quit");
                   System.out.println("");
    public static void takeTestOption(){
                        readInQuestion();               
                   public static void takeTestOption(){
                   //     mainMenu();//prints out the menu options to be entered by the users
                        readInQuestion();
                        //printingOutQuestion();               
                   public static void readInQuestion() {
                        String fileName = "apple.txt";
                        FileIn readInFile = new FileIn(fileName);
                        String readInFileText = readInFile.readString();
                        String finalText= "";
                             if(readInFile.getReadStatus() != readInFile.FILE_NOT_FOUND){
                                   while (readInFile.getReadStatus() != readInFile.EOF ){
                                        while (readInFileText.length() !=2) {
                                            finalText = finalText+readInFileText;
                                            readInFileText = readInFile.readString();
                                       question[questionIndex]=finalText;
                                       if (readInFileText.length()==2) {
                                            answer[questionIndex] = readInFileText;
                                       questionIndex++;
                                       readInFileText = readInFile.readString();
                                        printingOutQuestion();
                   public static void printingOutQuestion() {
                        for (int index=0;index<questionIndex; index++){
                             System.out.println(question[index]);
                             System.out.println(answer[index]);
                   }

    You are using a class that was supplied by the teacher (FileIn). This is a class that none of us knows about. If it is small, it would be useful to post that as well.

  • Cannot get mail for single email account only

    Hi everyone.
    I have three email accounts on my iphone 4s(1 gmail, two hotmail).
    I get the 'Cannot Get Mail - The connection to the sever failed' message when I acess one of my hotmail accounts.
    I do not get this message when I access the gmail and other hotmail accounts. My other accounts push and recieve email normally.
    I noticed this problem since yesterday.
    I have:
    turned my phone on and off
    reset my iphone
    deleted and re-added the hotmail account to my phone
    and nothing has helped.
    Can anyone help me with this issue?
    Thanks

    I've been having the exact same problem with one of my hotmail accounts on my iPhone 4.  Actually my @hotmail email is working, but my @live is not.
    I've tried the solutions you've listed as well with no resolve.
    This happened suddenly after a year of working just fine.
    Anybody have some ideas?  Since the other emails are working would it be logical that it's with the email server and not the phone?
    Thanks!

  • Cannot Get Mail for more than 5 accounts at a time

    I have a total of 9 POP email accounts setup in Mail. The problem is that my dedicated server doesn't allow for more than 5 simultaneous send/receives per IP (which unfortunately cannot be changed). When I click on "Get Mail", I see it tries to get mail for all accounts at once, and I need to somehow change that within Mail. Ideally I need it to check accounts individually or, as you can do in Entourage, group it into send/receive schedules with 4 per group.
    I am desperate, someone please help!

    If App Store has an app that can make, e.g., zip archives of multiple photos, then it could help (you package a bunch of photos in a zip file, and then you send only one attachment; the zip file).
    Disclaimer: I don't know the App Store apps nor the iPhone SDK well enough to know if such an app exists or if it is even possible.

  • Cannot get mail for Hotmail

    anyone experiance this??... it works perfectly before... but since the past 2 days... i always receive the error "Cannot get mail"....
    and this only happen to my Hotmail accoutns... the rest of my mail works perfectly...
    ive deleted my Hotmail.. and add it back, still having the same problem....
    it kinda frustrating.....
    i have turn off airplane mode on and off... i have reset network setting.... still no use...
    anyone experiance this???...

    hey!!.. thanks man for the info....
    i thought my Iphone got problem.. .now i know its Hotmail error..

  • Have deleted firefix and then tried to looad a clean version but it reloads the older header with two google searcxhes etc that I just cannot get rid of. How do I create a new clean version please/

    I had two tool bars with google search in the header part . Cannot delete them even if I delete firefox and relaod. Am not sure where any other details I have could be stored that I haven't found. I now assume it is on the firefox web site. I just want to download a clean (new) copy of firefox and none of the stuff I had as add ons in the one I have just deleted (twice because it will not disappear so there are files somewhere I can't find. Please tell me how to get a clean version with no old stuff from previous load.

    You can uninstall the relevant extensions from Tools>Addons to remove those toolbars. Also there may be some unwanted plugins which you may want to disable. This should solve your problems.
    If you still want a clean profile, uninstall firefox with the "Remove my Firefox personal data and customizations" checkbox enabled. Alternatively you may remove your firefox profile folder which (on Window7) is stored in C:\Users\<your-username>\AppData\Roaming\Mozilla\Firefox\Profiles folder with a randomly name. You may delete this folder before installing a new version to get a clean profile.

  • Just cannot get a good connection speed....

    Hi all,
    We changed our ISP from a steady 2MB connection with TalkTalk to a potential 8MB connection with BT about 2 and half weeks ago.
    The TalkTalk connection was sound.....It was stable and reliable and we never had any problems when accessing the internet, downloading files and using games consoles for online play.
    Then we got BT (My dads call, not mine...) and things have just hurtled downhill at a gargantuan rate.
    We were told of a 10 day stabalisation period, which I was willing to ride out, despite a horrible connection speed which made browsing, downloading and playing on my PS3 close to unbearable.
    We have contacted BT by phone numerous times to no avail, and our speed hasnt improved ONCE over the last 2 and half weeks we've had the connection active......I figured the 10 day stabalisation period would have improved gradually over that time, and not just suddenly kick in during the end of the 10 days.
    I've been using the Homehub 2.0, but the previous Router doesnt seem to work either (Netgear), so I;m assuming its the connection itself causing the problems......I'm 95% sure its nothing we can do about it.......I've personally tried everything and had no success whatsoever (tinkering with router settings, trying different routers etc.)
    The router stats are below.....According to a speed tester, our download speed is 0.13 and upload speed is 0.46 (obviously not what it should be!)
    Connection Information
    Line state
    Connected
    Connection time
    0 days, 03:03:18
    Downstream
    287 Kbps
    Upstream
    440 Kbps
    ADSL Settings
    VPI/VCI
    0/38
    Type
    PPPoA
    Modulation
    G.992.5 Annex A
    Latency type
    Interleaved
    Noise margin (Down/Up)
    9.8 dB / 25.7 dB
    Line attenuation (Down/Up)
    38.4 dB / 18.1 dB
    Output power (Down/Up)
    4.2 dBm / 1.3 dBm
    Loss of Framing (Local/Remote)
    0 / 0
    Loss of Signal (Local/Remote)
    0 / 0
    Loss of Power (Local/Remote)
    0 / 0
    FEC Errors (Down/Up)
    9482 / 0
    CRC Errors (Down/Up)
    0 / 0
    HEC Errors (Down/Up)
    7 / 0
    Error Seconds (Local/Remote)
    0 / 0
     Sorry its a bit drawn out, but I tried to be as detailed as possible.
    Thanks in advance.

    Thanks for the help mate, just gave the speed tester another bash and managed to get something back.....As predicted, results werent exactly brilliant....
    FAQ
    Test1 comprises of two tests
    1. Best Effort Test: -provides background information.
    Download Speed
    55 Kbps
    0 Kbps
    250 Kbps
    Max Achievable Speed
     Download speedachieved during the test was - 55 Kbps
     For your connection, the acceptable range of speedsis 100-250 Kbps.
     Additional Information:
     Your DSL Connection Rate :287 Kbps(DOWN-STREAM), 440 Kbps(UP-STREAM)
     IP Profile for your line is - 135 Kbps
    The throughput of Best Efforts (BE) classes achieved during the test is - 2.17:4.67:93.87 (SBE:NBEBE)
    These figures represent the ratio while sententiously passing Sub BE, Normal BE and Priority BE marked traffic.
    The results of this test will vary depending on the way your ISP has decided to use these traffic classes.
    2. Upstream Test: -provides background information.
    Upload Speed
    259 Kbps
    0 Kbps
    440 Kbps
    Max Achievable Speed
    >Upload speed achieved during the test was - 259 Kbps
     Additional Information:
     Upstream Rate IP profile on your line is - 440 Kbps
    This test was not conclusive and further testing is required.This might be useful for your ISP to investigate the fault.

  • Despite trying troubleshooting tips I just cannot get Firefox to connect to Facebook or YouTube at peak times ! The connection times out every time. please help as I am a novice at this.

    For about the last 3 weeks - since I think I updated Firefox, my laptop just will not connect to Facebook or YouTube. A couple of friends who know more about computers than me have tried to clear caches and cookies, and have tried the other trouble shooting tips, but to no avail. My son cannot connect on his I-Pod, and a friend cannot on his mobile either. Yet there does not appear to be a problem with my broadband connection, and it does sometimes connect in the very early morning, albeit slowly. I have 2 very disgruntled children who cannot talk to their friends and I cannot keep in touch with family etc.

    Hi judy. I feel your frustration and anger. I had placed an order with B&N and got billed twice. I called them and i let the rep know i had just checked my acct and saw i've been billed twice. The rep checked and sure enough their records showed i was billed twice.
    Then the rep apologized, which is always cool for a corp to do, and i was told that the money would be credited back to my card within 3 to 5 business days. And sure enough that's what happened.
    Why Verizon can't do the same thing is...

  • Just cannot get sound on iPad. Tried almost everything.

    I have tried everything to get sound on this iPad.
    I've tried the mute and screen lock. Not working
    If I open the lid when an app has been left open, the sound works for a second then nothing again
    Tried sound check
    Please help before this gets thrown out the window

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Check your settings. The iPads have a small switch on the right edge. It can be used as a rotation lock to keep the screen from automatically reorienting itself as you move around, but you need to have the tablet’s settings configured properly. That same switch, right above the volume buttons, can also be set to function instead as a mute button to silence certain types of audio.
    If the switch is set to work as a mute button, you can change its purpose to “screen-rotation lock” by tapping the Settings icon on the home screen. On the Settings screen, tap General on the left side, and on the right side of the screen flick down to “Use Side Switch to.” Tap to select Lock Rotation or Mute to set the button’s function. Even if you set the side switch for your preferred use, you can still mute the Mini or lock the screen. Just double-click the Home button, and when the panel of apps appears along the bottom edge of the screen, flick the row from left to right with your finger. Tap the icon on the far left side of the row to either lock the iPad’s screen or mute the iPad’s alerts, notifications and sound effects. Music, podcasts and video are not muted unless you turn the volume all the way down.
    iPhone: Can't hear through the receiver or speakers
    http://support.apple.com/kb/ts1630
    http://www.atreks.com/app-no-sound-on-ipad-4-%E2%80%93-what-to-do/
     Cheers, Tom

Maybe you are looking for