Changing env-entry after deployment

Hi,
I was wondering how I can change the value of an env-entry after deployment? Do I have to change the value in the ejb-jar.xml, redeploy the application, or is there a utility I can use?
thanks
Steve

Okay gentlemen, I dug around and couldn't find anything on this concept of defining an env-entry after deployment using Sun Java System Application Server 8.1 - so I just came up with my own hack. Thought I'd share it in case others have the same question and can't find the answer.
Just to restate the problem: In SJAS you can't seem to define an environment entry that you can just look up via JNDI (you can do this in Tomcat pretty easy though using the context.xml file and an env-entry like syntax) - the benefit of this being of course that you can easily define deployment-time variables which a system administrator can set based on his setup. There seems to be no way to do this is SJAS 8.1
As a workaround, you can create your own custom JNDI resource which will expose the properties that you set in the Admin Console as a simple java.util.Map that you can use from your app.
Here's the blow by blow:
2. Create a JNDIProperties object that implements java.util.Map but does NOT implement java.io.Serializable:
package helpers.jndi;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
public final class JNDIProperties implements Map {
    private Map map;
    public JNDIProperties(Map aMap) { map = aMap; }
    public boolean containsKey(Object key) { return map.containsKey(key); }
    public void clear() { map.clear(); }
    public Object get(Object key) { return map.get(key); }
    public boolean containsValue(Object value) { return map.containsValue(value); }
    public Set entrySet() { return map.entrySet(); }
    public boolean isEmpty() { return map.isEmpty(); }
    public Set keySet() { return map.keySet(); }
    public Object put(Object key, Object value) { return map.put(key, value); }
    public void putAll(Map t) { map.putAll(t); }
    public Object remove(Object key) { return map.remove(key); }
    public int size() { return map.size(); }
    public Collection values() { return map.values(); }
}2. Create an object that implements javax.naming.spi.ObjectFactory and returns an instance of JNDIProperties containing the properties defined in the container:
package helpers.jndi;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
public class PropertyFactory implements ObjectFactory {
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
        Map myMap = new Hashtable();
        Reference myReference = (Reference)obj;
        Enumeration myEnumeration = myReference.getAll();
        while (myEnumeration.hasMoreElements()) {
            RefAddr myRefAddr = (RefAddr)myEnumeration.nextElement();
            myMap.put(myRefAddr.getType(), myRefAddr.getContent());
        JNDIProperties myJNDIProperties = new JNDIProperties(myMap);
        return myJNDIProperties;
}3. Build this and copy the jar to $SJAS_HOME/domains/domain1/lib/ext/ (or other appropriate folder for your setup), then restart the app server to get to load the jar.
4. Go to the admin console and go to Resources -> JNDI -> Custom Resources -> New. Give it a sensible JNDI name (I'll use "testproperties" in this example), enter java.util.Map as the resource type and the name of your factory class for the "factory class" field, e.g. "helpers.jndi.PropertyFactory". Below that under "Additional Properties", add in each of the properties that you want to expose, for example enter a property named "testproperty1" with the value of "my test".
5. You can now get a java.util.Map that contains the properties that you set for your custom JNDI resource by doing something like the following (example in JSP):
<%
Context myContext = new InitialContext();
Context myEnvContext = (Context)myContext.lookup("java:comp/env");
Map myMap = (Map)myEnvContext.lookup("testproperties");
%>
<%=myMap.get("testproperty1")%>Output is:
my testNOTE: If this sounds convoluted - I agree, it is. If anyone's got a better idea, please post it; as I could not find another solution to this seemingly simple problem.

Similar Messages

  • How to change SessionTimeOut value after deployed war file in SunAPP Server

    Hi Guys,
    Any one can help and give some guidence How i can change the session time out value in web.xml after deployed the file on sun one application server.This is the code given below which i have to change the time of session from 5 minutes to 1 minute.
    <session-config>
         <session-timeout>5</session-timeout>
    </session-config>
    Regards,
    Suresh.Babu.Ramagani.

    For SunOne session configuration is in the sun-web.xml.
    http://docs.sun.com/app/docs/doc/820-2207/abxcz?a=view
    -steve

  • Changing EndPoint URL after deploying the project

    Hi All,
    I have developed a BPEL process that invokes a Web-Service. the End-Point URL of that service changes from time to time. Now ,my requrement is that I don't want to change my BPEL code every time whenever the URL changes. Is there any cleaner way to change the end-point url and any other varaible after deploying the project.
    Basically I want to know if is this can be achieved without modifying the code manully.
    I am using Jdeveloper 11g and SOA suite 11g with weblogic 10.3.1
    Please suggect
    Thanks

    Hi
    Here I am creating dynamic partner link to call OSB service in my BPEL process. I wan make it dynamic to change run time server address and port numbers. Here I am getting Error (Error occurred reading inline schemas) while creating reference variable as per BPEL cook book. To resolve that exception, I have created /bpel/system/xmllib/ folders in SOA 11g and placed ws-addressing.xsd file. After I am trying to import in BPEL process, still I am getting same Exception.
    Even I tried to read ws-addressing.xsd file through IE browser (http://Host:Port/orabpel/xmllib/ws-addressing.xsd) after placing that directory(/bpel/system/xmllib/). My SOA server and everything is running.
    Thanks in advance.
    mally

  • " Changed " Design Status after deployment involving two runtime reposiory

    Hello everybody,
    I'm experiencing severe metadata management problems in OWB 10.1.0.2.0.
    When I deploy a mapping into the production runtime repository , it appears with a "changed" design status when I switch back to the development runtime repository.
    If I can't rely on the design status it will be a nightmare to manage mapping delivery !
    Anyone can share his experience about managing multiple runtime repository ?
    Best regards,
    Franck.

    Hi Franck
    Looking at your single design repository that deploys to two runtime repositories; I would say when you switch the runtime, it updates internally the default connected runtime for the mapping. As you will remember you can deploy straight from within the design browser if you have previously set the deploy mode. It will be updating this.
    Not much you can do, except create a different design repository. It is somewhat poor I know. I raised a number of TARS on this myself. Perhaps they improved it in Paris (but I somehow doubt it.) Multiple database deployment configuration should be in there but so should real user based functional security and versioning(via the frontend without script repository hacks).
    Too sum up, nearly all sites use the multiple design repository approach.
    Regards,
    Richard Harrison

  • 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.

  • env-entry-mapping element is removed during deployment process

    I overwrite the variable value defined in ejb-jar.xml by the one defined in orion-ejb-jar.xml using <env-entry-mapping> element. But after my appliocation has deployed I don't find this element in the application orion-ejb-jar.xml. Oracle AS just removes this element from the descriptor!
    ejb-jar.xml:
    <env-entry>
    <env-entry-name>server</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>172.38.48.12</env-entry-value>
    </env-entry>
    orion-ejb-jar.xml:
    <session-deployment name="Inventory" max-instances="-1" location="Inventory">
    <env-entry-mapping name="server">dummy</env-entry-mapping>
    </session-deployment>
    Can anybode help?

    Avi!
    Of course, I had tried it before I wrote the question. I put the modified xml file into the application area. After that AS restarts OC4J instance. And then I find my xml without any changes I made! I tried to do the same thing from the AS console. The same!
    Leonid

  • How to change async to sync after deploying the process.? Thanks

    How to change async to sync after deploying the process.? Thanks

    you'd need to change the base wsdl, the generated one (_Name.wsdl) and the bpel.file .. and remove the generated classes .. (all in domains/you_domain/tmp/your_process dir)
    the wsdl needs to get the output msg to the input msg instead of a callback porttype, the same needs to be in the generated wsdl (don't forget to remove the callback role in plnk session).. and the bpel process needs to have a reply instead of the invoke ..
    this is what you would need to do .. BUT, maybe we can find a better solution for you, if you elaborate on the usecase..
    during design time this is easier :-)
    regards clemens

  • Move env-entry from web.xml into deployment plan

    I have:
    <env-entry>
    <env-entry-name>USERNAME</env-entry-name>
    <env-entry-value>someUser</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
    and I'd like to move it from web.xml into my_app_plan.dat. Is it possible? How?
    Thank you in advance!

    Let me describe my case in few more words...
    I have some kind of client-server app. Clients have OC4J installed and they download myApp.ear and myApp_plan.dat files and by using script (Windows CMD batch file) clients install those files with admin_client.jar, OC4J's admin utility. The problem is that I have 2 different types of clients and I have client specific settings set in web.xml file and each time I compile myApp.ear I have to uncomment/comment some lines in web.xml.
    So, to make a long story short, I need a way to deploy those settings separated from (outside of) myApp.ear. By following you link, I have read that orion-web.xml should reside inside WEB-INF folder of myApp.ear, which is not good for me.

  • How to change the Data sources after deploying the application ??

    Hi All,
    i want to know how to change the Data sources after deploying the application to the application server ???
    I'm using Oracle Application Server 10g Release 3 (10.1.3.1.0)

    Can you access the Enrprise Manager website of the target Application Server from your location? If so, you can change the datasource in it. If not, yo can bundle the datasource definition in your archive and use that one instead of the one configured in the target OC4J container. Or this will just be the responsability of your customer: whenever you send a new WAR file, they have to modify the datasource if needed and deploy the application?

  • Changing preferences after deployment

    Does anybody have experience with changing preferences after deployment using InstallShield Tuner? I am trying to change the Comments Repository on a large number of deployments that were deployed using an MST created with InstallShield Tuner.
    In Office I'd use the Maintenance Wizard, but InstallShield Tuner does not appear to have that functionality.

    I know the registry key resolution, but I think that is such an ungraceful thing.
    It would be nice if Adobe would come out with some management products even if this does involve creating an msp file. It would fit nicely into the 'suite' thing.
    Oh well.....

  • Bug in lookup of web.xml env-entry in WL 7.0?

    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

    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

  • Env-entry-mapping suppressed

    Hi,
    Did anyone try &lt;env-entry-mapping&gt; in orion-ejb-jar.xml? It seems that it is suppressed during deployment. The orion-ejb-jar.xml being generated into -deploymentDirectory place (specified or default) simply drops these mappings. The effect is that whatever had been specified in ejb-jar.xml prevails, with obvious, bad consequences.
    Besides, I think I read somewhere that Deployer-supplied orion-ejb-jar.xml would only be augmented with missing specifications. This to me implies that nothing should be removed from it. Perhaps, then, THIS IS A BUG.
    ORION TEAM: I'm running 9.0.3.0.0/NT. I'd appreciate your help and 'know-how', especially if you could offer something better than manually editing orion-ejb-jar.xml in -deploymentDirectory AFTER EACH SUCH TIME THE APPLICATION IS DEPLOYED!

    Avi!
    Of course, I had tried it before I wrote the question. I put the modified xml file into the application area. After that AS restarts OC4J instance. And then I find my xml without any changes I made! I tried to do the same thing from the AS console. The same!
    Leonid

  • Env-entry-mapping in orion-application-client not available in JNDI lookup

    I have an application client module in my EAR file that I've configured to auto-start.
    It has a few env-entry defined in it's application-client.xml.
    When I deploy the EAR file to OC4J 10.1.3, the application client module gets started and can access these env-entry properties from its JNDIContext.
    Now, comes the problem. During the deployment process, I edit the Deployment Plan, and change the env-entry property values, and then deploy the application.
    However, the application client module still gets the original values when it does the JNDI lookups of those env-entry names.
    I have checked to see that OC4J creates an orion-application-client.xml during deployment and it shows the env-entry-mapping elements with the updated values.
    Why is the JNDI lookup returning the values from application-client.xml and not the overriden values set in orion-application-client.xml?
    I have tried this on OC4J 10.1.3, as well as 10.1.3.1.0 - got same behavior.
    Is this a bug in OC4J? This seems to work fine with ejb modules, but not application client modules.
    Thanks,
    Kalpak

    Avi!
    Of course, I had tried it before I wrote the question. I put the modified xml file into the application area. After that AS restarts OC4J instance. And then I find my xml without any changes I made! I tried to do the same thing from the AS console. The same!
    Leonid

  • 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

  • Trailing spaces in env-entry-type elements

    Hi,
    We have been porting our EJB application from another app server over to Oracle iAS (9.0.3 Lite) and have encountered a rather frustrating problem.
    We have an CMP (2.x) entity bean that has ejbSelect methods. There are corresponding <query> blocks in the ejb-jar.xml file for these methods. In the same ejb-jar.xml file there are <env-entry> blocks that setup a few things that are needed by the bean.
    If the <env-entry-type> element is written as "<env-entry-type>java.lang.String </env-entry-type>" (note the trailing space after the type name) the following exception occurs during deployment of the ear file;
    java.lang.InstantiationException: Failure to initialize EJBQL descriptors: com.sun.enterprise.deployment.xml.ContentTransformationException: java.lang.String is not an allowed property value type
         at com.evermind.server.ejb.deployment.EJBPackage.initializeEjbqlDescriptors(EJBPackage.java:2075)
         at com.evermind.server.ejb.deployment.EJBPackage.init(EJBPackage.java:2054)
         at com.evermind.server.ServerComponent.init(ServerComponent.java:208)
         at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDeployment.java:672)
         at com.evermind.server.administration.ServerApplicationInstallation.finish(ServerApplicationInstallation.java:547)
         at com.evermind.server.administration.ServerApplicationInstallation.deploy(ServerApplicationInstallation.java:913)
         at com.evermind.server.administration.DefaultApplicationServerAdministrator.deploy(DefaultApplicationServerAdministrator.java:337)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:479)
    Error during deployment: Failure to initialize EJBQL descriptors: com.sun.enterprise.deployment.xml.ContentTransformationException: java.lang.String is not an allowed property value type
    Removing the trailing space and the deployment proceeds to completion without exceptions.
    I should also add that if the ejbSelect methods are remove d from the application and the trailing space left in place the resulting ear file will deploy sucessfully.
    It is trivial to reproduce this problem with the ORMAP demo that ships with 9.0.3.
    This was a really subtle problem that is not present on the *3* other appserver implementations that our application runs on. It was very frustrating to locate and perhaps some consideration could be given to how PCDATA is handled when parsing <env-entry-type> blocks.
    Cheers,
    Mick.

    Hi ,
    Create two Characteristic InfoObjects in BW With length 60 Char  and then in the Transfer Rules of this two InfoObjects write the Formula using Left() and right() function present in the Formula Builder .
    That is First infoObject Contains the Left 60 Char and next one Contains the right 60 Char.
    Regards,
    Vijay.

Maybe you are looking for