How to get the server port and id from the Initialcontext

hi
i know that i can get the server port and id where the jndi service is listening from the InitialContext ( when i create InitialContext ic = new InitialContext(); from within a EJB. ). Does this work on any application server and where (at what position is for example the port) in the Enumeration at the ic are the different things put?

I would usually just get the PROVIDER_URL property from the InitialContext and use that to determine the location of the naming service:
String providerURL = (String)ic.getEnvironment().get(Context.PROVIDER_URL);You'll then need to parse that string to obtain the port and the server name. For example:
// Assume that the provider URL is of form "protocol://server:port"
int serverStartIndex = providerURL.indexOf("://" + 3);
int serverEndIndex = providerURL.indexOf(:, serverStartIndex);
String server = providerURL.substring(serverStartIndex, serverEndIndex);
String port = providerURL.substring(serverEndIndex + 1);It's a fairly universal approach but there'll doubtlessly be some special cases (for example, the provider URL could be null and the InitialContextFactory class defaults it).
You might have to adjust the server/port parsing stuff a bit as I just made that up and your URL might not conform to the pattern I described.
Hope this helps.

Similar Messages

  • How to resolve "The server is unavailable and could not be accessed. The server is probably disconnected from the network." error in Sharepoint serach crawl.

    Hi all,
    I have created a content source in Search service application for a particular site collection "http://spwebapp/sites".
    I performed reset crawl index of Search service application and then performed a full crawl.
    But i get errors on running crawl on this content source for most of the files. The error is "The server is unavailable and could not be accessed. The server is probably disconnected from the network." Though the site is accessible.
    But before performing reset index the crawl was working fine on this content source. Crawl is working fine for other site collections. Only one site collection is facing this problem. Please let me know if what I can do to resolve this error.
    Thanks in advance.

    Are you seeing any error messages in the URL related to the Gatherer?  And in your content source, are there any site URLs that are no longer active or do you have any crawl rules set up that might be affecting access to the site collection?
    I've seen this happen for a variety of reason, SSL issues, proxy issues, permissions issues.  The Eventvwr and ULS logs should help you narrow down the real problem.
    Sometimes this is an issue because the indexer and the site are sitting on the same box, you could try doing a disable loopback check to see if that resolves the issue and if it does then go through the hassle of setting up a specific LSA :
    http://iedaddy.com/2009/04/sharepointdisable-loopback-check/
    ieDaddy
    Blog: http://iedaddy.com
    Twit: @iedaddy

  • I have a new lion server and 4 lion laptops. The laptops loose connection to the shared documents and printers from the server after roughly 1 hour. By disconnecting and re-connecting wireless the connection is regained to shares and printers

    I have a new lion server and 4 lion laptops. The laptops loose connection to the shared documents and printers from the server after roughly 1 hour. By disconnecting and re-connecting wireless the connection is regained to shares and printers. We can still surf the web when it goes down.

    Ok 1st one. The warning restriction message relates to this line in main.cf:
    smtpd_helo_restrictions = permit_sasl_authenticated  permit_mynetworks  check_helo_access hash:/etc/postfix/helo_access  reject_non_fqdn_hostname  reject_invalid_hostname  permit reject_invalid_helo_hostname
    The last reject occurs after the single word "permit" and is ignored.
    However, that's not the problem.
    I'm not exactly sure what's happening, but this might be a clue.
    It would appear that either postfix is not being able to create the socket for private/policy or it's somehow created with the wrong permissions.  You might need to ramp up the debug level to get a better idea.
    You could check if it's being created by "netstat -a | grep private/policy" in terminal.
    My guess is that it's not being created because there is no setup statement in your master.cf file, but I don't understand why postfix would be looking for it if it isn't set up.  Private/policy I think relates to grey listing.  Maybe gives you a hint.

  • HT4859 i broke my iphone and got a new one. My iCloud backup has a backup from the old phone and one from the new phone. The new phone didnt download everything from icloud. Is there a way to download the stuff i didnt get back?

    i broke my iphone and got a new one. My iCloud backup has a backup from the old phone and one from the new phone. The new phone didnt download everything from the original icloud backup. Is there a way to download the stuff i didnt get back? please help

    You'll have to do another restore from the old phone backup.  But before doing that, tell us what was not restored.  For example is it just photos that didn't get restored?  If so, that seems to be a common problem for many users, judging by the posts left in the forum.  There doesn't seem to be a solution to that problem (other then to tell users to ALWAYS sync photos to a computer and never trust an iCloud backup/restore to save photos.

  • My iPhone 4s won't switch off. I have cleaned the power port and restored from back up. Any ideas?

    My iPhone 4s won't switch off. I have cleaned the power port and restored from back up. Any ideas?
    Many thanks

    You say iPhone 4s but list an iPhone 3GS
    Try to reset:
    Hold the Sleep/Wake & home buttons until the screen goes dark & the Apple logo appears
    To power off:
    Hold the Sleep\Wake button until you see slide to power off then slide to power off

  • I have purchased the app geowalk and garaband from the ipad itself and found it was very slow to get it installed. Then I used a pc (not mac) to download the app and found that I cant install to the ipad. It said error... anybody can help?

    Help! I have purchased the app geowalk and garaband from the ipad itself but found the files were too big and the process is too slow. I later use non mac pc to install the 2 apps but I couldnt tranfer to the ipad. It always said error. anyone can help?
    Thanks

    WHat does the error say?  Is there an error code?

  • How to get FMS server time and date

    hi,
    i m working on a customer support chat application. There is
    neccssary for me to get the FMS server time and date, bcoz
    depending on the server time and date the client instances recive
    different messages.
    i looked at date() function on FMS server, but it returns
    user PC time ( not FMS server time).......
    so i there any way to get FMS server date and time??
    thanks in advance
    shrikant

    See this post.
    How To Display Time Information in Report/Results?
    http://forums.ni.com/t5/NI-TestStand/During-a-test-how-can-I-find-the-start-time-and-date-of-that/td...
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • How to get report Server Name and Environment ID in Report

    How to print report Server Name and Environment ID in Report 10G.(Through in package or others)
    I'm also using Oracle Application Server 10G.

    Hi,
    Server and envid are the parameters passed along with Reports URL call.
    These variables value can be traped in Report by defining SERVER , ENVID named user parameters.
    Once trapped, can be printed on Report.
    Just ensure that these users parameters are not exposed to Parameter page, otherwise user may end up changing it.
    Thanks

  • I Need Use the USB port and CDROM from iManager

    Originally Posted by AndersG
    Crsven,
    > Now, I need access through of imanager the CD-ROM or the USB (Pen
    > Drive) and I don't see, I don't access, pls, how I can see they.
    Not sure what you want? What do you want to do with CD/USB in iMAnager?
    - Anders Gustafsson (Sysop)
    The Aaland Islands (N60 E20)
    Discover the new Novell forums at http://forums.novell.com
    Novell does not monitor these forums officially.
    Enhancement requests for all Novell products may be made at
    Enhancement Request
    Ok. I need install the license that I have in the Pen drive, but the iManager only see the unit's A, C and SYS. Not see the CD-ROM. I search with the file manager the USB port with by my pendrive or the CDrom and don't found. I don't have floppy for install and I think that no is necesary install a floppy (is obsolete).
    Thanks
    Saludos(Regards)
    Rafael Sarramera

    190.36.1.1 is probably the WAN address of your firewall which will then be NAT to your server
    So currently from outside your network, if you browse 190.36.1.1:8008 you would then reach your remote management screen.
    This is therefore not the correct IP address, you need the internal LAN address of the server to enter into your workstation NW Client box
    Splash
    >>> crsven<[email protected]> 08/03/2008 17:46 >>>
    AndersG;1484107 Wrote: > Crsven,
    > > Ok. Pls. Could you help me to config or where I can read that
    > > information. I treated of connect and I can't connect to server with
    > > IP.
    > >
    > Assuming a local workstation? Make sure you have an IP address bound> on
    > the server. I also assume that you have a Windows workstation with the
    > NW client installed. When you get the login window, leave tree blank,
    > enter the server ip in the server field and provide username and
    > password. If you get that to work, then we can take it from there.
    >
    > - Anders Gustafsson (Sysop)
    > The Aaland Islands (N60 E20)
    >
    > Discover the new Novell forums at http://forums.novell.com
    >
    > Novell does not monitor these forums officially.
    > Enhancement requests for all Novell products may be made at
    > 'Enhancement Request' (http://support.novell.com/enhancement)
    You assume good, but I leave Tree blank, the context blank and in fieldserver I use the address Ip 190.36.1.1, that is the ip addressconfigured for the conection with the remote manager of Novell(190.36.1.1:8008).
    I think that the config that I need is in the server.
    Thanks-- Saludos(Regards)
    Rafael Sarramera------------------------------------------------------------------------crsven's Profile: http://forums.novell.com/member.php?userid=7705View this thread: http://forums.novell.com/showthread.php?t=314402

  • How to get status of a sub process from the parent process.

    Hi,
    I want to get the status of a subprocess from the parent process (i.e. success or failure).
    How can I get this.
    Thanks in advance.
    Bye

    have a look at the workflow built-in vars:
    WF_ACTION_ERROR and WF_ACTION_RESULT or WF_CASE_RESULT
    WilfredS

  • Possible to get the color space and resolution from the .eps file

    Hi all,
    We have using the InDesign CS3 5.0.4, windows, javascript.  We need to get the color space and resolution of the graphics (.eps) file using scripting.
    The properties of the image like (actualPpi and effectivePpi will return the value only for the .tiff. and .jpg etc) but it will not return the .eps file resolution values.
    Kindly give me the suggesting for the decrepancies.
    Regards,
    Nagaraj

    ... open them programmatically in PhotoShop, read out resolution and color space ...
    On opening them in Photoshop, it asks you "what resolution shall I use, and what color space shall I apply?"
    A single EPS may contain any number of embedded bitmaps, with any horizontal and vertical resolution, and in any color space. You can use only a few of these with Illustrator -- and even only one at a time with Photoshop --, but other programs allow just about every possible combination.
    Not to mention procedurally generated bitmaps, also possible with PostScript.

  • How to Get Messege Server Port  & Instance Number

    Hi Experts,
    How To Find out the Message server Port ???
    Hoe to Find Out the Instance Number ????
    Please let me Know these things
    Regards
    Khanna

    Hi Raja,
    I got the same problem.You told to run
    FM SLDAG_GET_MESSAGE_SERVER_INFO.But where I have to run this.
    Sampath.G

  • Java - Axis2: How to get an error code / error message from the Javascript via SOAP

    Hi
    In our Java applicsation we call a Javascript in a Indesign CS Server using the following code:
    --- SNIP BEGIN ---
    // calls the remote service on the indesign server
    try {
    // create service
    ServiceStub oIndsgnSrvStub = new
    ServiceStub(sIndesignServer);
    // create service parameter
    ServiceStub.RunScriptParameters
    oIndsgnSrvRSParams = new ServiceStub.RunScriptParameters();
    // create arguments with source- and target-file for parameter
    ServiceStub.IDSPScriptArg[] oIndsgnSrvSArgs = new ServiceStub.IDSPScriptArg[2];
    oIndsgnSrvSArgs[0] = new
    ServiceStub.IDSPScriptArg();
    oIndsgnSrvSArgs[0].setName("xml-input");
    oIndsgnSrvSArgs[0].setValue(sSourceFile);
    oIndsgnSrvSArgs[1] = new
    ServiceStub.IDSPScriptArg();
    oIndsgnSrvSArgs[1].setName("output-file");
    oIndsgnSrvSArgs[1].setValue(sTargetFile);
    // define service parameter
    oIndsgnSrvRSParams.setScriptArgs(oIndsgnSrvSArgs);
    oIndsgnSrvRSParams.setScriptFile(sScriptFile);
    oIndsgnSrvRSParams.setScriptLanguage("javascript");
    oIndsgnSrvRSParams.setScriptText("");
    // create runscript
    ServiceStub.RunScript oIndsgnSrvRS = new ServiceStub.RunScript();
    // set parameter
    oIndsgnSrvRS.setRunScriptParameters(oIndsgnSrvRSParams);
    //$$$ there should be an answer returned by the InddSrvr
    // execute SOAP call
    ServiceStub.RunScriptResult oIndsgnSrvRes = oIndsgnSrvStub.RunScript(oIndsgnSrvRS);
    if(oIndsgnSrvRes.getErrorNumber() == 0) {
    oServerProdJob.setProdState(CBP_Constant.REMOTEPRODUCTIONSTATE_SUCCESS);
    bOK = true;
    } else {
    oServerProdJob.setProdState(CBP_Constant.REMOTEPRODUCTIONSTATE_FAILURE);
    bOK = false;
    //$$$ should be set, if there is something returned by inddsrvr
    //oServerProdJob.setErrorMsg(sErrorMsg);
    } catch(Exception e) {
    sError += e.getMessage() + "\n";
    bOK = false;
    --- SNIP END -----
    The problem is that we don't get the error code and/or the error message from the Javascript in oIndsgnSrvRes. The error code is always 0 if I set an Integer value as return in the Javascript. If I set a String, there is an Exception in the Java application.
    Here is the Java script we use:
    --- SNIP BEGIN ---
    main();
    main()
    var sError = "";
    var sXMLInput = "";
    var sLayoutPath = "";
    // get the SDKCodeSnippetRunner object
    var cbpAdapter = app.cbpCbpadapterObject
    if (cbpAdapter) {
    sXMLInput=app.scriptArgs.get("xml-input");
    sLayoutOutputFile=app.scriptArgs.get("output-file");
    sError = cbpAdapter.doProcess(sXMLInput, sLayoutOutputFile);
    return sError; // This give an Exception; if I return an Integer the ScriptResult is always 0
    --- SNIP END -----
    If I try this with the test application from Adobe I get the error code correctly. But in the Java application, using SOAP, I can't get the error code.
    What could be wrong?
    Any ideas?
    Thanks a lot for the support.
    Kind regards
    Hans

    user11340104 wrote:
    Hello -
    i am calling sqlplus from a bash shell script. If the sql statement generates an error, how can I return that error code (unsuccessful) back to the bash shell?
    Well, let google be your friend,
    http://www.google.co.in/search?rlz=1C1GGLS_enIN327IN327&sourceid=chrome&ie=UTF-8&q=sqlplus+error+codes
    There are many threads I guess talking about the same issue.
    HTH
    Aman....

  • How to get cumulative decreasing values by substracting from the previous row.... in a dynamic added

    I have pdf table like this:-
    Header 1
    Header 2
    Header 3
    Header 4
    Header 5
    Header 6
    Header 7
    From
    To
    No. of Days
    Balance
    Date
    1
    2
    <ADD Button> / <Del Button>
    3
    4
    5
    This
    Row
    is
    730
    to
    be
    hidden
    DateFieldFrom
    DateFieldTo
    DateFieldTo-DateFieldFrom(Some No1.)
    Remaining1=uppervalue(730)-Some No1.
    Now when i click the <add  rows button>  rows are to be added and i have to get the valuesof Remaining2(Remaining1- Some No.2 )in the Added Balance Row
    how will i do this?

    Hi Luis,
    According to your description, you have a report with different dynamic columns. Now what you want is show your user percentage growth in your matrix report after your user select two of those columns (I think you may use parameter to achieve your “checkbox”
    function). Is my understanding correct?
    In Reporting Service, we can’t calculate dynamic columns with our build-in arrogation functions. So we need to add custom code into our report, and call those functions which defined in custom code in our expression. We have tested your scenario in our local
    environment. Here are steps and screenshots for your reference.
    Go to your Report Properties, add the custom code below into your report:
    Dim Shared Num1 As Double
    Dim shared Num2 As Double
    Public Function GetCalification(Calification as Double,Type as String,Type2 as String) 
    If Type = Type2 Then
       Num1=Calification
    Else
       Num2=Calification
    End If 
    Return Calification 
    End Function
    Public Function GetPec()
    Return (Num2-Num1)/Num1
    End function
    Create a matrix. Put PilarName into Row field, put Period into Column field. In Data field, put the expression below into the textbox:
    =Code.GetCalification(Fields!Calification.Value,Fields!Period.Value,Parameters!Period.Value(0))
    In our sample report, we created a parameter (named Period) for selecting two columns. You can replace “Parameters!Period.Value(0)” with your own parameter.
    Add an outside column at right (%Growth), put the expression below into the textbox:
    =Code.GetPec()
    Save and preview. The matrix and result looks like below:
    Reference:
    Custom Code and Assembly References in Expressions in Report Designer (SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • HT201250 how do I restore my pictures and music from the back up external drive.  My machine has been serviced by apple and now I can't figure out how to reload the music and pictures.

    looking for idiot proof directions on how to restore my pictures and music to my iMAC.  It was services and the hard drive cleared of my files.  I've reinstalled office 2011 and am now trying to ficture out how to get the pictures and music back.  I backed up the machine prior to the service call, but don't seem to know how to restore the pictures and music.

    It all depends on how you made the backup and with what application.  How was the backup created?

Maybe you are looking for