How do I read weblogic properties in my code

Hi,
I want to pick up the port number from my weblogic properties file and
use it to set the context for the EJB's. Are there any weblogic API's
that I can use to do this. I am trying to avoid hardcoding the port
number anywhere in the code.
Appreciate your help.
Ashwin

It is not a "Buggers".
WLAS registered her own properties internally. "weblogic.password" is
regiserted as a hashtable with username as "key", and password as "value".
So does connection pool. "getProperty()" will give your the String
representation of the hashtable.
Cheers - Wei
Dean Jackman <[email protected]> wrote in message
news:[email protected]...
The code that Wei shows is correct, however, I'm experiencing thefollowing
"Funny Buggers":
Am experiencing weird results when I do the following within my clientcode
(as you'll no doubt notice, I'm trying to get my password value for myuser
'jackmand'):
System.out.println(
"weblogic.password '" +
this.getT3ServicesDef().config().getProperty("weblogic.password"));
// the above works fine, it prints out weblogic.password.jackmand=*******,
along with all of the other registered users
System.out.println(
"weblogic.password.jackmand '" +
this.getT3ServicesDef().config().getProperty("weblogic.password.jackmand"));
>
// the above just returns a null, even though the earlierweblogic.password
shows jackmand to exist.
Also note, that this isn't necessarily restricted to password. I've tried
things like weblogic.jdbc.connectionPool in an attempt to get the jdbc URL
of my server. Just doing plain connectionPool shows the name of my server,
whilst if I do a getProperty("weblogic.jdbc.connectionPool.rhubarb") where
rhubard is the name of my connectionPool, I get null? (strewth).
Can anyone shed any light on: why its not working/what I'm doing
wrong/whether I'm able to do this?
Thanks, Dean Jackman
Wei Guan wrote:
T3Services.getT3Services().config().getProperty(<property-name>);
Cheers - Wei
Ashwin Srinivasan <[email protected]> wrote in message
news:[email protected]...
Hi,
I want to pick up the port number from my weblogic properties file and
use it to set the context for the EJB's. Are there any weblogic API's
that I can use to do this. I am trying to avoid hardcoding the port
number anywhere in the code.
Appreciate your help.
Ashwin

