Whats the best way to get the server name in a servlet deployed to a cluster?

          Hi,
          I have a servlet in a web application that is deployed to a cluster, just
          wondering what is the best way to get the name of the node that the server is
          running on at run time??
          Thanks
          

          Please try to modify the following code and test for your purpose: (check Weblogic
          class document for detail)
          import javax.naming.*;
          import weblogic.jndi.*;
          import weblogic.management.*;
          import weblogic.management.configuration.*;
          import weblogic.management.runtime.*;
          MBeanHome home = null;
               try{
                    //The Environment class represents the properties used to create
                         //an initial Context. DEfault constructor constructs an Environment
                         //with default properties, that is, with a WebLogic initial context.
                         //If unset, the properties for principal and credentials default to
                         //guest/guest, and the provider URL defaults to "t3://localhost:7001".
                         Environment env = new Environment();
                         //Sets the Context.PROVIDER_URL property value to the value of
                         //the argument url.
                         if(admin_url!=null){
                              env.setProviderUrl(admin_url);
                              //Sets the Context.SECURITY_PRINCIPAL property to the value of
                              //the argument principal.
                              env.setSecurityPrincipal(username);
                              //Sets the value of the Context.SECURITY_CREDENTIAL property to
                              //the value of the argument cedentials
                              env.setSecurityCredentials(password);
                              //Returns an initial context based on the properties in an Environment.
                              ctx = env.getInitialContext();
                         }else ctx = new InitialContext();
                         home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
                         ctx.close(); //free resource
                         // or if looking up a specific MBeanHome
                         //home = (MBeanHome) ctx.lookup(MBeanHome.JNDI_NAME + "." + serverName);
                         DomainMBean dmb = home.getActiveDomain(); //Get Active Domain
                         ServerMBean[] sbeans = dmb.getServers(); //Get all servers
                         if(sbeans!=null){
                              for(int s1=0; s1<sbeans.length; s1++){
                                   String privip = sbeans[s1].getListenAddress();
                              sbeans[s1].getName();
                         sbeans[s1].getListenPort();
                                             WebServerMBean wmb = sbeans[s1].getWebServer();
               }catch(Exception ex){
          "Gao Jun" <[email protected]> wrote:
          >Is there any sample code? Thanks
          >
          >Best Regards,
          >Jun Gao
          >
          >"Xiang Rao" <[email protected]> wrote in message
          >news:[email protected]...
          >>
          >> Sure. You can use the Weblogic management APIs to query ServerBean.
          >>
          >>
          >> "Me" <[email protected]> wrote:
          >> >
          >> >Thanks for your reply, i was hoping to find a better way for example
          >> >a class in
          >> >weblogic API.
          >> >
          >> >Thanks
          >> >
          >> >"Xiang Rao" <[email protected]> wrote:
          >> >>
          >> >>Physical: InetAddress.getLocalHost().getHostName()
          >> >>Weblogic: System.getProperty("weblogic.Name");
          >> >>
          >> >>
          >> >>"Me" <[email protected]> wrote:
          >> >>>
          >> >>>Hi,
          >> >>> I have a servlet in a web application that is deployed to a
          >cluster,
          >> >>>just
          >> >>>wondering what is the best way to get the name of the node that
          >the
          >> >>server
          >> >>>is
          >> >>>running on at run time??
          >> >>>
          >> >>>Thanks
          >> >>
          >> >
          >>
          >
          >
          

Similar Messages

  • Iphone 4s coming friday, what is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across.

    What is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across. If I do a restore as I have when previously from one iphone to another it has shown (in settings, usage) the cumulative usage from previous phones so all the hours of calls on all previous iphones will be displayed even though its brand new. Anyone know how I can get my notes (from standard iphone notes app) to my new iphone 4s without restoring from previous iphone 4. Thanks for any help offered.

    First, if you haven't updated to iTunes 10.5, please update now as you will need it for the iPhone 4S and iOS 5.
    Once you're done installing iTunes 10.5, open it. Connect your iPhone to iTunes using the USB cable. Once your iPhone pops up right click on it. For example: an iPhone will appear and it will say "Ryan's iPhone."
    Right click on it and select "Backup" from the dropdown menu. It will start backing up. This should backup your notes.
    Please tell me if you have any problems with backing up.
    Once you backup and get your iPhone 4S, you must follow these steps. If you don't follow these steps, you will not be able to get your notes on your new iPhone 4S.
    Open up iTunes again then right click on your device (iPhone 4S). Once you do you will see a dropdown menu. It will say "Restore from Backup..." Select this and it'll ask for a backup, select it from the dropdown menu. For example "Ryan's iPhone - October 12, 2011." Pick that and it will restore to your backup. Do this when you get your iPhone 4S so you will not lose anything. Even though you're restoring, you're getting back, since you're getting the previous settings, notes, contacts, mail and other settings from your old iPhone. You'll still have Siri though! So, restore when you first get it. Also frequently backup your device, as it will be worth it. You can restore from a backup if something goes wrong or save your data for a future update.
    Once you do that, you should have your notes on your new iPhone 4S and iOS 5.
    Please tell me if you need any help.
    I hoped I answered your questions and solved your problem!

  • What is the best way to get the new iPhone/ iPhone 5

    What is the best way to get the new iPhone/ iPhone 5 when it is released. I want to get the phone as quick as possible. If i order it on The first day of pre orders will i get it on the same day as the release in stores? I'm on an unlimited data plan with AT&amp;T. Because the new iPhone will most likely have 4 g data will I loose the unlimited plan?

    Apple has not made any announcement.  We are not allowed to speculate on this forum.

  • What is the best way to get the end of record from internal table?

    Hi,
    what is the best way to get the latest year and month ?
    the end of record(KD00011001H 1110 2007  11)
    Not KE00012002H, KA00012003H
    any function for MBEWH table ?
    MATNR                 BWKEY      LFGJA LFMON
    ========================================
    KE00012002H        1210             2005  12
    KE00012002H        1210             2006  12
    KA00012003H        1000             2006  12
    KD00011001H        1110             2005  12
    KD00011001H        1110             2006  12
    KD00011001H        1110             2007  05
    KD00011001H        1110             2007  08
    KD00011001H        1110             2007  09
    KD00011001H        1110             2007  10
    KD00011001H        1110             2007  11
    thank you
    dennis
    Edited by: ogawa Dennis on Jan 2, 2008 1:28 AM
    Edited by: ogawa Dennis on Jan 2, 2008 1:33 AM

    Hi dennis,
    you can try this:
    Sort <your internal_table MBEWH> BY lfgja DESCENDING lfmon DESCENDING.
    Thanks
    William Wilstroth

  • What is the best way to get the minimum or maximum value from an Array of numbers?

    Let's say I have an Array of numbers: [2,3,3,4,2,2,5,6,7,2]
    What is the best way to find the minimum or maximum value in
    that Array?
    Right now, to get the maximum, I am looping through the
    Array, and resetting a variable to the value if it is greater than
    the existing value:

    Here's other approaches, the cookbook is your friend:
    http://digitalmedia.oreilly.com/pub/a/oreilly/digitalmedia/helpcenter/actionscript30cookbo ok/chapter5.html?page=7
    enjoy.

  • I want to get good wifi in my house . I currently have a time warner modem/router separate from my phone modem but my upstairs does not get good reception. What would be the best way to get the best wifi if I started from scratch

    I have a combination modem/router from time warner that is separate from my phone line but I get bad reception on my apple tv an ipads upstairs in my house. I would like to fix this and want to know the best way to go about it . Whether getting two modems and routers or just one base station. Please help

    It is possible to extend a WiFI network using Apple's Airport Express, Airport Extreme Base Station, or even a Time Capsule. However  the router that is creating the network (the one you have downstairs) must be configurable to permit another WiFi device to extend the network. All Apple WiFi routers can be configured that way, but there are many third party WiFi routers that cannot. The two routers can be connected wirlessly or by ethernet. From your description I suspect ethernet would be prefereable if yoiu had a good way of routing the cable.

  • What is the best way to get the pixel brightness

    I have a gray-scale .png image. The pixel brightness is used to communicate the information that i need in my application. Note that i do not show this image in my application, the png file is only used to communicate data. Since this data is being collected as an image at the source we are using a png file to pass around this data. The code is given below
    JarEntry entry = m_jarFile.getJarEntry("imageFile.png");
    InputStream stream = m_jarFile.getInputStream(entry);
    BufferedImage image =  ImageIO.read(overlayImageFileStream);
    int cols = overlayImage.getWidth();
    int rows = overlayImage.getHeight();
    short[][] m_pixelBrightnessValues = new short[cols][rows];
    for (int i=0; i<cols; i++) {
         for (int j=0; j<rows; j++) {
              /** BEGIN: Takes too much time */
              int rgb = overlayImage.getRGB(i, j);
              // convert to HSB values.
              int red = (rgb>>16)&0xFF;
              int green = (rgb>>8)&0xFF;
              int blue = rgb&0xFF;
              float[] inputHSB = new float[3];
              inputHSB = Color.RGBtoHSB(red, green, blue, inputHSB);
              /** END: Takes too much time */
              float brightness = inputHSB[2];
              m_pixelBrightnessValues[i][j]= (short)Math.round(brightness * MAX_BRIGHTNESS_VALUE);
    }Some portion of the code above takes too much time. I have been tinkering with the following approaches:
    1). I can parse the png file myself and extract the brightness information thus bypassing the creation of the BufferedImage altogether.
    2). I can continue to create BufferedImage but find out a way to grab brightness directly from the buffered image.
    I prefer option 2, since option 1 will require that I figure out png format and then write custom png parsing logic. I have explored all the methods of BufferedImage and it seems there is no way of getting the HSB directly, the only thing readily availabe is RGB values.
    I would really appreciate any pointers (e.g. is there something in the Raster that can let me access the brightness data directly ?)
    -kashif

    I have a gray-scale .png image. The pixel brightness
    is used to communicate the information that i need in
    my application. Note that i do not show this image in
    my application, the png file is only used to
    communicate data. Since this data is being collected
    as an image at the source we are using a png file to
    pass around this data. The code is given below<snip>
    >
    Some portion of the code above takes too much time. I
    have been tinkering with the following approaches:
    1). I can parse the png file myself and extract the
    brightness information thus bypassing the creation of
    the BufferedImage altogether.
    2). I can continue to create BufferedImage but find
    out a way to grab brightness directly from the
    buffered image.
    I prefer option 2, since option 1 will require that I
    figure out png format and then write custom png
    parsing logic. I have explored all the methods of
    BufferedImage and it seems there is no way of getting
    the HSB directly, the only thing readily availabe is
    RGB values.
    I would really appreciate any pointers (e.g. is there
    something in the Raster that can let me access the
    brightness data directly ?)For a greyscale image, the R G abd B values are all the same, and the brightess is simply that value divided by the maximum value. You could create a brightness map in advance which is simply a 256 element array that maps an RGB value to a brightness:
            short[] brightnessMap = new short[256];
            for (int i = 0; i < 256; i++) {
                brightnessMap[i] = (short)(i/255.0f * MAX_BRIGHTNESS_VALUE);
            }Various experiments I performed using PixelGrabber, Raster and such didn't seem to speed things up more than 25% on a 1280 x 1024 image. Times went from around 400 milliseconds to 300.

  • What is the best way to get the UID of any selected page item (frames, rectangle etc)?

    I need UID of any selected item on page and also array of UID's in case multiple selection happens. How can I achieve it?
    One way I know is to write an observer and attach it on every new page Item created, but that way the system might become slow and also
    the behavior will be unpredictable in case of multiple selections.
    Can some one suggest a better way to do it?

    The selection subsystem hides most ideas of direct adressing (e.g. UID of page item(s) or story) into the concrete selection, while from the outside you only work on the suite interfaces of the abstract selection. So you don't ask whether the selection is some kind of page item and you don't peek at the actual items. Instead you ask about their capabilities and applied values.
    Attaching observers to page items has nothing to do with the selection, because they only notify about changes on those page items - which could also be caused by scripts or anything else. Even then, the most relevant changes go thru the kDocBoss as single point to attach an observer, rather than thru all those page items.
    Regarding speed - the selection has many optimizations, for example "lazy" notifications can be deferred until they become appropriate for an UI update, they might even become aggregated / optimized away.
    One starting point into the selection when you come from nowhere would be ISelectionUtils. Your selection observer might also pass interesting parameters.
    Dirk

  • Recent software upgrade has changed the way my iPhone syncs with my macbook, and diary items no longer upload from my iPhone. I've tried a to fix it and seem to have made things worse. What is the best way to get the two devices in sync ?

    Recent software upgrades has changed the way my iPhone syncs with my macbook and items entered on my iPhone are no longer uploaded to my macbook. I've tried to fix it and seem to have made things worse, my iPhone now has a long list of calanders that I don't want and can't delete and nothing is uploading to my macbook.

    You need to look at Mac's iTunes, check  > System Preferences > iCloud.
    If you use iCloud for Calendar, Contacts then turn off those items in iTunes, Info tab with your iPhone connected and selected.

  • What is the best way to get the delta records using DSS(Data Syncronus Task)?

    This document may be helpful: Incremental Loading with Informatica Cloud. The screenshots are a little out-of-date, but the content should still be useful.

    DSS

  • I want to use ZFS filesystem compression on a history database with read-only tablespaces.  What is the best way to get the datafiles compressed?

    I have 5 history databases that total about 2.2 Terabytes. They use about 15 filesystems, but I can start with 2 that are isolated to only one database.  I have asked for ZFS compression to be set on the filesystems, but since these are read-only tablespaces, I do not think any compression will happen.  Can I simply offline, copy and rename the files from one filesystem to the other to make the compression happen?

    just rsync the files to a compressed Zpool. do this using shadow migration, and you only loose access to the data for a few seconds.
    1) make new dataset with compression
    2) enable shadow migration between the new and old
    3) change the database to use the new location
    4) watch as data is automatically copied and compressed :-)
    the the down side, you need extra space to pull the off.

  • Best way to get the values of local variables

    What is currently the best way to get the values of local variables. I know it is not currently possible to set watchpoints on local variables, but what are the best workarounds?

    You have to use StackFrame methods, eg, visibleVariables and getValues. To get a StackFrame for a thread, that thread has to be suspended, eg, by a BreakpointEvent.

  • What is the best way to mimic the data from production to other server?

    Hi,
    here we user streams and advanced replication to send the data for 90% of tables from production to another production database server. if one goes down can use another one. is there any other best option rather using the streams and replication? we are having lot of problems with streams these days they keep break and get calls.
    I heard about data guard but dont know what is use of it? please advice the best way to replicate the data.
    Thanks a lot.....

    RAC, Data Guard. The first one is active-active, that is, you have two or more nodes accessing the same database on shared storage and you get both HA and load balancing. The second is active-passive (unless you're on 11.2 with Active Standby or Snapshot Standby), that is one database is primary and the other is standby, which you normally cannot query or modify, but to which you can quickly switch in case primary fails. There's also Logical Standby - it's based on Streams and generally looks like what you seem to be using now (sort of.) But it definitely has issues. You can also take a look at GoldenGate or SharePlex.

  • HT1349 I lost/had my iPhone stolen. Tried using Find My iPhone and it's offline. It was set up. What do I do now? Do I report it stolen? What is the best way in getting back my iPhone if any? Thank you in advance.

    Tried using Find My iPhone and it's offline. It (Find my iPhone) was set up. What do I do now? Do I report it stolen? What is the best way in getting back my iPhone if any? Thank you in advance.

    Find My iPhone is good for misplaced iPhone but not good for thief and it was never meant to be.
    You chance of getting it back is very small.
    There are a few things you can try.
    Try remote lock/wipe your iPhone through Find My iPhone.
    https://www.icloud.com
    You can report to the police, cell carrier (expensive cell charges for international calls, roaming etc)
    Change all the passwords used in iPhone: Apple ID, E-mail, Bank Account ....
    http://support.apple.com/kb/HT2526

  • I recently added my old mac hard drive to a new macbook with an SSD as my main OSX drive.  I am having trouble with permissions in viewing my old hard drive.  What is the best way to get complete access to my old hd installed in my new Macbook?

    I recently added my old mac hard drive to a new macbook with an SSD as my main OSX drive. I am having trouble with permissions in viewing my old hard drive, when I save a permission when I reboot the full access is changed again .  What is the best way to get complete access to my old hd installed in my new Macbook?

    Open the Get Info window for the old drive. Click the Lock icon on the bottom of that window and type in your password. In the permissions area click the Plus sign ( + ) and Add your Username to it and set it to Read & Write. Close that window. you should now have full access to all the files.

Maybe you are looking for

  • Mini DVI to VGA does not display

    I have a mini dvi adaptor to a vga cable but when i connect it to the TV the computer nor the TV recognizes that anything is different. When I connect the Mini DVI to HDMI the screen automaticly changes and displays on my TV. Does anyone else have th

  • Approval Procedure Question - changing an Un approved document or Approver

    Here is my situation.  I have set up an approval Stage with 1 approval necessary for Credit Memos. From time ot time,  the approver needs to change the Credit Memo before apporving. Also, from time to time,  the Originator of the Credit Memo needs to

  • Header Text In Tablecontrol

    Hi, I have created a table control in module pool. I have pasted fields from internal table and I have also added text to its header But when I execute the program text is not shown in the header.It is appearing blank

  • Artifacts around letters when uploading to Facebook

    Hi people, I have an issue that has me stumped. I'm uploading a Facebook timeline photo that I've created in Illustrator and exported as a PNG. It looks fine after being exported on my Mac, but It keeps uploading to Facebook with artifacts around the

  • Please guide me How to configure the swift integration packages

    Hi frinds, Please guide me How to configure the swift integration packages, in swift we have to use MT103 format sender side we have ERD system and Receiver side File system, wt adapters  we have to use in sender side and what kind of encrypt and dec