How to obtain PROVIDER_URL in the bean

I want to get access in my bean to the Context.PROVIDER_URL property which
was used by the client to create the initial context.
I know the ejbContext.getEnvironment() method is deprecated so I tried the
following:
javax.naming.InitialContext ctx = new InitialContext();
String sURL =
(String)ctx.lookup("java:comp/env/"+javax.naming.Context.PROVIDER_URL);
This gives me a null back. What am I doing wrong?
Or is there another way to get the provider url inside the bean code?
Ashish P. Narvekar
email: [email protected]

Ashish,
FWIW, this is how we're doing it...
InputStream inp =
ClassLoader.getSystemResourceAsStream("weblogic.properties");
if(inp != null)
Properties env = new Properties();
env.load(inp);
String icf = env.getProperty("databroker.initialContextFactory");
env.put(Context.INITIAL_CONTEXT_FACTORY, icf);
String url = env.getProperty("databroker.providerUrl");
env.put(Context.PROVIDER_URL, url);
entCtx = new InitialContext(env);
We then use entCtx to lookup the home interface. This allows us to "soft code"
our icf and url values in the weblogic.properties file. To my knowledge, nothing
here is deprecated. If anyone knows differently, please let me know.
Guy :)
Jim Zhou wrote:
You probably need to do:
javax.naming.InitialContext ctx = new InitialContext("t3"//host:port");
new InitialContext() will only works when client and server are in the same
JVM.
Regards,
Jim Zhou.
Ashish P. Narvekar <[email protected]> wrote in message
news:[email protected]..
I want to get access in my bean to the Context.PROVIDER_URL property which
was used by the client to create the initial context.
I know the ejbContext.getEnvironment() method is deprecated so I tried the
following:
javax.naming.InitialContext ctx = new InitialContext();
String sURL =
(String)ctx.lookup("java:comp/env/"+javax.naming.Context.PROVIDER_URL);
This gives me a null back. What am I doing wrong?
Or is there another way to get the provider url inside the bean code?
Ashish P. Narvekar
email: [email protected]

Similar Messages

  • How to setup classpath for the beans?

    My packaged beans reference classes in other jars. Right now I have to set up the classpath in the Windows user variables. I think that is not a good way.
    Is there a better way to do it? Thanks.
    Anthony

    Matthew,
    Thanks for the advice. Unfortunately the way you sugguested will not work for me because the beans bridge stuff is just a small piece of the system that I will deploy. And I can't ask all the needed jars put into the Java plug-in's directory.
    I know there is another way to setup the classpath just for the plug-in's. It is by using the Java Plug-in's console. But this looks work only in a development environment. I don't know how I can automate it as part of a product installation process.
    I will deploy an enterpise applicaiton. So far I haven't found a better way to set the classpath than setting the environment variables (which is kind of rude).
    Anthony

  • How to obtain Campaigns for the confirmed Business partner?

    Hi,
    Currently when we go to the campaigns view, we can see all the campaigns created in the system. Is there a way to obtain the campaigns relevant to the confirmed business partner.
    The Search object (MktRootCampaigns) contains only one parameter called "profile_id". (Campaign Profile attached to the IC Web client profile).
    This campaign profile is created in SPRO .... and attached to the IC Web Profile.
    The problem here is ... this profile allows setting of parameters statically in SPRO .....
    Example … we can mention in the profile parameters … “To show all campaigns with low priority”
    The other way is to enhance the BOL search object.
    I tried adding a new parameter to the search object MktRootCampaigns structure CRMS_IC_MKT_CAMPAIGN_SEARCH  to allow dynamic search of campaigns ....
    The structure CRMS_IC_MKT_CAMPAIGN_SEARCH does not allow enhancement of the search structure... since its enhancement category is "cannot be enhanced"
    I checked note 914809. But this structure does not allow me to change the enhancement category either.
    Any insight into this would be helpful.
    Kind Regards
    Vandana

    Hi,
    Something like this is given in the interaction center book. With call lists though ...
    campaigns and call lists use the same GENIL class.
    It should be of help.
    Regards
    Shivani.

  • How to obtain PERNR during BDC with PA40

    Greetings!
    I recorded a PA40 session and am using the code in my program with success.  However, now I must make a call during the BDC code to a FM which requires the PERNR.  I'm not sure how to obtain the PERNR while the BDC code is executing.  I'm sure if I was doing it manually via PA40 I would be able to "see" the PERNR on the screens but I'm not sure how to obtain it while the BDC code is running.
    Thanks in advance.
    Snippet of code:
        PERFORM bdc_dynpro      USING 'MP000200'                '2010'.
        PERFORM bdc_field       USING 'BDC_CURSOR'              'Q0002-FATXT'.
        PERFORM bdc_field       USING 'BDC_OKCODE'              '=UPD'.
        PERFORM bdc_field       USING 'P0002-BEGDA'             lv_begda.
        PERFORM bdc_field       USING 'P0002-ENDDA'             '12319999'.
        PERFORM bdc_field       USING 'P0002-NACHN'             gt_enrollment-lname.
        PERFORM bdc_field       USING 'P0002-VORNA'             gt_enrollment-fname.
        PERFORM bdc_field       USING 'P0002-MIDNM'             gt_enrollment-mname.
        PERFORM bdc_field       USING 'Q0002-PERID'             gt_enrollment-ph_ssn.
        PERFORM bdc_field       USING 'P0002-GBDAT'             gt_enrollment-dob.

    Rob:
    Thanks for the reply.
    The following two lines are the ones that my functional guy is telling me I need to change from hard-coded values to those from HR_BEN_GET_FROM_FEATURE_XXXX; however, this FM requires the PERNR.  It looks like the only option I have is to wait until the BDC is finished and then do a "MOD" operation via HR_INFOTYPE_OPERATION.  Suggestions?
        PERFORM bdc_field     USING 'P0171-BENGR'            '0002'.
        PERFORM bdc_field     USING 'P0171-BSTAT'            '0002'.

  • How can obtain a row from an attribute

    Hi, i´m doing a smart project and i need only one row, how can obtain it?
    The row i want obtain it from an attribute.
    Thanks,

    Finally i do it with this method:
         public Vector getFile(MeIterator syncBos, int fromIndex, int count, String id) {
              // We want usually all items in the MEIterator because the SmartSync API already delivered
              // the correct part of items we want to display.
              // the fromIndex and count variable are only there in case we need a single entry.          
              Vector retVec = new Vector();
              int i = 0;
              if (syncBos != null) {
                   syncBos.reset();
                   // Fill table header with Field Names of Top Row
                   while (syncBos.hasNext()) {
                        /*                    SyncBo sb = (SyncBo) syncBos.next();
                                            if (i >= fromIndex) {
                                                 Vector rowData = new Vector();
                                                 for (int col = 0; col < getColumns(); col++) {
                                                      rowData.addElement(getHeaderFieldValue(sb, tableHeaderNames[col]));
                                                 retVec.addElement(rowData);
                        Row row = (Row) syncBos.next();
                        if (i >= fromIndex) {
                             Vector rowData = new Vector();
                             if ((getHeaderFieldValue(row, tableHeaderNames[1])).equals(id)) {
                                  for (int col = 0; col < getColumns(); col++) {
                                       rowData.addElement(getHeaderFieldValue(row, tableHeaderNames[col]));
                                  retVec.addElement(rowData);                              
                        i++;
                        // return when count has been reached, when count is greater 0.
                        // if count less 0 we get all records.
                        if (count > 0) {
                             if (i >= (fromIndex + count))
                                  return retVec;
              return retVec;
    Thanks,

  • How to obtain checkbox checked/unchecked  while editing

    Hi All,
    My scenorio is,
    I have a form and on that form i have text field & checkbox.
    I am saving record by entering some value in text box & checking checkbox(if my checkbox checked then I am saving "Y" for that checkbox in DataBase).Its saving both things properly in databse.
    While editing , If i click on edit link , my text box value coming properly(i.e. value which I stored in databse. )
    But that checkbox is not coming in checked mode(i.e while saving I have checked checkbox)
    So how to obtain checkbox at the time of editing checked/unchecked as they were at the time of saving ?
    Thanks
    Sandip

    Hi,
    Thanks for your reply.
    Sorry my variable is userAdmin.
    I have getUserAdmin() method in the C.java(server side pojo )?
    But its return type is String.(return type String because I want to save "Y / N") while saving
    public class C{   // server side pojo
    private String userAdmin; // corresponding getter & setter
    lly, I have getUserAdmin() method in cleint side pojo
    public class B{ // client side pojo
    private boolean userAdmin; // corresponding getter & setter
    but while saving I am doing as,
    public class SaveClass
    public String saveMethod()
    C c = new C();
    B bb = new B();
    if (bb.getUserAdmin() == Boolean.TRUE)
    c.setUserAdmin("Y");
    else
    c.setUserAdmin("N");
    // in client side pojo userAdmin variable's return type is boolean for checking as,
    if (bb.getUserAdmin() == Boolean.TRUE)
    but on server side its String for saving "Y / N",
    if (bb.getUserAdmin() == Boolean.TRUE)
    aa.setUserAdmin("Y"); /// to save String here
    So if I write in JSP,
    <h:selectBooleanCheckbox value="#{BeanName.c.userAdmin}"/>
    its giving error as,
    javax.servlet.ServletException: Expected submitted value of type Boolean for Component : {Component-Path :.................                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to obtain this effect in FCPX?

    Hey all,
    I'm trying to subtitle a video and I'd like to add more contrast to the words in order to improve legibility. Can anyone tell me how to obtain in FCPX the effect that's present in the frame below? I'm referring to the gray part behind the text.
    Thanks!

    An alternative method which I prefer is to use a normal lower thirds title and give it an outline of around 3 or 4 pixels in the Inspector.
    I find that this is quick and easy to do (if you have made a custom one) and shows up well against almost any type of background.

  • How to obtain the manage beans instance to oprate it in javacode

    in the faces,there is some manage bean, but i what to operate it ,eg: carbean.carName = "xxxx"; carbean is a managed bean:
    How to obtain the manage beans instance to oprate it in javacode

             ActivityContentBean activityContentBean = (ActivityContentBean) FacesContext
                        .getCurrentInstance().getApplication().createValueBinding(
                                  "#{currentActivity}").getValue(
                                  FacesContext.getCurrentInstance());

  • How can i lookup a session bean from the client side

    how can i lookup a session bean from the client side...........i am using sun appserver..............
    this is my code.................[B]
    private final static String JNDI_NAME="ejb/LmsBean";
    private static String url="ldap://localhost:4848";
    Hashtable h=new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    h.put(Context.PROVIDER_URL,url);
    System.out.println("Before Loading Context in Delegate");
    Context ctx=new InitialContext(h);
    System.out.println("Loaded Context in Delegate");
    Object obj=ctx.lookup(JNDI_NAME);
    System.out.println("Loaded Object in Delegate");
    System.out.println("Before Loading Home in Delegate");
    LmsHome home = (LmsHome )PortableRemoteObject.narrow(obj,com.parx.lms.controller.LmsHome.class);
    System.out.println("Loaded Home in Delegate");
    lms = home.create();
    System.out.println("Loaded remote in Delegate");
    [B]and i got the exception........
    Inside Client before calling delegate
    Before Loading Context in Delegate
    javax.naming.CommunicationException: Request: 1 cancelled
    javax.naming.CommunicationException: Request: 1 cancelled
    at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60)
    at com.sun.jndi.ldap.Connection.readReply(Connection.java:405)
    at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:340)
    at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:171)
    at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2640)
    at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:290)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
    at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193
    at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.ja
    va:136)
    at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.jav
    a:66)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    62)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    at com.parx.lms.lmsdelegate.LmsDelegate.getController(LmsDelegate.java:3
    0)
    at com.parx.lms.lmsdelegate.LmsDelegate.addUserDelegate(LmsDelegate.java
    :50)
    at com.parx.lms.client.consoleClient.Client.main(Unknown Source)
    pls go tru the exception and pls help.........

    That url string should be having the server name or ip instead of localhost.

  • SelectManyListbox : How to set the value in the bean ?

    Hi,
    How can I set the selected values from a selectManyListbox in the bean ?
    My page:
                        <li>
                             <div class="box_multiple_selects clearfix">
                                  <div>
                                       <span>Esportes Selecionados</span>
                                       <h:selectManyListbox id="esportes_selecionados" size="10" value="artigoDetailsBean.esportes"/>
                                  </div>
                                  <div class="btns_fluxo fl">
                                       <button value="<<" name="all_right_hand">>></button>
                                       <button value=">" name="one_right_hand">></button>                                   
                                       <button value="<" name="one_left_hand"><</button>
                                       <button value="<<" name="all_left_hand"><<</button>
                                  </div>
                                  <div>
                                       <span>Esportes Cadastrados</span>
                                       <h:selectManyListbox id="esportes_cadastrados" size="10">
                                            <f:selectItems value="#{artigoDetailsBean.esporteList}" />
                                       </h:selectManyListbox>
                                  </div>
                             </div>
                        </li>
    "It´s a move right-left panel". In the right listbox are the database data, and the user click in the left arrow to move the elements (options) from right listbox to the left, and I´d like to get the selected values from the left listbox.
    The bean:
    public class ArtigoDetailsBean {
    private Collection<String> esportes;
         public Collection<String> getEsportes() {
              return esportes;
         public void setEsportes(Collection<String> esportes) {
              this.esportes = esportes;
         public List<SelectItem> getEsporteList() {
              List<SelectItem> esportes = new ArrayList<SelectItem>();
              for(Object esporte: artigoDetailsCommand.getEsporteList() ) {
                   esportes.add( new SelectItem( ((EsporteVO)esporte).getId().toString(), ((EsporteVO)esporte).getDescricao() ) );
              return esportes;
    Thanks in advance,
    Sergio Stateri Jr.
    [email protected]

    This blog shows an example of what you are trying to do - when the user clicks the left arrow it triggers an action event that puts the value into the left list, and vice-versa:
    [http://weblogs.java.net/blog/driscoll/archive/2008/11/jsf_20_the_swit_1.html|http://weblogs.java.net/blog/driscoll/archive/2008/11/jsf_20_the_swit_1.html]
    Ignore the 'JSF 2.0' in the header - it's not JSF 2.0 in this example!
    Also - don't post your email address on the forums - you might get spammed :)
    m

  • How to obtain the license for the mentioned products.

    Hi All,
    Please help me in below licensing issues.
    1) Our functional team got the below error while accessing "Job Scheduling Workbench".
    Error: The Workbench is inaccessible because Oracle Manufacturing Scheduling has not been licensed. Please work with your Account Manger to purchase the license.
    2) Another error message while accessing the navigation Flow Manufacturing --> Product Sync --> Flow Routings
    Error: APP-BOM 20972: You cannot access this form
    Cause: You do not have a license for Oracle Flow Manufacturing.
    Action: Obtain a license for Oracle Flow Manufacturing.
    Please guide me how to obtain the license for the above products.
    Environment: eBS R12.1.3 on Linux 5.8
    Regards,
    Siva

    Thanks for providing the document. I follow the document and get back to you for any issues.
    Regards,
    Siva.

  • How to obtain the timestamp of a schedule for which I get the details?

    Please find below the extract from documentation showing the syntax of XML returned by the Web Services call. What is missing for me, is the timestamp. I wonder if you guys encountered this and have any idea how to obtain this (timestamp) information about the schedule via RESTFUL web services ?
    <schedule>
    <id>9439</id>
    <name>GC-now-schedule</name>
    <format type="webi"/>
    <status>Completed</status>
    </schedule>

    Hi Jacek,
    There is also the BIPlatform .Net SDK, the Java SDK and the SOAP DSWS web services which have both Java and .NET consumers.
    you can find various samples for common workflows here: http://scn.sap.com/docs/DOC-51445
    that may help.

  • How can I use Method in the bean

    Hi every one
    please I made a method in for example employees entity "EmployeesImpl"
    the name of method getmax() it return number
    how can I use it at the bean
    for eaxmple when I want to press button give me the value from this method
    sorry Iam still beginner
    thanks in advance

    Thanks sir for your response
    my version
    oracle jdeveloper reales 1 (11,1,1,4,0)
    I use business component
    I make method
    this metod wrote at enitity "EmployeesImpl"
    public Number getMax() throws JboException
    PreparedStatement stat=null;
    ResultSet rs=null;
    try {
    String sql="select max(EMPLOYEE_ID)+1 from EMPLOYEES";
    stat=getDBTransaction().createPreparedStatement(sql, 1);
    rs=stat.executeQuery();
    if (rs.next()) {
    return new Number (rs.getInt(1));
    } catch (Exception e) {
    // TODO: Add catch code
    //e.printStackTrace();
    throw new JboException("error");
    } finally {
    try {
    rs.close();
    stat.close();
    } catch (Exception e) {
    // TODO: Add catch code
    //e.printStackTrace();
    // oracle.jbo.domain.Number
    return new Number (1);
    I made a jsf page
    and I put button at the page
    I want when press the button give me message contain the number which come from previous metod
    thanks my dear

  • How to obtain the row data in the component datatable?

    if I want to edit a row data, and then know which row is edited in the component datatable, and how to do?
    How to obtain the row data in the component datatable, and update it to database, not simplely edit a simple table
    Any ideas? Thanks

    Thank you very much for your help Alexander !
    It's quite confusing when you leave Struts and try to adapt your projects for JSF for the first time...
    I wanted to click on a row with a "onMouseClick" on the TR tag like I used to do in Struts/JSTL. But it seems to be impossible in a dataTable.
    Ok then. I've added a column at the end of the row with an icon.
    But eventually I didn't need to declare link parameters.
    In my BackingBean I did like this :
    public String selectEventForUpdate() throws IllegalAccessException, InvocationTargetException {
            PortletAgenda event = (PortletAgenda) JSFUtils.getInRequestMap("event");
            BeanUtils.copyProperties(this, event);
            return null;
       }JSFUtils.getInRequestMap(...) is a method I wrote in a util object :
    public static Object getInRequestMap(String name) {
            Object res = null;
            Map requestMap=FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
            if (requestMap!=null) {
                res=requestMap.get(name);
            return res;
    }  " event " is the name of the item in my dataTable list.
    My backingBean has the same attributes as "event".
    So when the page is reloaded I have a backingBean full with the selected properties to edit/update.
    Thanks to your reply I realized that putting this form in the middle of the dataTable seems to be impossible.
    So I put this form in a floating DIV in front of the table with a shadow.
    It works :o) !
    But I'm a little bit disapointed to be honest...
    I used to build my web applications with Struts and JSTL and doing this kind of interface was really easy.
    I've decided 3 days ago to convert into JSF because the "GUI Layer" seemed to be improved.
    But now I realize that I cannot put a onMouseOver and onMouseClick on a row and I cannot display a different row in the middle of a table....
    I think it's a shame because there is a facet for header and footer.
    And it would be great if we could create our own personal facet that appears only if a condition is true.
    For exemple " if the current item id is the same as the request parameter id then display the following facet content ....... (with a panel group and a form inside to update the row) "
    It's easy to do that with JSTL thanks to c:forEach and c:if but it seems to be impossible to use JSTL tags like this during the dataTable iteration.
    And JSF tags seems to have no logical tags like " if " or loops that can be nested in dataTable.
    I really need to realize this interface (you click on a row then an edit form appears where you clicked).
    Do I have to write a component myself that extends dataTable?
    Do you know if writing such a component is hard to do for a beginner like me?
    (I've juste discovered JSF 3 days ago and I've used Struts/JSTL for 2 years til now)
    I'd be glad to have much advices from you about that.
    Regards

  • How to call the bean in jspdyn component?

    Hi,
    i created  jspdyn component in that bean and bussiness logic class in NWDS.i created a method() in that businesslogic class.i called that method in bean class.i created both in same package,there is no error occur while creating the object of that class.but the bean class not recognize the business class method which i created. What is the cause? and also tell me how to call the bean in jsppage also.and also give me textfields,button and syntax of event handling in HTMLB,iam new to this area.so,give me one example step by step.

    Hi,
         Please check on these links for a good start.
    Java development methodologies (Part II)
    Bean usage in JSPDynPage
    jspDynPage portalapp.xml
    Regards,
    Harini S
    Please avoid giving personal mail id(s). That may prevent others from getting the same information when needed.

Maybe you are looking for

  • Finder causes After Effects and Premiere Pro CS5 to crash

    Basically when attempting to import files into either After Effects or Premiere Pro the Finder causes them to crash.  I'm not sure if it's the Movies folder specifically thats causing it, but I'm unable to find out for sure because the Movies folder

  • How can I get Imovie to recognize clips from my Camcorder

    I have a panasonic HDC-TM700 camcorder I recorded in AVCHD mode and Imovie won't recognize the clips. Does anyone have any tips for converting the clips into a readible format?

  • MacBook Pro Freezes When Viewing Any Video with new iTunes

    I, too, am having problems with the latest iTunes update. My MacBook Pro freezes completely. Total lock-up. This happens when trying to view any video, including video podcasts. I have to hold down the power button for several seconds to get my lapto

  • Moving Lightroom to another computer

    i have lightroom on my laptop but want to put it on my new pc, how do i do this?

  • Login items help

    I have installed a monitor calibration tool - ColorVision Spyder. It creates a Login Item - "ColorVisionStartup.app". Problem is - this "item" is unchecked in my account's "Login items" but still runs at login (I can see the icon of this app briefly