How to get EJBs environment?

EJBContext.getEnvironment() is deprecated.
"Deprecated. Use the JNDI naming context java:comp/env to access enterprise bean's environment."
I'm confused on how to use "java:comp/env" to the the EJBs environment. Can anyone shed some light on this for me?
Thanks.
Eric

Thanks.
After reading that, I think I've asked the wrong question. I want to be able to set/change an MDB's provider-url. I assume I could do this in the setMessageDrivenContext method. The problem is that our dev/test/prod environments will each have a different provider-url. Building a different weblogic-ejb-jar.xml file for each environment will pretty much ensure that someone will eventually deploy the wrong one and prod will be listening to a dev topic. Anyone have an elegant solution for this?
Thanks.

Similar Messages

  • How to get system Environment variable?

    How to get system Environment variable without using jni?
    just like "JAVA_HOME" or "PATH"...
    Any reply is help to me!! :-)

    Thx for your reply...
    I get it!!!
    Read environment variables from an application
    Start the JVM with the "-D" switch to pass properties to the application and read them with the System.getProperty() method. SET myvar=Hello world
    SET myothervar=nothing
    java -Dmyvar="%myvar%" -Dmyothervar="%myothervar%" myClass
    then in myClass String myvar = System.getProperty("myvar");
    String myothervar = System.getProperty("myothervar");
    This is useful when using a JAVA program as a CGI.
    (DOS bat file acting as a CGI) java -DREQUEST_METHOD="%REQUEST_METHOD%"
    -DQUERY_STRING="%QUERY_STRING%"
    javaCGI
    If you don't know in advance, the name of the variable to be passed to the JVM, then there is no 100% Java way to retrieve them.
    NOTE: JDK1.5 provides a way to achieve this, see this HowTo.
    One approach (not the easiest one), is to use a JNI call to fetch the variables, see this HowTo.
    A more low-tech way, is to launch the appropriate call to the operating system and capture the output. The following snippet puts all environment variables in a Properties class and display the value the TEMP variable. import java.io.*;
    import java.util.*;
    public class ReadEnv {
    public static Properties getEnvVars() throws Throwable {
    Process p = null;
    Properties envVars = new Properties();
    Runtime r = Runtime.getRuntime();
    String OS = System.getProperty("os.name").toLowerCase();
    // System.out.println(OS);
    if (OS.indexOf("windows 9") > -1) {
    p = r.exec( "command.com /c set" );
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1 )
    || (OS.indexOf("windows xp") > -1) ) {
    // thanks to JuanFran for the xp fix!
    p = r.exec( "cmd.exe /c set" );
    else {
    // our last hope, we assume Unix (thanks to H. Ware for the fix)
    p = r.exec( "env" );
    BufferedReader br = new BufferedReader
    ( new InputStreamReader( p.getInputStream() ) );
    String line;
    while( (line = br.readLine()) != null ) {
    int idx = line.indexOf( '=' );
    String key = line.substring( 0, idx );
    String value = line.substring( idx+1 );
    envVars.setProperty( key, value );
    // System.out.println( key + " = " + value );
    return envVars;
    public static void main(String args[]) {
    try {
    Properties p = ReadEnv.getEnvVars();
    System.out.println("the current value of TEMP is : " +
    p.getProperty("TEMP"));
    catch (Throwable e) {
    e.printStackTrace();
    Thanks to W.Rijnders for the W2K fix.
    An update from Van Ly :
    I found that, on Windows 2003 server, the property value for "os.name" is actually "windows 2003." So either that has to be added to the bunch of tests or just relax the comparison strings a bit: else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1 )
    || (OS.indexOf("windows 2003") > -1 ) // works but is quite specific to 2003
    || (OS.indexOf("windows xp") > -1) ) {
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 20") > -1 ) // probably is better since no other OS would return "windows" anyway
    || (OS.indexOf("windows xp") > -1) ) {
    I started with "windows 200" but thought "what the hell" and made it "windows 20" to lengthen its longivity. You could push it further and use "windows 2," I suppose. The only thing to watch out for is to not overlap with "windows 9."
    On Windows, pre-JDK 1.2 JVM has trouble reading the Output stream directly from the SET command, it never returns. Here 2 ways to bypass this behaviour.
    First, instead of calling directly the SET command, we use a BAT file, after the SET command we print a known string. Then, in Java, when we read this known string, we exit from loop. [env.bat]
    @set
    @echo **end
    [java]
    if (OS.indexOf("windows") > -1) {
    p = r.exec( "env.bat" );
    while( (line = br.readLine()) != null ) {
    if (line.indexOf("**end")>-1) break;
    int idx = line.indexOf( '=' );
    String key = line.substring( 0, idx );
    String value = line.substring( idx+1 );
    hash.put( key, value );
    System.out.println( key + " = " + value );
    The other solution is to send the result of the SET command to file and then read the file from Java. ...
    if (OS.indexOf("windows 9") > -1) {
    p = r.exec( "command.com /c set > envvar.txt" );
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1
    || (OS.indexOf("windows xp") > -1) ) {
    // thanks to JuanFran for the xp fix!
    p = r.exec( "cmd.exe /c set > envvar.txt" );
    // then read back the file
    Properties p = new Properties();
    p.load(new FileInputStream("envvar.txt"));
    Thanks to JP Daviau
    // UNIX
    public Properties getEnvironment() throws java.io.IOException {
    Properties env = new Properties();
    env.load(Runtime.getRuntime().exec("env").getInputStream());
    return env;
    Properties env = getEnvironment();
    String myEnvVar = env.get("MYENV_VAR");
    To read only one variable : // NT version , adaptation for other OS is left as an exercise...
    Process p = Runtime.getRuntime().exec("cmd.exe /c echo %MYVAR%");
    BufferedReader br = new BufferedReader
    ( new InputStreamReader( p.getInputStream() ) );
    String myvar = br.readLine();
    System.out.println(myvar);
    Java's System properties contains some useful informations about the environment, for example, the TEMP and PATH environment variables (on Windows). public class ShowSome {
    public static void main(String args[]){
    System.out.println("TEMP : " + System.getProperty("java.io.tmpdir"));
    System.out.println("PATH : " + System.getProperty("java.library.path"));
    System.out.println("CLASSPATH : " + System.getProperty("java.class.path"));
    System.out.println("SYSTEM DIR : " +
    System.getProperty("user.home")); // ex. c:\windows on Win9x system
    System.out.println("CURRENT DIR: " + System.getProperty("user.dir"));
    Here some tips from H. Ware about the PATH on different OS.
    PATH is not quite the same as library path. In unixes, they are completely different---the libraries typically have their own directories. System.out.println("the current value of PATH is: {" +
    p.getProperty("PATH")+"}");
    System.out.println("LIBPATH: {" +
    System.getProperty("java.library.path")+"}");
    gives the current value of PATH is:
    {/home/hware/bin:/usr/local/bin:/usr/xpg4/bin:/opt/SUNWspro/bin:/usr/ccs/bin:
    /usr/ucb:/bin:/usr/bin:/home/hware/linux-bin:/usr/openwin/bin/:/usr/games/:
    /usr/local/games:/usr/ccs/lib/:/usr/new:/usr/sbin/:/sbin/:/usr/hosts/:
    /usr/openwin/lib:/usr/X11/bin:/usr/bin/X11/:/usr/local/bin/X11:
    /usr/bin/pbmplus:/usr/etc/:/usr/dt/bin/:/usr/lib:/usr/lib/lp/postscript:
    /usr/lib/nis:/usr/share/bin:/usr/share/bin/X11:
    /home/hware/work/cdk/main/cdk/../bin:/home/hware/work/cdk/main/cdk/bin:.}
    LIBPATH:
    {/usr/lib/j2re1.3/lib/i386:/usr/lib/j2re1.3/lib/i386/native_threads:
    /usr/lib/j2re1.3/lib/i386/client:/usr/lib/j2sdk1.3/lib/i386:/usr/lib:/lib}
    on my linux workstation. (java added all those execpt /lib and /usr/lib). But these two lines aren't the same on window either:
    This system is windows nt the current value of PATH is:
    {d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;c:\depot\cdk\main\cdk\bin;c:\depot\
    cdk\main\cdk\..\bin;d:\OrbixWeb3.2\bin;D:\Program
    Files\IBM\GSK\lib;H:\pvcs65\VM\win32\bin;c:\cygnus
    \cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;D:\orant\bin;C:\WINNT\system32;C:\WINNT;
    C:\Program Files\Dell\OpenManage\Resolution Assistant\Common\bin;
    d:\Program Files\Symantec\pcAnywhere;
    C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}
    LIBPATH:
    {D:\jdk1.3\bin;.;C:\WINNT\System32;C:\WINNT;d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;
    c:\depot\cdk\main\cdk\bin;c:\depot\cdk\main\cdk\..\bin;
    d:\OrbixWeb3.2\bin;D:\Program Files\IBM\GSK\lib;
    H:\pvcs65\VM\win32\bin;c:\cygnus\cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;
    D:\orant\bin;C:\WINNT\system32;
    C:\WINNT;C:\Program Files\Dell\OpenManage\ResolutionAssistant\Common\bin;
    d:\Program Files\Symantec\pcAnywhere;
    C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}

  • How to get an environment variable from OS in class ?

    Hello,
    How to get an environment variable from OS in class ?
    Thanks !

    An example of a Java application that does this is Ant, when you add a line like this in your build.xml:
    <!-- Import environment variables -->
    <property environment="env"/>
    I have looked at the source code of Ant 1.3, especially the file src/main/org/apache/tools/ant/taskdefs/Execute.java. Look at the methods getProcEnvironment() and getProcEnvCommand(). Ant uses an OS-dependent trick to get the environment variables.
    You can download the Ant source code from http://jakarta.apache.org/ant
    Jesper

  • How to define your own context in an EJB environment - possibly distributed

    I would like to setup a context (an object accissible per logical thread) in an EJB environment, but I am too unfamiliar with the options I may have.
    My objective is to create a context in which I may set a value, then invoke a method on an object (which in turn invokes a method on another object and so forth) and eventually get back the value from the context. In other words I am trying to pass a value without passing it as a parameter. More specifically, I have written a JDBC Driver wrapper in which I want to intercept a number of method calls and based on the context settings perform one or the other JDBC preprocessing. The reason for not passing the values as parameters is to interfere as little as possible with any environment in which this code is to be integrated. I simply want to set the context and get the context (in my JDBC wrapper) without the surrounding code needing to change.
    I have succeded partially by using a ThreadLocal object to hold my context. I can set and get the values to and from the context and actually pass values to my Driver wrapper without explicitly passing them as parameters. This works well in a non-EJB environment. My concern arises when I switch to the EJB environment.
    If my context is set in a session bean, which invokes an entity bean, am I then guaranteed that these will execute in the same physical thread?
    If the session and the entity beans are hosted on seperate machines then the answer would certainly be NO. Is there any way to have the container manage the context and propagate it accross containers when needed?
    Any thoughts or suggestions on this topic are wellcome, even if they don't solve the issue entirely.
    Looking forward to hear from you all!
    /poul

    In an EJB environment, you have absolutely no control over threading issues. (It was purposefully designed that way.) However, you do have your own little "sandbox" in the EJB ClassLoader - which is why there is a lot of use of the Singleton pattern for factories and (very carefully!) as small caching mechanisms. You might want to look into that avenue - but you have to know how your EJB vendor's ClassLoader scheme works (there does appear to be a convergence in this area) and you must be very sensitive to potential thread-blocking operations that may take a while to complete.

  • How to get File Reference of a properties file from EJB

    Hi,
    I am using Sun App server 7 with Oracle 9i. I am keeping all my SQL statements in a properties file from which I am loading it while making a database operation from Stateless beans. My problem is I am not able to get the reference of the properties file. Here is the code through which I am getting the SQL statements loaded to a cache.
    String sqlFileName = "SQL.properties";
    sqlCache.load(new FileInputStream(sqlFileName));
    From the cache I am sending the SQL statement depending on the key value. But the problem is I have to keep the SQL.properties file on the App Server config directory of the instance where the server.xml file resides. Otherwise it is not able to find the properties file. But I don't want to put the properties file on the config directory of the server instance. Please help how to get the properties file from the packakge. My file is residing inside a package com.company.sql . Botht the properties file and the class accessing the file are residing in the same package. Please help how to get the reference of the file with out putting the file in the config directory.
    Thanks
    Amit Patnaik

    Just wanted to warn you of the hazards if you read a file from EJB
    So please make sure that these hazards will not affect your application. However the solution suggested to use getResourceStream() concurs with ejbSpec
    This snippet is from suns blueprint on ejb
    Why can't EJBs read and write files and directories in the filesystem? And why can't they access file descriptors?
    Enterprise beans aren't allowed to access files primarily because files are not transactional resources. Allowing EJBs to access files or directories in the filesystem, or to use file descriptors, would compromise component distributability, and would be a security hazard.
    Another reason is deployability. The EJB container can choose to place an enterprise bean in any JVM, on any machine in a cluster. Yet the contents of a filesystem are not part of a deployment, and are therefore outside of the EJB container's control. File systems, directories, files, and especially file descriptors tend to be machine-local resources. If an enterprise bean running in a JVM on a particular machine is using or holding an open file descriptor to a file in the filesystem, that enterprise bean cannot easily be moved from one JVM or machine to another, without losing its reference to the file.
    Furthermore, giving EJBs access to the filesystem is a security hazard, since the enterprise bean could potentially read and broadcast the contents of sensitive files, or even upload and overwrite the JVM runtime binary for malicious purposes.
    Files are not an appropriate mechanism for storing business data for use by components, because they tend to be unstructured, are not under the control of the server environment, and typically don't provide distributed transactional access or fine-grained locking. Business data is better managed using a persistence interface such as JDBC, whose implementations usually provide these benefits. Read-only data can, however, be stored in files in a deployment JAR, and accessed with the getResource() or getResourceAsStream() methods of java.lang.Class.
    Hope this info helps!

  • EJB - JAR or EAR file reloading - how to get it to work consistently.

    We are using wl 6.0 sp2 rp2 - with 2 WL instances on the same box.
    We have always seemed to have had this headache with WL - getting EJB's
    to reload consistently.
    Does anyone have a sequence of steps they follow to get good consistent
    reloading results from both an EJB in its own JAR or an EAR file?
    If we just copy the file over sometimes it seems to reload and sometimes
    not.
    If we try to use the console to "install an application" again sometimes
    it deploys the EJB's to the wrong server instance!
    Also is there anyway in the Weblogic deployment descriptor to specify
    which instance the EJB should be deployed against?
    Thanks
    Tom

    STARTMODE is only available in WLS 6.1 and not WLS 6.0.
    Deepak Vohra wrote:
    Tom
    Edit the startWeblogic Command Script.
    set STARTMODE=false
    Deepak
    Tom Gerber wrote:
    Is STARTMODE available in 6.0??? I thought that was new to 6.1.
    I'm running on NT so do I set this on the Java command line as a
    -DSTARTMODE=false or is it a regular environment variable?
    Tom
    Deepak Vohra wrote:
    Tom
    In startWebLogic script set STATRTMODE=false
    STARTMODE=false starts server in development mode.
    Deepak
    Tom Gerber wrote:
    We are using wl 6.0 sp2 rp2 - with 2 WL instances on the same box.
    We have always seemed to have had this headache with WL - getting EJB's
    to reload consistently.
    Does anyone have a sequence of steps they follow to get good consistent
    reloading results from both an EJB in its own JAR or an EAR file?
    If we just copy the file over sometimes it seems to reload and sometimes
    not.
    If we try to use the console to "install an application" again sometimes
    it deploys the EJB's to the wrong server instance!
    Also is there anyway in the Weblogic deployment descriptor to specify
    which instance the EJB should be deployed against?
    Thanks
    Tom
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • How to get current connection from ejb container

    We have to execute sql statement directly to the database and will use for this issue to connection establish between the ejb container and the database.
    How to get the corresponding object ?

    thanks

  • How do you get LOCAL_ADDR environment variable from weblogic?

    How can you access environment variables, such as LOCAL_ADDR? The request object does not expose methods to get at all the environment variables? I need to know which NIC Card the request is coming off of, which the LOCAL_ADDR will tell me.

    Some variables you can?t get this way.
    I made shellscript that just looked like this.
    set > /yourdir/yourfile.txt
    Then in my class I did Runtime.exec(shellxcript);
    then you just read in "/yourdir/yourfile.txt" as Resource and load it in
    a Property object.
    After that you can get variables to.

  • How to get info from weblogic-ejb-jar.xml? (MDB)

    I'm writing an MDB which is part of a request/reply. In order to reply, I
    need an initial-context-factory and provider-url. Is it possible to get
    this information using the MessageDrivenDescriptorMBean class? I can see
    that MessageDrivenDescriptorMBean has getConnectionFactoryJNDIName() and
    getProviderURL() which should be what I want, but I have no idea how to get
    an instance of MessageDrivenDescriptorMBean. Can I do that in the
    setMessageDrivenContext method of my MDB?
    If not, I can put that information in the env, but I'd rather not do that as
    it is redundant information.
    Thanks.
    Eric

    Forgot... WL6.1.
    "Eric F" <[email protected]> wrote in message
    news:[email protected]..
    I'm writing an MDB which is part of a request/reply. In order to reply, I
    need an initial-context-factory and provider-url. Is it possible to get
    this information using the MessageDrivenDescriptorMBean class? I can see
    that MessageDrivenDescriptorMBean has getConnectionFactoryJNDIName() and
    getProviderURL() which should be what I want, but I have no idea how toget
    an instance of MessageDrivenDescriptorMBean. Can I do that in the
    setMessageDrivenContext method of my MDB?
    If not, I can put that information in the env, but I'd rather not do thatas
    it is redundant information.
    Thanks.
    Eric

  • 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

  • How to get JNDI context on Sun AS8.1? Please help!

    I am using NetBean4.1 with AS8.1.
    I want to write a client application to retrieve a ejb remotely on the AS8.1 server.
    Does anyone know how to get the JNDI initial context?
    If my Sun AS8.1 server is located at ip 218.100.100.100,
    what is the url needed to create a JNDI initial context?
    Also, the ejb my client app going to retreive contains the following class
    CustomerBean.class
    CustomerRemote.class
    CustomerRemoteHome.class
    CustomerRemoteBusiness.class
    when compiling the client app, do I only need CustomerRemoteHome.class?
    or do I need any other class file to compile(stub or whatever)?
    Thank you very much!!

    RTFM
    Using a Stand-Alone Client to Access an EJB Component
    To access an EJB component from a stand-alone client, perform the following steps:
    1. In your client code, instantiate the InitialContext:
    InitialContext ctx = new InitialContext();
    It is not necessary to explicitly instantiate a naming context that points to the CosNaming service.
    2. In the client code, look up the home object by specifying the JNDI name of the home object. For example:
    Object ref = ctx.lookup("jndi-name");
    BeanAHome = (BeanAHome)PortableRemoteObject.narrow(ref,BeanAHome.class);
    For more information about naming and lookups, see �Accessing the Naming Context� on page 239.
    3. Deploy the EJB component to be accessed. For more information on deployment, see �Tools for Deployment� on page 88.
    4. Copy the following JAR files to the client machine and include them in the classpath on the client side:
    * appserv-rt.jar - available at install_dir/lib
    * j2ee.jar - available at install_dir/lib
    5. To access EJB components that are residing in a remote system, set the values for the Java Virtual Machine startup options:
    jvmarg value = "-Dorg.omg.CORBA.ORBInitialHost=${ORBhost}"
    jvmarg value = "-Dorg.omg.CORBA.ORBInitialPort=${ORBport}"
    Here ORBhost is the Application Server hostname and ORBport is the ORB port number (default is 3700).
    This information can be obtained from the domain.xml file on the remote system. For more information on domain.xml file, see the Sun Java System Application Server Administration Reference.
    6. Run the stand-alone client. As long as the client environment is set appropriately and the JVM is compatible, you merely need to run the main class.

  • How to get Hibernate 3.2.5 running on OracleAS 10.1.3.1 / OC4J 10.1.3.2

    Hi all,
    I have installed the OracleAS 10.1.3.0 patched to OracleAS 10.1.3.1/OC4J 10.1.3.2.
    I am trying to get Hibernate 3.2.5 with Hibernate EntityManager 3.3.1 running on the server, but I am not able to succeed.
    I want to provide Hibernate as a shared lib, because I´ll have several applications using it. Actualyl I´ll have many EJB-JAR deployed, that will use Hibernate as the underlying implementation of EJB3.0/JPA specification.
    I tried to copy the Hibernate JARs to home/applib directory and also register Hibernate as a shared lib through EM, but both failed when I deployed my application.
    I am trying to deploy my EJB-JAR in two different manners:
    1) Via EM, deploying the EJB-JAR file and checking Hibernate lib as dependency
    2) Copying the EJB-JAR file into home/applications directory and add ejb-module tag to application.xml
    Both fail.
    How can get Hibernate for JPA running on OracleAS 10.1.3.1 / OC4J 10.1.3.2, in order to make it available for many differente application modules (ejb-jars) ?
    Note: I prefer deploying EJB-JAR directly into home/applications in order the have the classes shared over for all application, so they can communicate to each other. Instead of deploying my ejb-jar within EARs and making each module isolated from each other.
    Thanks

    Check Debu's blog for this:
    http://debupanda.blogspot.com/2007/01/using-hibernate-as-pluggable-ejb-3-jpa.html
    --olaf                                                                                                                                                                                                                                               

  • How to get the UserTransaction object in  stateless session bean

    Hi, I am using jboss server and jdk5 version and using EJB.
    My Application flow :
    JSP à Action(Struts) à Service Locator à Session bean à Entity Bean(cmp) à DB.
    I tried to get the UserTransaction object in my Action. Its my code.
    InitialContext ctx = new InitialContext();
    UserTransaction uTrans = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    After used uTrans.begin(),uTrans.commit() and uTrans. rollback () also.
    Its working fine .
    But, I used the the same code inside in my session bean its not working.
    Stateless Session Manager Bean code :
    public class SampleManagerBean implements SessionBean {
    public void ejbCreate() throws CreateException {  }
    public void ejbRemove() {  }
    public void ejbActivate() {   }
    public void ejbPassivate() {   }
    public void setSessionContext(SessionContext sessionContext) {
    this.sessionContext = sessionContext;
         public void createSample() throws EJBException
         try{
                   InitialContext ctx = new InitialContext();
                   UserTransaction ut = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
              }catch(Exception e) {
              System.out.println(“ Exception === > “+e)
    Its throws the error ie: javax.naming.NameNotFoundException: UserTransaction not bound
    How to get the UserTransaction object in my session bean. Kindly give solution the above errors.
    - Thendral

    first of all, you could just use sessionContext.getUserTransaction(). however, that would only work if your bean is using bean-managed transactions. the default is container-managed transaction, in which case you cannot get a UserTransaction object. if you want to manage transactions, you need to add the TransactionManagementType.BEAN annotation to your ejb.

  • How can I use environment variables in a controller?

    Hi all,
    How can I use environment variables in a controller?
    I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
    Is there a method somewhere that would resolve this??
    By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
    The following is the code.
    My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
    Can anyone help me on this?
    private String getURL()
    throws IOException
    File locC = null;
    File remC = new File(mPath);
    String lurl = null;
    CpUtil lUtil = new CpUtil();
    String exten;
    Connection lConn = mCtx.getJDBCConnection();
    ErrorStack lES = mCtx.getErrorStack();
    LogFile lLF = mCtx.getLogFile();
    String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
    String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
    String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
    // create temp file
    mLPath = lUtil.createTempFile("OF", exten, tmpDir);
    lUtil.logTempFile(mLPath, mLNode, mCtx);
    Thanks,
    binghao

    However within OAF on the application it doesn't.
    what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
    No, it is read from the adovars.env file only.Thanks
    Tapash

  • How to get EBS Concurrent Request number (and more) into BIP Report Layout

    hi,
    I have been using BIP for 9 months but have several years experience of Reports 6i development (matrix, drill-thru etc). We are beginning to use BI Publisher with EBS and would like to be able to incorporate the Concurrent Request number into the report layout (preferably in the footer area). I have looked back over previous forum posts and have found mention of how to get the report parameters into the XML datastream and template, but nothing for the Concurrent Request number. I've also looked at the DevTools/Reports forum but cannot see anything similar there.
    It would add a lot of value to generated output for end-users if this information (+ environment/instance name etc) can be put into the layout.
    Sean

    Hi
    Create a data query in data template/reports as
    select fnd_global.conc_request_id "REQUEST_ID" from dual
    and this will pick up the request id and then u can use it in the RTF layout
    Hope this helps..

Maybe you are looking for

  • Flash site not refreshing

    Hi all, I have got a flash site running and have recently run into some browser issue with Firefox. Firefox doesn't seem to reflect the new swf files that I have replaced with the old on the server. I have already tried clearing the cache but to no a

  • Can "Actual PPI" and "Effective PPI" be extracted from InDesign?

    A script that I may require, needs to reach inside InDesign and extract the Actual PPI and Effective PPI from certain images, and then process the images in Photoshop. Are those variables available to scripts?

  • How to create a standby redolog from rac to non rac ??

    Hi, How to create a standby redolog from rac to non rac DR setup..??? in rac we can create with specifying thread number for each instances..... but this will be replicating to standby ....so how this will act/create on single DR?? pls help

  • How to Get the step name of MainSequence from SequenceFilePreStep / SequenceFilePostStep?

    I'm using SequenceFilePreStep & SequenceFilePostStep to get the test time of every step. Is there any way to get the step name of MainSequence that calls the PreStep & PostStep callbacks? Thanks

  • In which tables are batch input error messages logged?

    does anybody know in which table are the batch input error messages logged? I have to display the error messages which have occured during the transaction I tried to find out, but i could see only the table BDCMSGCOLL, this table has only the Batch i