Accessing env-entry value from a java class

Hi,
I have my env-entry element declared in ejb-jar.xml like this
<env-entry>
<env-entry-name>ConfigFile</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>centaur</env-entry-value>
</env-entry>
and if I access that value from the EJB of that ejb-jar.xml, it is giving the right value. But when I am trying to retrieve the same from a java class, that is throwing exception "javax.naming.NameNotFoundException: Unable to resolve 'ConfigFile' Resolved ; remaining name 'ConfigFile'"
I think this is because env-entry has access to only EJB to maintain security?
or can env-entry elemenets cab be accessed outside the EJB and some thing I am doing wrong here?
can some one help me here?

Hey Frank,
The JCo, DI API and DB are all on PL 18. I have found that the error only occurs for one business partner, and that business partner had a service contract added to it the day before the error started to occur. Also the business partner in question is the only business partner with a service contract which would explain why it is the only one experiencing these problems. It could be a coincidence but I will let you know what the outcome is.
Carla

Similar Messages

  • Accessing env-entry value from outside a bean

    Hi,
    I have my env-entry element declared in ejb-jar.xml like this
    <env-entry>
    <env-entry-name>ConfigFile</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>centaur</env-entry-value>
    </env-entry>
    and if I access that value from the EJB of that ejb-jar.xml, it is giving the right value. But when I am trying to retrieve the same from a java class, that is throwing exception "javax.naming.NameNotFoundException: Unable to resolve 'ConfigFile' Resolved ; remaining name 'ConfigFile'"
    I think this is because env-entry has access to only EJB to maintain security?
    or can env-entry elemenets cab be accessed outside the EJB and some thing I am doing wrong here?
    can some one help me here?

    The java:comp/env namespace is local to the J2EE component (ie the EJB).
              You could certainly have a business method that returned the value and call the business method from a java class.
              Or your EJB could lookup the env-entry in JNDI and store it in another data structure.
              -- Rob
              WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • Accessing managed-beans property from simple java class

    I have managed bean that is registered in faces-config.xml:
    <managed-bean>
    <managed-bean-name>documentReportsBean</managed-bean-name>
    <managed-bean-class>[myApp].beans.DocumentReportsBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    I want to access property of documentReportsBean from other java class without registering managed-property in faces-config. How can I do that?

    Thank you, what I needed was someone saying the right word. "ValueBinding" in this case.. :)
    Two lines:
    ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{documentReportsBean}");
    DocumentReportsBean pbean = (DocumentReportsBean) vb.getValue(FacesContext.getCurrentInstance());
    gives my full control. Nice

  • Edit env-entry values from web.xml in the WLS console.

    Hi guys!
    Is it possible to define JNDI variables of type java.lang.String using WLS Console?
    Thanks

    I think this would require the use of a deployment plan, which you can learn about here: [http://e-docs.bea.com/wls/docs103/deployment/config.html] . This won't be as convenient as just editing the value directly in the admin console. In fact, it won't even prevent the requirement of redeploying the webapp. It will only allow you to make the change without rebuilding and repackaging the webapp.
    It's questionable whether it's practical or meaningful to change env-entry values in a web.xml without redeployment, because even if you could change the values without redeploying, you'd have to reinitialize the servlet/filter with the changed environment parameter.
    If you really need this dynamic reconfiguration ability, you might have to design the facility into your application, using some sort of polling or event handling capability.

  • How to access AM/VO instance from a Java Service class

    Hi,
    I have a Java service class that is loaded by Java ServiceLoader (http://download.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html) at run time, and I need to access database tables inside that service class. So is there any way that I can access AM/VO instances from that Java class in order to read database table? Thanks.
    Regards,
    K Hein

    You can access an application module with the the two methods below:
        YOURAppModule mAM;
        public void setUpAM()
            throws NamingException
            try
                String AMDefName = "YOUR_APP_DEF_NAME";
                Hashtable env = new Hashtable(2);
                env.put(JboContext.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
                env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
                ApplicationModule am = null;
                InitialContext ic = new InitialContext(env);
                ApplicationModuleHome home = (ApplicationModuleHome) ic.lookup(AMDefName);
                am = home.create();
                // Connect the AM to a database connection
                String jndiDB = "jdbc/HRDS";
                am.getTransaction().connectToDataSource(null, jndiDB, false);
                boolean connected = am.getTransaction().isConnected();
                mAM = (YOURAppModule) am;
            catch (NamingException nex)
                // do some error processing
                throw nex;
            catch (Exception eee)
                // do some error processing
                throw eee;
        public void tearDownAM()
            if (mAM != null)
                if (mAM .getTransaction().isConnected())
                    mAM .getTransaction().disconnect();
                    mAM .remove();
        }You find the YOUR_APP_DEF_NAME in your application module under 'Configurations' -> AppModuleJndiName.
    Make sure you tear down each AM you set up. Otherwise you are running out of resources pretty fast.
    Timo

  • Accessing env-entry from out side bean

    Hi,
              I have my env-entry element declared in ejb-jar.xml like this
              <env-entry>
              <env-entry-name>ConfigFile</env-entry-name>
              <env-entry-type>java.lang.String</env-entry-type>
              <env-entry-value>centaur</env-entry-value>
              </env-entry>
              and if I access that value from the EJB(MDB) of that ejb-jar.xml, it is giving the right value. But when I am trying to retrieve the same from a java class, that is throwing exception "javax.naming.NameNotFoundException: Unable to resolve 'ConfigFile' Resolved ; remaining name 'ConfigFile'"
              I think this is because env-entry has access to only EJB or MDB to maintain security?
              or can env-entry elemenets cab be accessed outside the EJB and some thing I am doing wrong here?
              can some one help me here?

    The java:comp/env namespace is local to the J2EE component (ie the EJB).
              You could certainly have a business method that returned the value and call the business method from a java class.
              Or your EJB could lookup the env-entry in JNDI and store it in another data structure.
              -- Rob
              WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • Help me which JNDIFactory to use to access EJB from a java class of JAR

    I am confused in understanding the different JNDI factories
    RMIInitialContextFactory, ApplicationInitialContextFactory and ApplicationClientInitialContextFactory
    And the different namespaces like global, container local and component local.
    Especially is there any relationship between the JNDI factories and the namespaces?
    Or are they related to the deployment descriptors.
    Because in application specific deployment descriptors (orion-ejb-jar.xml), we just map the JNDI location with the object (or its reference from ejb-jar.xml). We dont specify it can be accessed from this factory or that.
    Shall we access an EJB from using any JNDI factory?
    Specifically, I am stuck with what Factory to use to access an EJB from a Java class in a library (jar). The JAR is packaged with the EAR which contains the EJB Jar that I am trying to access.
    THANK YOU

    Ed,
    As Robin said, I think you need code similar to this:
    Context c = new InitialContext();
    Object o = c.lookup("java:comp/env/Name");where Name is the name of your EJB as it appears in the "ejb-jar.xml"
    deployment descriptor XML file.
    Good Luck,
    Avi.

  • How to call a Java class from another java class ??

    Hi ..... can somebody plz tell me
    How to call a Java Class from another Java Class assuming both in the same Package??
    I want to call the entire Java Class  (not any specific method only........I want all the functionalities of that class)
    Please provide me some slotuions!!
    Waiting for some fast replies!!
    Regards
    Smita Mohanty

    Hi Smita,
    you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
    e.g.
    you have developed A.java and B.java, both are in same package.
    in implementaion of B.java
    class B
                A obj = new A();
                 //to access A's methods
                 A.method();
                // to access A's variable
                //either
               A.variable= value.
               //or
               A.setvariable() or A.getvariable()

  • How can I access the Attribute Values from the Search Region

    Hi all,
    I have a table which contains Company id, department id, and PositonId. For a particular Company and Department there may be multiple records.
    I have to pupulate a table which contains the position and other details that comes under a particular Department and Position based on the selection in the Three comboBoxes.
    Also I have to populate a select many Shuttle to add new postions and records under a particular Department.
    I created a query panel *(Search Region)* for the serch and a table to display the data. That is working fine.
    Now the issue is I am using a view criteria to populate the shuttle with two bind variables ie, DepartmentId and CompanyId.
    If the serach will return a resuktant set in the table it will also pupulate the correct records, otherwise ie, if the if the serch result is empty the corresponding iterator and the attribute is setting as null.
    SO I want to access the attribute values from the Search Region itsef to populate the shuttle.
    I don't know how can I access the data from the Search Region.
    Please Help.
    Regards,
    Ranjith

    you could access the parameters entered in search region by the user as follows:
    You can get handle to the value entered by the user using queryListener method in af:query.
    You can intercept the values entered as described
    public void onQueryList(QueryEvent queryEvent) {
    // The generated QueryListener replaced by this method
    //#{bindings.ImplicitViewCriteriaQuery.processQuery}
    QueryDescriptor qdes = queryEvent.getDescriptor();
    //get the name of the QueryCriteria
    System.out.println("NAME "+qdes.getName());
    List<Criterion> searchList = qdes.getConjunctionCriterion().getCriterionList();
    for ( Criterion c : searchList) {
    if (c instanceof AttributeCriterion ) {
    AttributeCriterion a = (AttributeCriterion) c;
    a.getValues();
    for ( Object o : a.getValues()){
    System.out.println(o.toString());
    //call default Query Event
    invokeQueryEventMethodExpression("#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);
    public void onQueryTable(QueryEvent queryEvent) {
    // The generated QueryListener replaced by this method
    //#{bindings.ImplicitViewCriteriaQuery.processQuery}
    QueryDescriptor qdes = queryEvent.getDescriptor();
    //get the name of the QueryCriteria
    System.out.println("NAME "+qdes.getName());
    invokeQueryEventMethodExpression("#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);
    private void invokeQueryEventMethodExpression(String expression, QueryEvent queryEvent){
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    ExpressionFactory efactory = fctx.getApplication().getExpressionFactory();
    MethodExpression me = efactory.createMethodExpression(elctx,expression, Object.class, new Class[]{QueryEvent.class});
    me.invoke(elctx, new Object[]{queryEvent});
    Thanks,
    Navaneeth

  • How to pass a "object" as a prameter from one java class to another java

    hi experts, I want to know "How to pass and get object as a parameter from one java class to another java class". I tried follwoing code just check it and give suggetions..
    import Budget.src.qrybean;
    public class ConfirmBillPDF extends HttpServlet
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");
    }Here i want to pass db with simplePDFTableShow method. simplePDFTableShow is in another java class. So how can i do this.
    And also i want to know, how this obj will get.
    please help me.
    Edited by: andy_surya on Jul 14, 2010 7:51 AM

    Hi andy_surya
    what is this i am not understand
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");but i am try to solve your problem try this
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow(db);and access like this in SimplePDFtable class update your method
    simplePDFTable(qrybean tempDB)
    // write your code
    }

  • Accessing custom Portal service from a java application

    We have a custom portal service that connects to BW using xmla. How do you access this portal service from a java application. Not from web dynpro, jsp or servlet but from the java code.
    Can we use the INITIAL_CONTEXT_FACTORY to get access to the portal service.
    Thank You
    D.K

    Now I tried the following:
    I've added the prtapi.jar and the service's jar to the additional-lib folder and added the appropriate entries to library.txt and reference.txt.
    Now I can obtain now the PortalRuntime, but this is not initialized.
    Has anybody a solution for this problem? Help would be high appreciated!
    Regards,
    Matthias

  • How to get maximal value from the data/class for show in Map legend

    I make WAD report that using Map Web Item.
    I devide to four (4) classes for legend (Generate_Breaks).
    I want to change default value for the class by javascript and for this,
    I need to get maximal value from the class.
    How to get maximal value from the data/class.
    please give me solution for my problem.
    Many Thx
    Eddy Utomo

    use this to get the following End_date
    <?following-sibling::../END_DATE?>
    Try this
    <?for-each:/ROOT/ROW?>
    ==================
    Current StartDate <?START_DATE?>
    Current End Date <?END_DATE?>
    Next Start Date <?following-sibling::ROW/END_DATE?>
    Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
    ================
    <?end for-each?>
    o/p
    ==================
    Current StartDate 01-01-1980
    Current End Date 01-01-1988
    Next Start Date 01-01-1990
    Previous End Date
    ================
    ==================
    Current StartDate 01-01-1988
    Current End Date 01-01-1990
    Next Start Date 01-01-2005
    Previous End Date 01-01-1988
    ================
    ==================
    Current StartDate 01-01-2000
    Current End Date 01-01-2005
    Next Start Date
    Previous End Date 01

  • How can I get dataTable to display values from the java layer?

    When I use the dataTAble in my JSP page it will only display values from my java layer if the facets tag has it's name set to "header". Why is this happening?
    If I set it to "header" and I look at the page source it actually has created the correct number of rows but it doesn't put the values between the <td> tags? It see's the length of my list but it doesn't pick the values out of the list.
    <h:dataTable var="data" value="#{NameBean.test}" border="1">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    </h:column>
    <h:column>
    <f:facet name="header">
    <!-- <h:outputFormat styleClass="outputFormat" id="format1" value="#{NameBean.test}"></h:outputFormat>-->
    <h:outputText styleClass="outputText" value="#{NameBean.test}" style="" rendered="true" escape="false"/>
    </f:facet>
    </h:column>
    </h:dataTable>
    public List gettest()
              List li = new LinkedList();
              Object Developers[] = {"M@n00j", "sdsadas"};
              for( int i = 0; i < Developers.length; i++ )
                   li.add(Developers);
              return li;
    Thanks in advance to anyone that can help.
    -ls6v

    I've been able to get it working with some of those changes along with changes in the JSP. I think it's a setting or two in the JSP that'll allow the program to run correctly.
    I have a list and it's returned like what you suggested. A day or two ago I tried to move the outputtext outside of the facet tag but nothing would print, I know believe that's related to the following setting in the JSP:
    rows="0" in the <h:dataTAble tag
    Unfortunately the dataTAble isn't displaying the values correctly. It prints all of the values (Strings) in the list on each row and it make a new row for the number of items in the list.......... ???
    Here's what it's printing to the screen (the table):
    ===================
    == [asdasd], [sddfdfd] ==
    ===================
    ===================
    == [asdasd], [sddfdfd]==
    ===================
    what it should print:
    ============
    == [asdasd] ==
    ============
    ============
    == [sddfdfd] ==
    ============
    My code:
    public List gettest()
              List li = new ArrayList();
              li.add("asdasd");
              li.add("affffd");
              return li;
              }JSP
    <h:dataTable border="1" columnClasses="list-column-left"
        headerClass="list-header"
        rowClasses="list-row-odd"
        id="table"
        rows="0"
        value="#{NameBean.test}"
        var="data">
    <h:column>
    <f:facet name="header">
    <h:outputText value="test"/>
    </f:facet>
    <h:outputText value="#{NameBean.test}" style="" rendered="true" escape="false"/>
    </h:column>
    </h:dataTable>

  • How can I call a pop up window from a java class ?

    Hi,
    I am developing a web app. I would like to call a windoz pop up from a java class.
    How can i do that ?
    Thanks

    user504072 wrote:
    It was possible to do it in ASP .NET even from the server side with the method Page.ClientScript. What do you think what Page.ClientScript stands for?
    I's an encapsulation for the JavaScript code required and hides the separation between frontend and backend. There was a reason why so many developers stick to the MVC-pattern wich ist violated here.
    I did not know it is not possible to do the same thing in Java.I'ts not a task of the backend to layout the user interaction GUI.
    bye
    TPD

  • Any difference in creating a web service from a java class or session bean?

    Hi,
    The JDeveloper tutorial at http://www.oracle.com/technology/obe/obe1013jdev/10131/devdepandmanagingws/devdepandmanagingws.htm demonstrates creating a web service from a plain java class. I'm wondering:
    - Is it possible to create a web service from a stateless session bean instead of a java class? If so, what's the proper way to do this in JDeveloper? When I tried doing so in JDeveloper 10.1.3.0.4 (SU5) using the J2EE Web Service wizard, the wizard did not list the session bean in the Component To Publish dropdown (it does list any java classes available in the project). I can proceed by manually typing in the name of the session bean. After the wizard completes though, the @Stateless annotation that had been in my session bean class code is removed and replaced by a @WebService annotation. The end result is that it looks like it made no difference whether I had tried to create the web service from a session bean or plain java class as the annotations in the resulting web service code are the same (although if I had started from a session bean, the class for the web service still implements the Local/Remote EJB interface that the session bean originally implemented).
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean? I'm creating the web service from scratch so I also need to either build the java class or stateless session bean the web service would be based on from scratch too.
    Thanks for any ideas about this.

    Hi,
    EJB Session beans (EJB 3.0) are deployed as WebServices by annotating the class with @WebService and the methds with @WebMethod (both tags require you to add the JSR-181 library to your project (available in the JDeveloper list of libraries)). Unlike the J2E WebService, the EJB session bean service is turned into a WebService upon deployment. This means you obtain teh WSDL file after deployment
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean?
    The difference is that EJB Session bean based web services are integrated with the J2EE container, which means that they can leverage container services like transaction handling, data sources, security, JMS etc.
    Frank

Maybe you are looking for

  • Framebuffer problem on 8800GTX

    Hello everybody, I have a problem with framebuffer on my Arch64. I've installed v86d and I can't choice more than 800x600 I've also tried with an Ubuntu live CD and the frambuffer is working better, I can choice the max resolution (1920x1200) Is anyb

  • Table control in internal table

    what will b the sequence to creat module pool i.e  topinclude , pbo ,pai , screen-layout, flow logic , i m confused which sequence i follow .

  • Home Button Acts up Need some help please

    Hello, My iPhone 3GS keeps hitting the home button by itslef and wont let me do anything and I have tried resetting my phone and everything but doesnt work what do I do. My iPhone is currently at iOS 5.1.1.

  • Organizational unit attributes

    Hi, I need to do a responsible determination in base of organizational unit attributes. For example, if country = DE the responsible organizational unit will be Sales Officce DE. The problem is that I need some attributes which are not in PPOMA_CRM o

  • Mail Signature Replacement

    I have a weird signature problem. I have 3 real IMAP accounts set up, and 4 signatures. The relationships are: Account Email Addresses Signatures Default Account A Address A Signature A Signature A Account B Address B1, Address B2 Signature B1, Signa