Dynamically determining the port number of a deployed application

          Hi
          How do I dynamically determine the port number of a deployed web application ?
          I know HttpRequest.RequestURL() returns us the entire URL but I wanted to just
          know the port number .
          Is there any API do that ??
          Thanks
          Kar
          

kar piyush wrote:
          > Hi
          >
          > How do I dynamically determine the port number of a deployed web application ?
          > I know HttpRequest.RequestURL() returns us the entire URL but I wanted to just
          > know the port number .
          >
          > Is there any API do that ??
          >
          kar,
          Here's what I do under WL 7 SP2:
          import javax.management.AttributeNotFoundException;
          import javax.management.DynamicMBean;
          import javax.management.MBeanException;
          import javax.management.ReflectionException;
          import javax.naming.Context;
          import javax.naming.NamingException;
          import weblogic.jndi.Environment;
          import weblogic.management.MBeanHome;
          String domainName,
          serverName,
          serverPort,
          serverUrl;
          // Getting the initial context
          Environment env = new Environment();
          try
          Context ctx = env.getInitialContext();
          if (ctx == null)
          // unable to retrieve a JNDI context
          return;
          // Retrieving the server-specific MBeanHome interface
          MBeanHome home =
          (MBeanHome) ctx.lookup(MBeanHome.LOCAL_JNDI_NAME);
          if (home == null)
          // unable to retrieve the local server MBean
          return;
          // Get the domain & server name
          domainName = home.getDomainName();
          serverName = home.getMBeanServer().getServerName();
          // The server port and address are a little trickier to extract...
          Object mbeanArray[] =
          home.getMBeansByType("ServerConfig").toArray();
          DynamicMBean mbean = (DynamicMBean) mbeanArray[0];
          try
          serverPort =
          Integer.parseInt(
          mbean.getAttribute("ListenPort").toString());
          serverUrl =
          mbean.getAttribute("ListenAddress").toString();
          catch (AttributeNotFoundException thrown)
          // caught a AttributeNotFoundException
          catch (MBeanException thrown)
          // caught a MBeanException
          catch (NullPointerException thrown)
          // caught a NullPointerException
          catch (ReflectionException thrown)
          // caught a ReflectionException
          catch (NamingException thrown)
          log.debug("caught a NamingException", thrown);
          

