JNDI Environment Entries

We're porting a web application from Tomcat 4.1.x to WL 7.x. The application requires
several environment entries that we would like to keep outside of property files...
In Tomcat, we used the <Environment> tag of the <Context>. TC would bind these
entries into the application's local JNDI tree and the application would access
them through java:comp/env. We would like to do something similar in WL, but we
haven't been able to spot the mechanism in the docs.
Even if we have to create the environment values in the global JNDI tree and map
them locally through weblogic.xml, it would be fine. What we want to achieve is
making these changes part of the post-build deployment process.
Any help or a slap upside the head is appreciated - not mention needed. :) Thanks.
Bon

Can you refer this page, it might help.
http://docs.sun.com/source/816-7156-10/agj2eres.html
http://forum.java.sun.com/thread.jspa?threadID=499983&messageID=2362672
I am not an expert. Still Cant we use
<env-entry>
<env-entry-name>...</env-entry-name>
ETC
</env-entry>
in your web.xml
and you can use it.
Check this tag also and see if you can use it.
Hope this helps

Similar Messages

  • Where do you put JNDI environment entries

    Hello:
    How do you setup environmental entries that can be lookup via JNDI.
    I was doing this:
    1.) In web.xml put the following:
    <resource-env-ref>
    <resource-env-ref-name>myStringName</resource-env-ref-name>
    <resource-env-ref-type>java.lang.String</resource-env-ref-type>
    </resource-env-ref>
    2.) In global-web-application.xml, then put the following:
    <env-entry-mapping name="myStringName">myStringValue</env-entry-mapping>
    However, the web.xml is not able to find the <env-entry-mapping> to "myStringName"
    Any help on this is much appreciated.
    Thanks (in advance) for any help

    Can you refer this page, it might help.
    http://docs.sun.com/source/816-7156-10/agj2eres.html
    http://forum.java.sun.com/thread.jspa?threadID=499983&messageID=2362672
    I am not an expert. Still Cant we use
    <env-entry>
    <env-entry-name>...</env-entry-name>
    ETC
    </env-entry>
    in your web.xml
    and you can use it.
    Check this tag also and see if you can use it.
    Hope this helps

  • Admin UI for editing environment entries (i.e. env-entry in web.xml)

    Hi there,
    just wanted to know if Weblogic nowadays features a UI for post-deployment editing of environment entries such as the ones declared via <env-entry> in web.xml ( [http://download.oracle.com/docs/cd/E21764_01/web.1111/e13712/web_xml.htm#autoId30] ). So far, I'm using a deployment plan to re-configure these things at the time of each deployment, which works but which is also probably not the most flexible solution.
    Thanks in advance,
    Chris

    Ah, I was trying to do a lookup from session bean for the env-entry defined in
    the web.xml. After reading the J2EE spec, I see this just won't work. env-entries
    are only accessible from within the component where they are defined.
    Still the error message with "comp.env" instead of the expected "comp/env" is
    a bit confusing.
    Not much traffic in this newsgroup, is there?
    Steve
    "Steve Ditlinger" <[email protected]> wrote:
    >
    >
    >
    If I create an "env-entry" block for a name (e.g. "MySchemaName") in
    my web.xml
    file and deploy the web app, I should be able to look up the name from
    my webapp
    with the line:
    <br>
    myInitialContext.lookup("java:comp/env/MySchemaName");
    <br>
    However when I do that I get the error message:
    <br>
    javax.naming.NameNotFoundException: Unable to resolve 'java:comp.env/MySchemaName'
    <br>
    Note that the "comp/env" prefix has been changed to "comp.env". This
    worked under
    WL 6.1. Is this a bug in WL 7's JNDI or a bug in the error message or
    both or
    something else altogether?
    The immediately previous line successfully performs an EJBHome lookup
    using the
    same Initial Context object. The main difference is that the EJBHome
    name is defined
    thru the EJB deployment descriptors, not the web.xml.
    Thanks,
    Steve

  • Question on clustering and J2EE Environment Entries

    Does anyone know if changes made through the admin server console to J2EE
              environment entries are propagated to the managed servers without
              redeploying the entire app. I can find a reference similar to this for
              things in the config.xml which states they are propagated in memory (in most
              cases) and can optionally be written permanently to the confg.xml file. I
              can't find a reference that tells me how/what is done for J2EE environment
              values.
              If this is not possible, how does one do dynamic configuration setting for a
              J2EE application in a clustered environment?
              Kent
              

    What I'm talking about is the environment entries that are set in the web
              application deployment descriptor (web.xml) from the admin server console.
              You go to a specific web-app in the console and then click on "edit web
              application deployment descriptor". From there (towards the bottom of the
              tree on the left) is Env Entry. You can change Environment Entries in the
              DD. What is unclear is if the values are propagated to the running app
              (in memory). For example, if I have a servlet that reads this environment
              entry and I change it in the admin console is the new value reflected
              (relatively) immediately? It's not entirely clear.
              Since there is an option to "persist" these changes (in the top of the tree)
              that would seem to imply that the changes are propagated to the running
              instances in memory otherwise why would I not want to persist the change?
              On the other hand, I would have also expected a button to let me decide when
              to push the changes so I could control when the managed server know about
              the change (for example, if I had to set more than one property to configure
              something).
              So ... does this make my question clearer? And if so is there any
              documentation the describes this? If not how do people handle configuration
              of a running application in a cluster if it not through DD environment
              entries?
              Kent
              "Cameron Purdy" <[email protected]> wrote in message
              news:[email protected]...
              > > Actually I'm talking about what I would call "environment variables" if
              > this
              > > was unix. I am not talking about files (gifs, html, etc) but rather
              > porpety
              > > settings. It is my understanding that these are call "environment
              > entries"
              > > (but I may remembered the name wrong) and are typed values that can be
              > > looked up vi JNDI.
              >
              > You can programmatically set JNDI entries, and they will usually be
              > propagated (although they are not designed to be reliably replicated).
              > Furthermore, the death of the registering server will cause the death of
              the
              > JNDI entries.
              >
              > I don't know how to set them from the console.
              >
              > Peace,
              >
              > --
              > Cameron Purdy
              > Tangosol, Inc.
              > Clustering Weblogic? You're either using Coherence, or you should be!
              > Download a Tangosol Coherence eval today at http://www.tangosol.com/
              >
              >
              >
              > "Kent Mitchell" <[email protected]> wrote in message
              > news:[email protected]...
              > >
              >
              >
              >
              

  • Environment entries

    I store a couple of environment entries in my web.xml file. These are basically a username/password for my OID connection.
    I want other applications to use similar environment entries.
    Is there a file where I can put these entries so any application stored in a paticular container can see them?
    Could I then still do a JNDI lookup to get their values ?
    Thanks Richard

    Hi,
    I never tried it, but I think you should be able to set it up as a datasource configured in teh j2ee/home/config directory of OC4J. There is an existing datasources file already
    Frank

  • Oracle OC4J 904 and JNDI environment variable lookup up

    Hi all, we are getting this when trying to run our app in Oracle 904:
    org.springframework.beans.factory.access.BootstrapException: Define an environment variable [java:comp/env/ejb/BeanFactoryPath] containing the class path locations of XML bean definition files; nested exception is javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/BeanFactoryPath
    javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/BeanFactoryPath
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)
    at javax.naming.InitialContext.lookup(InitialContext.java:345)
    at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:123)
    at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)
    at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:71)
    at org.springframework.context.access.ContextJndiBeanFactoryLocator.useBeanFactory(ContextJndiBeanFactoryLocator.java:64)
    at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:117)
    at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63)
    at MethodInvokerHome_StatelessSessionHomeWrapper1.callCreate(MethodInvokerHome_StatelessSessionHomeWrapper1.java:115)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ejb.StatelessSessionEJBHome.getContextInstance(StatelessSessionEJBHome.java:275)
    at MethodInvokerRemote_StatelessSessionBeanWrapper0.invoke(MethodInvokerRemote_StatelessSessionBeanWrapper0.java:77)
    at java.lang.reflect.Method.invoke(Native Method)
    at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke(RmiClientInterceptorUtils.java:103)
    at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor
    Basically the app server thinks there is no environment entry but I have it declared in ejb-jar.xml descriptor:
    <env-entry>
    <env-entry-name>ejb/BeanFactoryPath</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>applicationContext.prod.xml</env-entry-value>
    </env-entry>
    Any ideas,
    J

    That depends of the shell that you use.
    If you use the bash than execute:
    EXPORT ORACLE_SID=<YOUR_SID>
    If you use csh:
    setenv ORACLE_SID <YOUR_SID>
    Bye, Aron

  • Service Locator and JNDI Environment variables

    Hi,
    I have a class that implements the ServiceLocator pattern running into the container tier (not in a webapp), this class has a method that returns a Connection (java.sql). The problem is that I must hard code the JNDI name of the DataSource (or write it on a properties file), but I want to look for this name like a JNDI environment variable (java:comp/env/jdbc/dataSourceRefName). The class who calls the ServiceLocator is a DAO object, not an EJB. Is there any deployment descriptor tag or similar that let�s me register this name in the JNDI tree?
    Thanks.

    Hi Corujo-h,
    You'll need to declare the resource-ref in the environment
    section of the standard deployment descriptor of any component
    from which you'll invoke this ServiceLocator. So, if it's invoked
    from ejbs, you'll need to define the resource-ref for each ejb
    in ejb-jar.xml.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to add environment entry in EJB3 ejb-jar.xml

    Hi,
    Is that a build in way of add environment entries in JDev for EJB 3 beans? For EJB 2 beans you can do that using properties. But the bean properties is not available in EJB 3. Please help.
    Thanks
    Kenny

    Thank you for the reply. But I need a way to enter env-entry value in ejb-jar.xml for EJB 3 in Jdev. In EJB 2, Jdev generate ejb-jar.xml for the bean and also let you add env-entry through bean's properties menu. But in there in no properties menu for EJB 3, also generated ejb-jar.xml is only a empty file doesn't contain any EJB depolyment information. That means you have to code ejb-jar.xml all manually.
    If I am wrong, can someone show me how to do this right?

  • Global Application Environment Entries

    In declaring environment entries, is there a way to declare one that is global
    to all the beans in an application?.. Currently, I'm declaring them as follows:
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>LMRPackageBQEJB</ejb-name>
    <home>LMRPackageBQSLBean.LMRPackageBQHome</home>
    <remote>LMRPackageBQSLBean.LMRPackageBQ</remote>
    <ejb-class>LMRPackageBQSLBean.LMRPackageBQBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <env-entry>
         <env-entry-name>DB_SCHEMA_NAME_BQ</env-entry-name>
         <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>lmrdba</env-entry-value>
         </env-entry>
         <resource-ref>
    <res-ref-name>jdbc/LMR_DB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </session>
    <session>.....
    How can this be changed?
    Thanks

    Hi,
    I never tried it, but I think you should be able to set it up as a datasource configured in teh j2ee/home/config directory of OC4J. There is an existing datasources file already
    Frank

  • Try to get JDNI tree (NoClassDefFoundError: weblogic/jndi/Environment)

    hiya,
    I try to get access to the jdni tree of a weblogic server (8.1). But I always get the exception:
    java.lang.NoClassDefFoundError: weblogic/jndi/Environment
    javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: weblogic/jndi/Environment
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
    I added the weblogic.jar and the wlclient.jar. Is something still missing?
    Here's a part of the Code, where the exception occurres:
    private static InitialContext getContext(){
    bq. InitialContext ctx = null; \\ Environment environment = new Environment(); /*ERROR*/ \\     environment.setInitialContextFactory(Environment.DEFAULT_INITIAL_CONTEXT_FACTORY); \\     environment.setProviderUrl(url); \\     environment.setSecurityPrincipal(username); \\     environment.setSecurityCredentials(password); \\     try { ctx = (InitialContext) environment.getInitialContext(); \\     } catch (NamingException e) { System.out.println(e.getMessage()); } \\     return ctx;
    Hope that somebody can help me...
    thanks,
    traysa

    hm... I'm not authorised to change something in the script.
    is there no other way... ?
    Here's the code from the edocs of weblogic 8.1. The Code is trying to retrieve the MBeanHome from an external Client:
    public void action() {
              MBeanHome home = null;
              //domain variables
              String url = "t3://xxx";
              String username = "xxx";
              String password = "xxx";
              //Setting an initial context.
              try {
                   Environment env = new Environment();
                   env.setProviderUrl(url);
                   env.setSecurityPrincipal(username);
                   env.setSecurityCredentials(password);
                   Context ctx = env.getInitialContext();
                   //Retrieving the Administration MBeanHome interface
                   home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
                   result = "Got the Admin MBeanHome: " + home + " from the Admin server";
              } catch (Exception e) {
                   System.out.println("Exception caught: " + e);
    here's a short summary of problems I have:
    1. Environment
    Trying to get the initial context from the environment:
    Environment env = new Environment();
    env.setProviderUrl(url);
    env.setSecurityPrincipal(username);
    env.setSecurityCredentials(password);
    Context ctx = env.getInitialContext();
    exception:
    java.lang.NoClassDefFoundError: weblogic/jndi/Environment
    2. MBeanHome
    instead of Environment, I'm using a Hashstable.
    home = (MBeanHome) ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
    The attempt to get the MBeanHome throws following exception:
    java.lang.NoClassDefFoundError: weblogic/management/MBeanHome
    I just don't understand why it doesn't work. Have I missed some settings?
    I'm using JDK 1.5, Developing in Eclipse, added the libs weblogic.jar, wlclient.jar and rt.jar,...
    thx
    traysa

  • Utilizing EJB Environment Entries in different runtime env

    Hello
    We are in the process of moving to the NWDI environment.
    Most of our EJBs are using the EJB Environment Entries (defined in the deployment descriptors)
    Some of those EJBs rely on the fact that the same property will have different values in different runtime environments.
    I have noticed that during the import process (from one env to another) done by the CMS there is no option to change those environment varialbles.
    I have also noticed that there is no option to change the values of those environment entries during runtime in the SAPJ2EE 6.40 (that option existed in SAPJ2EE 6.20)
    I just need to get an official answer;
    Is there no way to control the values of the environment entries during deployment with NWDI?
    Do we have to change our code (that relied on J2EE standards) so it does not expect different values in different runtime environments?
    I have an open CSN about this, but no answer there yet...
    <a href="https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smp_custmsg/main.do?event=LOAD&smpsrv=h">CSN 0120025231 0001708443 2005</a>

    hi
    I have the same problem describewd in this <a href="https://www.sdn.sap.com/irj/sdn/thread?threadID=45460">SDN thread</a>
    to save you the time, it says that You must add the declaration within the sda-dd.xml
    <substitution-variable>
    <variable-name>com.vendor.yourVarName</variable-name>
    </substitution-variable>
    Note that if you write a Server library this file is displayed by the NWDS
    However, if you are using a J2EE application module, this file is generated during the build and stored into the ear.
    if you try using a substitution variable in your deployment descriptor without specifying it in the sda-dd.xml you get a deployment error -
    com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable
    (see full log message below)
    As a workaround, I edited the sda-dd.xml after the EAR was generated (added the required entry), repacked it and deployed it.
    Then it worked.
    The problem is, if I use NWDI, I CANNOT edit the EAR that gets generated!
    any idea of how to solve this?
    <u>full log message of deployment error</u>
    02/01/2006 13:58:13 /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [001]Deployment aborted
    Settings
    SDM host : zaksrv2
    SDM port : 50018
    URL to deploy : file:/C:/DOCUME1/zak/LOCALS1/Temp/temp19284checkpoint.comtimeofftest5substear.ear
    Result
    => deployment aborted : file:/C:/DOCUME1/zak/LOCALS1/Temp/temp19284checkpoint.comtimeofftest5substear.ear
    Aborted: development component 'timeoff/test5/subst/ear'/'checkpoint.com'/'DEV_TIMEOFF6_D'/'20060102135547':
    Caught exception during application deployment from SAP J2EE Engine's deploy API:
    com.sap.engine.deploy.manager.MissingSubstitutionException: Missing substitution value for variable [com.cp.sapGRP].
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).DMEXC)
    Deployment exception : The deployment of at least one item aborted

  • JNDI environment variables

    Is there a way to store variables in a xml application config file and reference those variables in the java program? I can do this with Tomcat, but I have not found a way to do this with 9iAS. Mainly, I found not found which xml file to use.
    Thanks.

    No there is no such thing in weblogic. You cannot use JNDI as a cache but
    you can write your code to register/bind your rmi objects into the jndi
    tree. And save your environment variables there.
    Try using WebLogic Workshop for your development, you will be able to do all
    this without having to write your own code as you can define application
    wide properties there.
    "Jacques Desmazieres" <[email protected]> wrote in message
    news:[email protected]..
    >
    I think I have a very common problem, that seems to fit with JNDI service:
    I need to define applicative variables shared by several applications, andthose
    variables need to be defined at deployment time.
    On Websphere, it is possible to define, from the App Server console, suchJNDI
    entries : sort of Environment variables you access through a JNDI lookupto retrieve
    the value.
    With Weblogic I did not fine anything similar. Did I miss something ?
    I have a constraint: the JNDI configuration must be persistent (stillavailable
    after server restart) and must be defined during deployment and ifpossible, manageable
    from the server console.
    Thanks

  • Weblogic jndi env entries

    Hi,
    I have a little problem. i have a webapplication deployed in weblogic 6.1, now i tried to create an env entriy (in the web.xml) and now i want to access this env entry from within my jsp page.
    I have created a new InitialContext and then just called
    System.out.println(ctx.lookup("myenv"));
    But weblogi can't find the environment myenv. -> NameNotFoundException
    is there another way to access those env entries like in j2ee "java:comp/env/myenv" ????

    everything ok now..it is "java:comp/env"! i had to reinstall weblogic before it worked.. don't ask me why.

  • JNDI environment properties for EJB in deployment descriptor

    Is it possible to deploy an EJB on weblogic 6.0 such that the EJBHome
    object is bound using JNDI to a different JNDI server such as ldap
    server instead of the weblogic server by specifying JNDI env.
    properties like PROVIDER_URL, INITIAL_CONTEXT_FACTORY in the
    deployment descriptor? That is use the weblogic built-in deployer but
    bind the JNDI names to a different JNDI server. For this, can the
    EJBHome objects be treated as just RMI (over IIOP) objects and bind
    them (stubs of the RMI objects) using the Sun's JNDI service provider.
    The goal is that thereafter the Home JNDI names can be looked up by
    RMI clients and the interface methods invoked.
    Thanks,
    ... arun

    Must I put the war and jar files in the same ear ?
    oh..ft...my boss is killing me ..
    package..repackage...package..repackage..and test ??
    Could anybody tell me how to refer a SLSB without put the webApp
    and the EjbApp together in an Ear file ??
    thanks very much!!!!

  • EJBHomeFactory - JNDI lookup

    Hi Everybody,
    Can any on tell me how can u do lookup at EJBHomeFactory class through my client when iam using some app.
    It says u can write ur jndi name in the ejb-jar.xml file, Is there any specific tag for the same.
    It also says u can pass it as -D.. Parameter in case of standalone app.
    THanxs in Adv.
    Amit

    This is a Pattern used for not creating unnesscary Home objects. EJBHomeFactory is a factory class which is used to make use of the home object once created instead of creating one for the each client.This class uses the Map for the same.
    An EJB client needs to lookup an EJB home object, but multiple lookups of the same home are redundant.
    Now here it says:
    JNDI environment entries are refactored to external descriptors. Instead of manually placing hardcoded JNDI Factory and URL strings into a properties object and passing this into the InitialContext constructor, these properties should be externalized to the clients deployment descriptor or runtime system properties (web.xml for web apps, ejb-jar.xml for ejb�s, the �D flag for a standalone java client, etc). That way, the InitialContext object can find these properties within the System properties automatically at runtime, simplifying the factory implementation and making it more reusable.
    Here i have implemented this pattern for my Entity bean example.But, hardcoded the JNDI Name and the property class is used for getting the context object.
    This pattern is available at <b>TheServerSide.com</b>
    Amit

Maybe you are looking for

  • CM 5.1 devicelistx

    I used the devicelistx https://CCMIP/ccmadmin/reports/devicelistx.asp page in CM 4.2 for get the status on real time from devices Now I use the CM 5.1 but in this version devicelistx page doesnt exist. How can i know now the status on real time from

  • No access to management interface on WLC4002

    my dilemma is the follwing: I've have a remotly connected WLC4002. The service port is in 10.10.4.0/23 and the management IF in 10.10.1.0/24. Both are connected to a L3 catalyst which is also providing the default gateway for both networks. (i.e. ~.2

  • Nikon D700   FX format RAW download

    Have just purchased new Nikon D700 and want to download RAW images in FX format but all I Get is private/var/folders/pF/pF0rjz5lHAudOVgkt-Dmxk+TI/-Tmp-/iPhoto/DSC_0069.NEF Anyone any ideas please

  • Apache XML Security

    hi i use Apache XML Security API for document sign sig.addDocument("file:/d:/test.xml", transforms, Constants.ALGO_ID_DIGEST_SHA1); how i can sign a pdf ,docx .... with Apache XML Security API ? it does not work sig.addDocument("file:/d:/test.pdf"...

  • Joining three tables through link tables

    I have three separate tables that are related to each other through two link tables. Employees have a many to many relationship with Programs (1 link table) Employee + Programs have a many to many relationship with Attributes (The employee attributes