Similar Messages

  • How do I read a properties file in WEB-INF without hard-coding a path?

    Hello,
    How do I read a properties file in WEB-INF without hard-coding a path?
    I tried:
    Properties properties = new Properties();
    properties.load(new FileInputStream("db.properties"));
    driver = properties.getProperty("driver");
    but it cannot find the db.properties file.
    Thanks for the help.
    Frank

    Don't use a File to read those properties.
    Better to use the servlet context and
    getResourceAsStream() method to get the InputStream.
    It'll look for any file in the CLASSPATH. If you put
    that properties file in the WEB-INF/classes directory
    you'll have no problems, even if you deploy with a
    WAR file.Completely agree with this approach. Just have to mention the following for completeness
    according to the API,
    "This method is different from java.lang.Class.getResourceAsStream, which uses a class loader. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. "
    So using this method, the resource can be anywhere under your web context, not just in the classpath.
    Cheers,
    evnafets

  • Read weblogic.properties

    Is there a way to read the properties in weblogic.properties from Java code?

    Is there a way to read the properties in weblogic.properties from Java code?

  • How to create read only properties in a component?

    I want to set a property in a nucleus component of global scope as read only, so that it cannot be set via dyn admin. I want this property to be set only via properties file at server startup. I tried removing the setter method as suggessted in the guide. But what happened was the property was not set with the value in the properties file and was set as null. It did appear as read only in dyn admin, but part of my purpose is still not resolved. Any help/info for setting the value from properties file alone and restricting thro dyn admin is appreciable.
    Thanks,
    Gopinath Ramasamy

    You may also try this in your component class by overriding doStartService() which will be called once the component is initialized with property setter has already been called:
    import java.beans.PropertyDescriptor;
    import java.beans.IntrospectionException;
    import atg.core.util.BeanUtils;
    import atg.nucleus.GenericService;
    import atg.nucleus.ServiceException;
    public class MyComponent extends GenericService {
          private String x;
          public String getX() {
              return x;
          public void setX(String value) {
              this.x = value;
           public void doStartService() throws ServiceException {          
              try {
                            //make property named "x" as non-writable
                   PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(this.getClass(), "x");
                   pd.setWriteMethod(null);               
              } catch (IntrospectionException e) {
                   //handle exception
                            logError(e);
                            e.printStackTrace();
    }I think it should make the property "x" rendered as read-only in dyn/admin after it has initialized through properties file.
    Update: I have tried it in an existing ATG 9.4 setup and it was working as expected.
    Edited by: Nitin Khare on Aug 14, 2012 9:01 PM

  • How to make "Read Report" pick up enhancement code as well

    I want to enhance a SAP ECC6 program - H99CWTR0 (Wage type reporter). I need to add some more master data objects from other HR tables.
    I have succesfully applied implicit enhancements to this program to allow my users to select extra data objects and to retrieve the relevant data from the database. However, the program reads a subroutine pool called H99CWTR0_ALV_TEMPLATE and makes dynamic run time changes and generates a temporary subroutine pool. I have also had to apply implicit enhancements to the template but this is not read by H99CWTR0. So I am unable to to keep the shared data segment in line with the driver program H99CWTR0 which leads to an ABAP dump.
    I would prefer to make all changes to SAP programs using the enhancement framework rather than having to clone SAP programs into the "Z" namespace.
    Is there a way of making the "Read report" pick up the implicit enhancement code as well as all the other includes in the template?

    Hi Prabhu
    The dump text said -
    "The length of COMMON PART "DRIVER_DATA_EXCHANGE" in program "%_T0DYT0" is different from the corresponding area in the calling program "H99CWTR0".
    Length of the COMMON PART in program %_T0DYT0: 1224 bytes
    Length of the COMMON PART in program H99CWTR0: 1232 bytes
    There is probably an error in the program "H99CWTR0"."
    My enhancement to H99CWTR0 is being accessed, but the equivalent enhancement to H99CWTR0_ALV_TEMPLATE is not. Hence the discrepancy in the length of common shared data segment.
    The ABAP line "read report iv_template into lt_code." in include H99CWTR0_FORMS is not reading the implicit ehancement code I added. So when the ABAP line "generate subroutine pool lt_code name ov_driver message mm line ll" is called to generate the temporary subroutine code my code is lost.
    Regards
    Phil Smith

  • How we can read sap.connectiontimeout properties from visual admin

    Hi colleagues,
    How we can read default properties "sap.connectiontimeout"  property from java program.
    Thanks,
    sudhanshu

    Hi ,
    I am talking about connection timeout that we can configure in
    visualadmin-services-configurationadapter-webdynpro-defaultproperties file
    Thanks,
    sudhanshu

  • Reloading weblogic.properties without restarting

    Hi,
    I would like to know how to reload the weblogic.properties file without
    having to restart Weblogic. I have already read that the development of a
    class responsible for loading the properties would help, but I don´t know
    how to...
    Thanks in advance,
    SERGIO.

    The easiest way to hot deploy new web-apps is to migrate to WLS 6.0...
    Sergio wrote:
    Hi Robert,
    Thank you for your answer. I´m trying to deploy new webapplications at the
    time that a new request is made and I don´t want to let the other running
    applications without connection when restarting the WebLogic Server. Do you
    know how to make that? Perhaps the solution is to make several null entries
    and deploy pseudo-generations (because they already exist, but empty) of
    webapplications by filling the content of a null entry... But perhaps
    reserves Weblogic a great amount of memory for each null entry, even when
    they are empty...
    Thanks a lot,
    SERGIO
    "Robert Patrick" <[email protected]> wrote in message
    news:[email protected]..
    The WebLogic Server will only read the weblogic.properties file atstartup.
    You cannot force WebLogic to re-read the rpoperties file withoutrestarting
    the server. What are you trying to do that requires theweblogic.properties
    file to be re-read? There may be some other way of accomplishing what you
    are trying to do...
    Sergio wrote:
    Hi,
    I would like to know how to reload the weblogic.properties file without
    having to restart Weblogic. I have already read that the development of
    a
    class responsible for loading the properties would help, but I don´tknow
    how to...
    Thanks in advance,
    SERGIO.

  • Add weblogic.properties

    hi people
    how do i can to tell to the weblogic to start with another
    weblogic.properties when he starts,
    that is, to start with the weblogic.properties and other property into
    another directory ?
    any help will be appreciated

    ruben <[email protected]> wrote:
              > another cuestion,
              > i have into the starting of the weblogic this sentences:
              > lun nov 27 12:56:49 GMT+01:00 2000:<I> <WebLogicServer> Read global
              > properties c:\weblogic\weblogic.properties
              > lun nov 27 12:56:49 GMT+01:00 2000:<I> <WebLogicServer> No per-server
              > properties files found
              > how do i config the weblogic to have yes into per-erver properties file
              > found
              This means that you have directory with the same name as system name, but there
              is no weblogic.properties file there.
              The order in which weblogic reads weblogic.properties files is like this:
              weblogic_home/weblogic.properties
              weblogic_home/cluster_name/weblogic.properties (if clustering is enabled)
              weblogic_home/cluster_name/system_name/weblogic.properties
              or
              weblogic_home/system_name/weblogic.properties (if clustering is disabled)
              Dimitri
              

  • Multiple weblogic.properties files?

    Hi all,
    We're in the stage now where I need to "quickly" switch between different
    versions of our app running on WLS 5.1.
    Can I pass the path to the weblogic.properties file to the java command in
    startWebLogic, or is it based solely on the weblogic.home property?
    If it is based on the weblogic.home property, what else depends on that
    property. Ideally, I'd like to not to have to duplicate the weblogic tree.
    Thanx!
    Will Hartung
    ([email protected])

    You can specify server name in the command line (startWebLogic.cmd foo)
    and add -Dweblogic.server.name=%1 to the list of java arguments. When
    weblogic starts it will read wl_home/weblogic.properties first and
    wl_home/foo/weblogic.properties second.
    (with clustering enabled it reads weblogic.properties from wl_home
    first, wl_home/cluster_name second and wl_home/cluster_name/server_name
    third).
    Will Hartung <[email protected]> wrote:
    Hi all,
    We're in the stage now where I need to "quickly" switch between different
    versions of our app running on WLS 5.1.
    Can I pass the path to the weblogic.properties file to the java command in
    startWebLogic, or is it based solely on the weblogic.home property?
    If it is based on the weblogic.home property, what else depends on that
    property. Ideally, I'd like to not to have to duplicate the weblogic tree.
    Thanx!
    Will Hartung
    ([email protected])
    Dimitri

  • How do I read properties file kept in the source folder in weblogic workshop

    I want to have a log.properties file in the folder of the source java code which
    is reading this properties file. When I build the code the properties file also
    should go with the generated .class files.
    I am using class.getResourceAsStream("log.properties")
    I tries different ways to make the class to read the file, but it failed to find
    the properties file. Is there any way to keep the configuration files in the same
    directory of the source java code ? This is the problem of weblogic workshop 8.1.
    This thing runs fine in Tomcat.

    Did you try and add the path where the .properties file is located in the CLASSPATH?

  • How to update weblogic.properties in order to support English & Chinese

    <URGENT PROBLEM>
    hi,
    how to update weblogic.properties in order to support English & Chinese
    version in a sing weblogic server?
    Thanks in advance
    <URGENT PROBLEM>

    If you are using JSP as your mechanism for content display, you should use
    the contentType parameter to specify the character and coding of the JSP
    page any character encoding of the resulting stream. So far, we have not
    done a good job of documenting how to produce localized content in JSP. I
    have filed an issue for the documentation folks to work on it. For now,
    take a look at section 2.7.4 of the JSP specification version 1.1.
    Thanks,
    Michael
    Michael Girdley
    Product Manager, WebLogic Server & Express
    BEA Systems Inc
    fxy <[email protected]> wrote in message
    news:8ffr11$59d$[email protected]..
    <URGENT PROBLEM>
    hi,
    how to update weblogic.properties in order to support English & Chinese
    version in a sing weblogic server?
    Thanks in advance
    <URGENT PROBLEM>

  • How can I get all the settings from weblogic.properties ?

    Hi, and excuse me for my poor english.....
    I have a T3Client and I want to obtain all the settings from weblogic
    properties...
    With the sentence getT3Services().config().getProperty("......"), I can
    obtain the property, but my problem is that at runtime, I don`t know
    established names....
    I want to obtain something as the AdminProps servlet, but with a non-web
    client.....
    Can anybody help me ?

    Hi, and excuse me for my poor english.....
    I have a T3Client and I want to obtain all the settings from weblogic
    properties...
    With the sentence getT3Services().config().getProperty("......"), I can
    obtain the property, but my problem is that at runtime, I don`t know
    established names....
    I want to obtain something as the AdminProps servlet, but with a non-web
    client.....
    Can anybody help me ?

  • How to read the properties file available in Server File structure in webdy

    hi all,
    I have developed one webdynpro application. In this application i need to access mdm server to continue. For getting the connection i need to pass the IP addresses.
    Can i have code  how to read the properties file which is residing in the server file. with out included along with the application. keeping some where in the file structure in the server. I want to read that properties file by  maintain the iP addresses and users in  properties file based on the key i want to read like below.
    servername="abcServer"
    username="john"
    password="test123"
    Please send me the code how to read this properties file from the file structure and how to read this values by key  in webdynpro application
    Regards
    Vijay

    Hi Vijay,
    You can try this piece of code too:
    Properties props = new Properties();
    //try retrieve data from file
    //catch exception in case properties file does not exist
    try {
             props.load(new FileInputStream("c:\property\Test.properties")); //File location
             String serverName = props.getProperty("servername"); //Similarly, you can access the other properties
             if(serverName==null)
               //....do appropriate handling
         }     catch(IOException e)
                   e.printStackTrace();
    Regards,
    Alka.

  • How can i read comments from properties file in the right order??

    Hello
    I want to build a console that read a properties file and print to the screen the property name, property value and property description and the developer can change the name or the value or the description of the property and update the property file.
    But the problem in using the properties class that it doesn�t read the comment and not save the properties in their order so I can�t couple description and name of the property.
    Does any one know any utility that do the job or know how to solve the reading the comments problem???
    Thank you a lot?

    sorry but i dont understand how the solution of using
    a dot ( property_key.description ) helping me to
    solve the problem?
    please try to explain it agin.
    thank youYou wrote:
    "I want to build a console that read a properties file and print to the screen the property name, property value and property description and the developer can change the name or the value or the description of the property and update the property file."
    So i'm as developer imagine that somebody edit properties in GUI or console. So you have 3 text fields: property name, property value, and propety description. Then developer save edit changes, then text fields maped to properties file and:
    text field "property name" and text field "property value" construct property:
    name=valuetext field "property name" adding ".description" and text field "property description" construct property:
    name.description=descriptionFor one described property, you will have put two properties.
    Thanks!

  • (Urgent) How to read file properties with virtual path?

    I have the data.properties file, and write a servlet file to read properties from this properties file. But I get a problem, that is: I CANNOT USE VIRTUAL PATH!
    How can I solve?
    My Application Directory is,
    WEB-INF
    classes
    loadProperties.class
    data.properties
    More Question,
    I can use Context in Web.xml to assign values to parameters. But its will be shown. How can I hide value with a properties file?

    This is not working.
    I am using Tomcat 4.0.6, for my JSP application I am trying to read ini.properties file from \webapps\myapp\WEB-INF\classes\common\
    directory through java bean.
    System.getProperty("user.dir")
    is giving <tomcat-home>\bin directory.
    unless I hard code the path this way, I could couldn't read the ini file.
    Properties props = new Properties();
    String strIniFilePath = <webappPath> + "\\WEB-INF\\Classes\\Offenders\\Common\\";
    props.load( new FileInputStream(strPropsFile));

Maybe you are looking for

  • Reference field from MIRO in PO History

    Hi, The reference field in MIRO has to be displayed in Purchase Order History. For PO's with GR Based IV the field is copied from GR and for PO's without GR based IV it is blank. We want the data from MIRO to be displayed in PO History in the referen

  • Posting to gl a/c with open item management are not permitted.

    hello, When i run FAGL_FC_VAL it display the report and generate the batch input session. But when i run the session the error massage appear -             "posting to gl a/c with open item management are not permitted." When i post the same gl mannu

  • Maximum Dialog Processes for BEx Analyzer

    Dear all, Does anybody happen to know if it possible to restrict the number of dialog processes for one BEx Session and if so where it can be maintained. We currently have the problem that one user executing a workbook almost uses all dialog processe

  • Can we call a bdc program from a report?how

    hi experts can u help me for this

  • How do i validate ?

    problem : i want to validate my input with a regex. my input is "27/12/2005 15:41:20"; my validation regex pattern is "dd/MM/yyyy HH:mm:ss" How do i validate ? I did the following but i can not TRUST because of those outputs. it does not validate Str