Similar Messages

  • How do we determine the port

    How do we determine the port number of the HTTP listener that is being used by the Enterprise maneger Database?
    Thanks&Regards:
    M K SINGH

    M K SINGH wrote:
    How do we determine the port number of the HTTP listener that is being used by the Enterprise maneger Database?
    Thanks&Regards:
    M K SINGHHTTP listener or HTTP port used by EM? Anyways, Oracle maintains a file in the $ORACLE_HOME/install called portlist.ini. This contains all the ports used by EM, Isqlplus and so on. You can check from there.
    For example, here are the contents of my file,
    >
    Ultra Search HTTP port number =5620
    Enterprise Manager Console HTTP Port (orcl) = 1158
    Enterprise Manager Agent Port (orcl) = 3938
    >
    Listener port doesn't change when you use EM. Its the same database listener that is used with EM too.
    HTH
    Aman....
    Edited by: Aman.... on Oct 23, 2008 11:34 PM added file contents.

  • Determine tcp port number

    my project requires me to read the data from one TCP port and process the data then transfer it out from another TCPO port. (using PXIe-8115 which have 2 tcp port). problem is i have no idea how to determine the port number of the TCP port.
    in what way i can determine the port number of both port?

    here is an example i found online but i couldn't understand it. the instruction says the server need to be run before client. but the port number seems a little bit random to me but it did manage to get some signal. 
    can i know where the signal come from and how i can determine the correct port number. i know this question mayby sounds basic or even stupid. but i really don't have much knowledge on Labview. any help would be useful. 
    Attachments:
    Client (trial).vi ‏16 KB
    Server (trial).vi ‏11 KB

  • Dynamically determining the number of cols in Select stmt

    Hi,
    I was wondering if it is possible to dynamically determine the number of cols in Select stmt.
    For example:
    If it had:
    Select empno, lname from emp where empno = 32
    then I'd like it to return 2.
    Thanks in advance.
    Sincerely,
    Nikhil Kulkarni

    Hi,
    I was wondering if it is possible to dynamically determine the number of cols in Select stmt.
    For example:
    If it had:
    Select empno, lname from emp where empno = 32
    then I'd like it to return 2.
    Thanks in advance.
    Sincerely,
    Nikhil Kulkarni

  • Is there a way to dynamically determine the number of out parameters for a server side procedure?

    Hi,
    Below is a helper method used for calling a server-side function which loops through the inbound bindVars parameter to populate the function's IN parameters. Is there a way to dynamically determine the IN/OUT parameters based on the procedure name in the stmt parameter? No members of the CallableStatement class seemed promising, but the getParameterMetaData() method in the PreparedStatement class seemed like it could be helpful lead. However, I have not found any detailed descriptions (yet) of how to use it.
    protected Object callStoredFunction(int sqlReturnType, String stmt,
      Object[] bindVars) {
      CallableStatement st = null;
      try {
      // 1. Create a JDBC CallabledStatement 
      st = getDBTransaction().createCallableStatement(
      "begin ? := "+stmt+";end;",0);
      // 2. Register the first bind variable for the return value
      st.registerOutParameter(1, sqlReturnType);
      if (bindVars != null) {
      // 3. Loop over values for the bind variables passed in, if any
      for (int z = 0; z < bindVars.length; z++) {
      // 4. Set the value of user-supplied bind vars in the stmt
      st.setObject(z + 2, bindVars[z]);
      // 5. Set the value of user-supplied bind vars in the stmt
      st.executeUpdate();
      // 6. Return the value of the first bind variable
      return st.getObject(1);
      catch (SQLException e) {
      throw new JboException(e);
      finally {
      if (st != null) {
      try {
      // 7. Close the statement
      st.close();
      catch (SQLException e) {}
    James

    The PreparedStatement.getParameterMetaData() object is exactly what you need for this task.
    Once you have the ParameterMetaData you can ask it how many parameters are present and which mode they are. The parameters are numbered from 1 to n and you can use ParameterMetaData.getParameterMode(1); to get the mode of the 1st parameter. The modes are defined as static values in the ParameterMetaData object. Check out the doc at http://docs.oracle.com/javase/7/docs/api/java/sql/ParameterMetaData.html
    Timo

  • How to change the port number for deployment in JAVA Studio Enterprise 8?

    Hi!
    Yesterday i downloaded this new sun java studio enterprise and found it mind blowing.
    Now i find that all my previous applications which were running on port 8080 can't be run on sun java studio enterprise(sjse) 8.
    Can anyone tell me how to change the port number on this software so i won't have to edit all my applications?

    http://docs.sun.com/source/819-0080/install.html
    In the Admin Configuration page (or at the command line), enter the following:
    Admin User Name�Name of the user who administers the server
    Password�Admin user�s password to access the Admin Server (8-character minimum)
    Admin Port�Administration port number for initial server instance
    HTTP Port�Port number to access the default server instance
    HTTPS Port�Secure port number to access the default server instance

  • Identifying the port number where Tomcat is running.

    I want to mail the URL of the my application dynamically with the system generated mails. With the help of java.net package I am able to get the IP address of the system, but I have hard coded the port no in the URL. I want to make the port no. also dynamic (E.g. IP address is not hard coded).
    The servlet is deployed to the Tomcat server. What code I write to know the port on which the tomcat is running ?
    thanks in advance,
    Mukesh.

    You could use ServletRequest.getServerPort() to find out the port number on which the request is being sent by the client but I don't know if this will help you.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    EDIT: ServletRequest.getLocaPort() gives the port at which the request is received; I'm not quite sure what the difference is ( I can guess but I'm not certain ) and I don't know which, if either, will be of use to you.
    Edited by: nogoodatcoding on Oct 9, 2007 7:26 PM

  • How can I determine the device number from the task ID

    I'm using 'Port Config' to initialize my DIO port for a NI-DAQ 6052E. Port Config returns a task id and it would be very useful if I could determine what device number I have based on the task id.

    Hello,
    Thank you for contacting National Instruments.
    It is not possible to determine the device number programmatically from the task id. This would be slightly redundant since you must supply a device number when you Port Config executes. You could simply create a local variable of the Device Number control that is connected to the Port Config.vi if you need to use the device number elsewhere in your VI. Simply right-click on the Device number control and select Create >> Local Variable. Then right click on the local variable and select change to read. This will allow you to read the value of the device number you provided anywhere in your VI.
    If you would rather determine the actual device that is being used rather than the device number, yo
    u can use the Get DAQ Device Info.vi. I have attached a simple example program that demonstrates how to use the VI.
    Regards,
    Bill B
    Applications Engineer
    National Instruments
    Attachments:
    Write_to_1_Dig_Port_(E).vi ‏58 KB

  • Determine the serial number on GBIC

    Im trying to determine the serial number of Gbics already installed and running on a Catalyst 2950 switch. Is there a specific command to do so? There is a command on Catalyst 4506 that gives all info regarding the Gbic ("show idprom interface gi 1/1")
    Is there something equivalent for 2950?
    Thank you in advance!
    Nikolas

    You may try to snmp poll the entity mib table.
    This will give you the name of the physical components:
    1.3.6.1.2.1.47.1.1.1.1.7
    This will give you the serial number for the components:
    1.3.6.1.2.1.47.1.1.1.1.11
    Here is an example that shows the component:
    .1.3.6.1.2.1.47.1.1.1.1.7.1235 entityMIB.entityMIBObjects.entityPhysical.entPhysicalTable.entPhysicalEntry.entPhysicalName.1235 OCTET STRING Transceiver Gi1/8 "Transceiver Gi1/8"
    Here is a poll that references the index number of 1235 (Transceiver Gi1/8) and therefore the GBIC in port Gi1/8:.1.3.6.1.2.1.47.1.1.1.1.11.1235 entityMIB.entityMIBObjects.entityPhysical.entPhysicalTable.entPhysicalEntry.entPhysicalSerialNum.1235 OCTET STRING FGS16450R4R      "FGS16450R4R     "

  • Best method to determine the week number of a month - SQL Server 2012

    Hi,
    I'm searching the most valid and tested method to determine the week number respect to a month.
    Fe, the 1st January falls in the 1st week of January, the 1st February fall in the 1st week of February, and so on.
    I've found many solutions but I'd like to know possibly the best one.
    Thanks

    Hi Uri,
    SELECT DATEPART(week, '20150104')
         - DATEPART(week, CONVERT(CHAR(6), '20150104', 112)+'01')
         + 1
    returns 2 and not 1. It's a Sunday.
    Waiting to be spoonfed, eh?
    The one-off in my query would be very simple to figure out - I forgot to add the +1. Is too much to expect from you that you could figure it out yourself?
    And likewise, in my post I said that you should use "week" for weeks starting on Sunday, and "iso_week" if your week starts on Monday. Uri neglected to observe this, but you had the information to correct it. If you had been interested
    in doing some work yourself, that is.
    Nevertheless, there is an issue that I overlooked:
    DECLARE @day date = '20160105'
    SELECT datepart(iso_week, @day) -
           datepart(iso_week, convert(char(6), @day, 112) + '01') + 1
    This returns -51. This is because with ISO week numbering, Jan 1st falls into week 53 of the previous year, if it's on a Friday or later. Week 1 is always the week of Jan 4th. When you week this does not happen, as week 1 is always the week with Jan
    1st. (Dec 31st is always in week 53 or 54.)
    To correct for this, we need this query:
    SELECT DATEPART(iso_week, @day) -
           CASE WHEN DATEPART(iso_week, CONVERT(CHAR(6), @day, 112) + '01') < 50
                THEN DATEPART(iso_week, CONVERT(CHAR(6), @day, 112) + '01')
                ELSE 1
           END + 1
    Erland Sommarskog, SQL Server MVP, [email protected]

  • IPCC 7 Determine the week number of a month

    Hello,
    I am working towards determine the week number of month and make appropriate routing changes only for that specific week. I have tried using the trunc(), getdate() and weekday(). But i fail to get the week number of a month, but I believe I have managed to the week number of a year.
    The example I have considered is: On Tuesday and Thursdays in second week of every month the calls to be routed to a different skillgroup.
    Please let me know if anyone has any suggestion for this.
    Thanks,
    FYI,
    CM 4.1, CRS 3.5, ICM 7.1

    Hi buddy,
    Great stuff!! Your link gave me another hint of the possible solution, I was working on ICM but not sure why i did not consider CRS for this requirement , The CRS has a builtin function, I have used this builtin Methods which provided me what i expected.
    The debug on the script resulted the week of the month for today which is "4".
    Please let me know your view.
    Thanks again!

  • How to hide the PORT NUMBER from the URL

    Hi,
    We have Application on Node 1 and Database on Node 2
    Apps Version: 11.5.10.2
    DB: 9.2.0.6
    We recently added a new node to act as web server for iSupport.
    Now we are able to access the url using public Ip-address which looks like
    http://<Internet Ip-Address>:<PORT NUMBER>
    Eg: http://******.com:8000
    But we dont want the *'PORT NUMBER(8000)'* to be displayed.
    How to hide the port number ?..
    Thanks in Advance,
    Mahesh

    Hi Hsawwan,
    Can you plz explain me the steps how to hide the port number from the url as our network administrator is not aware of this.
    Regards,
    Mahesh

  • Hiding the port number from the url

    Hi All,
    In our applications built using Weblogic Portal 10.3, the url to access the application doesnt have the port number. It is simply like http://<server-name>/<context> no port at all. Is this some configuration that is available inside weblogic adminstration console? The domain has both the default port and the SSL port enabled which are running in 7001 and 7002 respectively. Please let me know as how to do this configuration as I am growing haywired on this it has been about a week and have not found an answer yet. Please throw some light on this and let me know if you need further details
    Thanks
    Ashwin

    you should install apache server to handle all the requests on port 80 and froward it to weblogic server using wlp plugin
    please check this link
    http://download.oracle.com/docs/cd/E13222_01/wls/docs81/plugins/apache.html
    any request http://yourapp/context will be mapped to http://youapp:7001/context

  • Determine the fax number or EMAIL address for pur docs

    Hi,
    I am trying to send pur doc via fax or EMAIL.
    I have created specific  message types for that purpose.
    The fax is created and sent to the default fax number / EMAIL address.
    I want the message to be sent to the same vendor but to other fax number or EMAIL address.
    I do not want to create a spereate partner for that purpose. I want to add fax number or EMAIL number to the address detail of the vendor and I want to mark it as the fax number for the pur docs.
    In the UE/BADI I want to be able to determine the fax number / EMAIL address.
    Does any one know any BADI/UE enabeling me doing so?
    Best regards
    Shlomo Assouline

    Dear Ramesh,
    This is a known issue. What I am looking for is the place in which I can decide which one of the EMAIL/FAX that exists in the vendor master data to use.
    As you probably know A vendor can have more than one EMAIL/FAX but only one of them is signed as the default one. The EMAIL/FAX used as standard is the standard one.
    Best regards
    Shlomo Assouline

  • I am trying to set up my outlook 2007 account on i pad and the process sticks on verifying.  It would appear to be a problem with outgoing server and I have changed the port number but with no success.

    I have just purchased an i pad 2 and am having trouble with the e-mail set up.  Set up with wi-fi, i-cloud etc has worked fine but the i pad is recognising my outlook 2007 account details but is not verifying it.  The trouble appears to be with the outgoing server and I have tried changing the port number, but to no avail!  Also reset the account settings for holding messages on the server...help!  As you can tell I'm not very techy and I'm desperate to get the bloody thing working as I'm going away on Tuesday! Any suggestions?

    I had a similar issue and it was password case sensitive issue

Maybe you are looking for

  • Urgent Plz reply: java.lang.Class not found exception

    Hi All, I am novice to j2me, I am tryiing communicate data between client and Java server. I have given project name client and midlet class name FileViewer.java. It is compiling succesfully but when I run it , it is giving error Unable to create Mid

  • Worked fine with Tiger, don't work on Leopard

    My Epson AL-C1100 worked fine wirelessly with Tiger, but cannot print since I upgraded to 10.5.2 Have read so many threads here, still cannot find a resolution. Can anyone help?

  • I get a warning when upgrading SP 14 to SP 15

    I get a warning when I deploy the last service pack from SP 14 to SP 15 for the sap.com/SAP_JTECHS <!LOGHEADER[START]/> <!HELP[Manual modification of the header may cause parsing problem!]/> <!LOGGINGVERSION[1.5.3.7185 - 630]/> <!NAME[E:\usr\sap\DEP\

  • Having more than one Unit of Entry (Batch specific UOM)

    Hello All     I am using Batch specific UOM (Product Qty Conversion), am working with SQM & NOS as batch specific UOM & the Base UOM of matereial is KG.     My requirement is that at the time of GR for the material I need both batch specific UOMs viz

  • How to close safari, mail, apps, etc.

    The 3G iPhone is my first smartphone and am loving it, but today for the first time there is a 3-5 second lag while typing out texts, email, etc. Could this be to too many applications open at once? i.e. how do you close safari, mail, etc besides jus