Xml in ejb env-entry

hi,
i have a question:
i want to set an ejb env entry value to </a>.
in the ejb-jar.xml i wrap it into <![CDATA[</a>]]>, and it
works.
In the console the pure string </a> appears.
as i want to edit it to <a>x</a> i receive an exception,
wouldn't it be more correctly if the console wraps all
string values into <![CDATA[ ]]>?
Is there some other way to store an xml snippet for configuration purpose?
best regards
bernhard

Hi.
You might try posting this on the ejb newsgroup.
Regards,
Michael
bernhard huber wrote:
hi,
i have a question:
i want to set an ejb env entry value to </a>.
in the ejb-jar.xml i wrap it into <![CDATA[</a>]]>, and it
works.
In the console the pure string </a> appears.
as i want to edit it to <a>x</a> i receive an exception,
wouldn't it be more correctly if the console wraps all
string values into <![CDATA[ ]]>?
Is there some other way to store an xml snippet for configuration purpose?
best regards
bernhard--
Michael Young
Developer Relations Engineer
BEA Support

Similar Messages

  • Issue with [env-entry] element in web.xml

    I know it's possible to define [env-entry] elements in web.xml for environment
    properties of a web application. But how do you access [env-entry] elements from
    classes that do not exist within a web application? In other words, this is my
    problem:
    I have an EAR file, enterprise.ear, which contains the following...
    employee.jar
    employeeSearchEJB.jar
    webApp1.war
    META-INF/
    application.xml
    The employee.jar file is a utility archive that contains common classes, one of
    which is a class called LogManager. LogManager needs to read environment properties
    in order to initialize itself. Currently, LogManager reads these properties from
    a property file, and therefore it needs to know the name of the property file
    in order to access it. I dont like this approach because I'm forced to hard-code
    the name of the property file in LogManager. I would rather leverage the power
    of J2EE deployment descriptors and use the [env-entry] element to define the environment
    properties for the LogManager class. Then, I would simply use JNDI to get the
    values of the [env-entry] elements without ever having to specify their location
    aside from the default JNDI context; java:comp/env, which is standard anyway.
    The problem I'm having is that you can define the [env-entry] element in only
    2 types of deployment descriptors; namely, web.xml and ejb-jar.xml, neither of
    which are available to LogManager because LogManager exists at the EAR root level.
    I was hoping application.xml supported the [env-entry] element, but it doesn't.
    Any suggestions?
    SAF

    SAF,
    I am not sure if this applies to you situation but if you create an initial context
    instance and then grab the value using the jndi name within that context then
    you should be able to grab that environment variable.
    I have a helper class that is used as part of a deployed application. The helper
    class doesn't have access to the Servlet context but it is created as part of
    the application workflow. When it gets initiated it grabs an env-entry created
    in the web.xml deployment descriptor to find the default url for a content path.
    After I create an initialContext, I perform a initContext.lookup("jndi.env.entry.here")
    where "jndi.env.entry.here" is the name specified in the env-entry tag.
    This returns the value of the entry.
    This works under both Jrun and Weblogic so my guess is it should work for you.
    Again, I am assuming that your class will at least be able to grab a context
    object to communicate back to the server.
    Hope this helps,
    Troy
    "SAF" <[email protected]> wrote:
    >
    I know it's possible to define [env-entry] elements in web.xml for environment
    properties of a web application. But how do you access [env-entry] elements
    from
    classes that do not exist within a web application? In other words, this
    is my
    problem:
    I have an EAR file, enterprise.ear, which contains the following...
    employee.jar
    employeeSearchEJB.jar
    webApp1.war
    META-INF/
    application.xml
    The employee.jar file is a utility archive that contains common classes,
    one of
    which is a class called LogManager. LogManager needs to read environment
    properties
    in order to initialize itself. Currently, LogManager reads these properties
    from
    a property file, and therefore it needs to know the name of the property
    file
    in order to access it. I dont like this approach because I'm forced to
    hard-code
    the name of the property file in LogManager. I would rather leverage
    the power
    of J2EE deployment descriptors and use the [env-entry] element to define
    the environment
    properties for the LogManager class. Then, I would simply use JNDI to
    get the
    values of the [env-entry] elements without ever having to specify their
    location
    aside from the default JNDI context; java:comp/env, which is standard
    anyway.
    The problem I'm having is that you can define the [env-entry] element
    in only
    2 types of deployment descriptors; namely, web.xml and ejb-jar.xml, neither
    of
    which are available to LogManager because LogManager exists at the EAR
    root level.
    I was hoping application.xml supported the [env-entry] element, but it
    doesn't.
    Any suggestions?
    SAF

  • Naming exception when using env-entry

    My ejb.jar.xml file contains:
    <env-entry>
    <env-entry-name>iorFileName</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>d:\\planadminserver.ior</env-entry-value>
    </env-entry>
    I use the following code to do a lookup:
    InitialContext ic = new InitialContext();
    String filename =
         (String) ic.lookup("java:comp/env/iorFileName");
    This works fine on my machine. But when we moved the code to
    another machine, we get a NamingException. Any ideas as to why
    this should be?

    Hi DP,
    The problem is not with the EntryProcessor but probably, with the coherence server (storage node) and proxy server that went down during request processing.
    2012-03-15 12:06:59.319/56.479 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=2): Member 1 left service CoherenceCache with senior member 2
    2012-03-15 12:06:59.319/56.479 Oracle Coherence GE 3.7.1.0 <D5> (thread=Proxy:DistributedProxy:TcpAcceptorWorker:3, member=2): An exception occurred while processing a InvokeRequest for Service=Proxy:DistributedProxy:TcpAcceptor: (Wrapped: Failed request execution for CoherenceCache service on Member(Id=2, Timestamp=2012-03-15 12:06:09.858, Address=10.38.45.253:8090, MachineId=36960, Location=site:,machine:KN3M9434,process:8224, Role=CoherenceServer) (Wrapped: Failed to load key="1") null) java.lang.NullPointerExceptionEnsure that the storage node and proxy is up and running.
    Hope this helps!
    Cheers,
    NJ

  • 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

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

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

  • env-entry and InitialContext

    Hi
    I have put a String value, named "myval" into my web.xml file using
    <env-entry> tags. In my code I use the following:
    // assume this gets with default values...
    InitialContext ctxt = new InitialContext();
    String myval = (String) ctxt.lookup("java:comp/env/myval");
    and that usually extracts myval with no problems if I do it within a Web
    context, i.e. from a JSP or a class referenced initially from a JSP.
    However, it fails to extract myval when I do it within an EJB context, i.e.
    call from an EJB.
    Also, new InitialContext() sometimes goes into an infinite loop.
    So, I have two problems, can anyone clarify them?
    1. At random (not repeatable) the new InitialContext() call goes into an
    infinite loop. The WebLogic debug file just shows it looping and looping
    indefinitely, ending with a "Problematic thread" error!!! This is from a Web
    context or Servlet Context (not sure of what this is called)
    2. The EJB I use in another part of the application cannot get the
    InitialContext(). When I try to do this I get NamingException thrown.
    Fran

    Thanks for this Mahendra.
    Does anybody have any idea as to the first problem? i.e. looping error?
    I'm calling this code many times, so maybe it's getting 'confused' but
    that's not really a good explanation of the problem!
    Many thanks again
    Fran
    "Mahendra Dhamdhere" <[email protected]> wrote in message
    news:3a96799a$[email protected]..
    As per my knowledge,
    env-entrys defined in web.xml are local to that container, a Container in
    which your servlet is deployed. For each web application, weblogic createsa
    ServletContainer and a ServletContext. That's why we can use differentlocal
    names from same global resources.
    As your servlet container and ejb container are different container andthey
    have different environment, to solve your problem, you can defineenv-entry
    in your deployment descriptor file(ejb-jar.xml).
    HTH,
    Mahendra
    Fran <[email protected]> wrote in message
    news:[email protected]..
    Hi
    I have put a String value, named "myval" into my web.xml file using
    <env-entry> tags. In my code I use the following:
    // assume this gets with default values...
    InitialContext ctxt = new InitialContext();
    String myval = (String) ctxt.lookup("java:comp/env/myval");
    and that usually extracts myval with no problems if I do it within a Web
    context, i.e. from a JSP or a class referenced initially from a JSP.
    However, it fails to extract myval when I do it within an EJB context,i.e.
    call from an EJB.
    Also, new InitialContext() sometimes goes into an infinite loop.
    So, I have two problems, can anyone clarify them?
    1. At random (not repeatable) the new InitialContext() call goes into an
    infinite loop. The WebLogic debug file just shows it looping and looping
    indefinitely, ending with a "Problematic thread" error!!! This is from aWeb
    context or Servlet Context (not sure of what this is called)
    2. The EJB I use in another part of the application cannot get the
    InitialContext(). When I try to do this I get NamingException thrown.
    Fran

  • env-entry element in ejb-jar.xml

    I just started to create my ejb-jar.xml (deployment descriptor file) manually so
    that I won't depend on those generated by proprietary IDEs.
    The ejb-jar_2_0.dtd specifies that env-entry is used in
    entity, message-driven, and session elements.
    My question is - When do we use the element <env-entry>? Under what
    circumstances that ejb-jar_2_0.dtd necessitates its provision in the ejb-jar.xml
    in relation to entity, message-driven, and session elements?

    Hi,
    I've same prob here
    <env-entry>
    <env-entry-name>config.file.location</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>C:/bea/ITReportingConf.xml</env-entry-value>
    </env-entry>
    Right now config file is out side of my EAR, How can i put it within the EAR I tried with changing the
    <env-entry-value>/ITReportingConf.xml</env-entry-value> Value
    But i dont know which dir it is refering to and where should i put "ITReportingConf.xml" File
    Thanks

  • Query Reg env-entry in ejb jar xml

    Hi,
    I have the following tag in the ejb-jar of my application:
    <env-entry>
    <env-entry-name>postingDate</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>Request</env-entry-value>
    </env-entry>
    When a JNDI LookUp is done for this variable in the application, it doesn't pick up the value of the variable which is "Request" but it picks up the Value of the Posting Date.
    I need to know how this works!
    Just an Fyi, Posting Date is a date entered from the UI.

    I feel it is like declaring global and local variables with the same name and trying to access that variable.

  • Global env-entry JNDI variables space for same ejb-jar.xml file

    [Software]
    jboss4.0.5
    jdk 1.5
    [Problem]
    Is there any global <env-entry> tag for a Single EJB Module. Is there any way by which the JNDI variable can be accessed by all the modules except by binding the variables in the JNDI explixity in the code
    Thanks in advance
    CSJakharia

    Unfortunately not. The EJB specification has always scoped the component environment
    (java:comp/env) as a private environment for each EJB. The advantage is you can
    assign entries within each bean easily without worrying about clashing with names selected
    for other beans in the ejb-jar. That eases the process of assembling beans developed
    separately into one ejb-jar since there is no possibility that their component environments
    will clash.
    However, the downside is just what you're pointing out, which is that in many cases
    developers prefer to define a single dependency that is shared among all the
    beans in the ejb module. That is the behavior of the component environment in a
    web application.
    We'll be looking into ways to simplify this for ejbs in a future revision of the specification.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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

  • Use of env-entry in ejb-jar

    In my ejb-jar.xml I have a Session bean with a env-entry:
    <env-entry>
    <env-entry-name>xslNameFile</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>pdftemplate.xsl</env-entry-value>
    </env-entry>
    In a class where I use the bean I make a lookup of this env-entry (using the same
    context):
    Context environment = (Context)ctx.lookup("java:comp/env/");
    val = (String)environment.lookup("xslNameFile");
    And I have the following Exception:
    javax.naming.NameNotFoundException: Unable to resolve 'comp/env/xslNameFile' Reso
    lved: 'comp/env' Unresolved:'xslNameFile' ; remaining name 'xslNameFile'
    What I m doing wrong??
    Could anyone help me?
    Thanks
    F.Canonica

    HI ,
    The Primary Purpose of <env-entry> tag
    is used to Customize your bean at Runtime
    and to Make your bean as an DataDriven one.
    ( instead of Storing it in DataBase )
    Regards
    Karthikeyan Gangadharan
    "Deepak Vohra" <[email protected]> wrote:
    >
    >
    >
    InitialContext ic = new InitialContext();
    String val = (String) ic.lookup("java:/comp/env/xslNameFile");
    "canonica" <[email protected]> wrote:
    In my ejb-jar.xml I have a Session bean with a env-entry:
    <env-entry>
    <env-entry-name>xslNameFile</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>pdftemplate.xsl</env-entry-value>
    </env-entry>
    In a class where I use the bean I make a lookup of this env-entry (using
    the same
    context):
    Context environment = (Context)ctx.lookup("java:comp/env/");
    val = (String)environment.lookup("xslNameFile");
    And I have the following Exception:
    javax.naming.NameNotFoundException: Unable to resolve 'comp/env/xslNameFile'
    Reso
    lved: 'comp/env' Unresolved:'xslNameFile' ; remaining name 'xslNameFile'
    What I m doing wrong??
    Could anyone help me?
    Thanks
    F.Canonica

  • Env-entry in web.xml and 6.0 sp4

    Does anyone know if iws 6.0 sp4 supports env-entry elements in web.xml???
    According to servlet specs 2.2 it should support it since it has JSP support.
    From 2.3 specs:
    "The following addtional elements exist in the web application deployment
    descriptor to meet the requirements of web containers that are JSP enabled or part
    of a J2EE application server. They are not required to be supported by containers
    wishing to support only the servlet specification.:
    � taglib
    � syntax for looking up JNDI objects (env-entry, ejb-ref, ejb-local-ref, resourceref,
    resource-env-ref)
    See the DTD comments for further description of these elements."

    Additional info...actually the code throws a NamingException.

  • 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

  • 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

Maybe you are looking for