Lookup ejb in another application in same container

Hi,
The 1012 ejb faq http://www.oracle.com/technology/tech/java/oc4j/1012/collateral/OC4J-EJB-FAQ-101202.pdf states:
"If you want to access an EJB in another application in the same OC4J container you do not have to use RMIInitialContextFactory and you can make the application that contains your application as the parent of your application from your you are trying to access EJBs from e.g. ..."
Question: The FAQ implies that the "parent" attribute is NOT necessary to facilitate this situation and RMIInitialContextFactory may be used - is this correct? I have not found any examples that demonstrate how to do this as elsewhere in the Oracle doco they seem to imply that "parent" must be used (but not in 10.1.3). Can anyone please clarify this and/or what works and what doesn't?
Note: The lookup of remote ejb from another application in same container does work without the parent attribute, its just subsequent calls from a 3rd application or redeploy breaks.
My problem: I get a ClassCastException when :
a) lookup remote EJB (in application A) following redeploy of application B
b) the next invocation of the application A method from client application C
Thanks for any advice,
Paul

Your understanding is correct.
If you make application a to be the parent application of app b; then app b could access app a without using RMIInitialContext.
Also you could use RMIInitialContext to obtain the object without using "parent application" approach, example:
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial",
"com.evermind.server.rmi.RMIInitialContextFactory");
env.put("java.naming.provider.url","ormi://remotehost/bmpapp");
env.put("java.naming.security.principal","SCOTT");
env.put("java.naming.security.credentials","TIGER");
Context context = new InitialContext(env);
Object homeObject =
context.lookup("java:comp/env/EmployeeBean");
For this servlet example, you also need to declare <ejb-ref> elements in the web.xml file:
<ejb-ref>
<ejb-ref-name>EmployeeBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>bmpapp.EmployeeHome</home>
<remote>bmpapp.Employee</remote>
</ejb-ref>
In addition, orion-web.xml, must include a mapping from the logical name EmployeeBean to the actual JNDI name where the EJB is bound, as shown in the following example:
<ejb-ref-mapping name="EmployeeBean" location="bmpapp/EmployeeBean" />
Hope this helps,
-Frances

Similar Messages

  • Unable to open forms when Launching another application on same browser.

    Hi,
    I have a server with configuration Oracle EBS 12.1.1 on RHEL 5.5, Database 11.1.0.7. On client machine we use Internet explorer, Firefox and Chrome to access the EBS and forms.
    We are able to open the forms from all browsers, but problem arise when we access another application on same browser, resulting in not opening of oracle forms.
    This is a java application using the same database on the server. This application works fine but Our Oracle Forms has to face the problems.
    When we try to launch the forms, it results in FRM-92101 error. I read the MOS documents for
    R12: "FRM-92101:There was a failure in the Forms Server during startup" Error When Attempting to Launch Forms [ID 454427.1]
    Then I checked the application log file, it says that:
    13/08/12 18:47:41.891 formsweb: Forms session <207> failed during startup: no response from runtime process
    13/08/12 18:50:43.704 formsweb: Forms session <209> aborted: runtime process failed during startup with errors
    Unable to switch to Working Directory: /oracle/TEST/apps/tech_st/10.1.3/forms
    When I further investigate I found there is no such "forms" directory under "/oracle/TEST/apps/tech_st/10.1.3".
    Then I read Oracle Notes:
    FRM-92101 : Unable To Switch To Working Directory. (Doc ID 1434888.1)
    FRM-92101 Error in Application.log: Unable to Switch to Working Directory (Doc ID 432708.1)
    But no luck with all these. Please suggest something. Can't open both application simultaneously on same browser.
    Regards,
    Prashant Namdeo

    Hi,
    Please state whether the application was working fine before.
    Please provide log file  of:
    --$LOG_HOMEora/10.1.3/j2ee/forms/forms_default_group_1/application.log
    --DB alert logfile --check whether you can find any valuable information.
    Please have a look at the following MOS notes:
    FRM-92050 java.lang.UnsatisfiedLinkError: no frmjsl in java.library.path [ID 438522.1]
    Troubleshooting FRM-92XXX Errors in Oracle Applications [ID 365529.1]
    And have a look at:
    http://oracleared.blogspot.com/2012/11/frm-92191-there-was-failure-in-form.html
    Best Regards,

  • Monitoring EJB from another application

    Hi!
    Let's say: We have some EJB deployed of Application Server. Each EJB (doesn't metter if session or entity) has its methods that can be called. (All EJB are in the same application)
    Can I from another application see what methods has been called and at what time? I can extend monitored application with its log files, but want to use application to be monitored as is.
    I guess it depends on Application Server functionality. I would like to do it on SUN reference implementation (from J2EE SDK). If there is another App Server (the best free one) please note.
    I would be very thankfull for any answer.
    Marcin

    You could use the opensource EJB-container JBOSS and modify the source to perform logging of when a particular method was called etc.
    This will enable you to run the application as is with no modifications.
    Morten.

  • Can not lookup EJB from another EAR file, the ClassCastException returned

    Hi,
         I try to call EJB module in A.ear from Servlet in another EAR file(B.ear) the ClassCastException returned on the context.lookup() code . So when i create a Dynamic Web Project(With the same code as Servlet in B.ear) and pack it in A.ear(The same EAR file with EJB module), it work fine. I have no idea. Could you please suggest me.
    The ClassCastException : incompatible with interface ..... return on
    HelloManBeanLocalHome home=(HelloManBeanLocalHome) ctx.lookup("localejbs/sap.com/HelloMan_EAR/HelloManBean");
    The entire code is below :
              try {               
                   InitialContext ctx=new InitialContext();
                   HelloManBeanLocalHome home=(HelloManBeanLocalHome) ctx.lookup("localejbs/sap.com/HelloMan_EAR/HelloManBean");
                   HelloManBeanLocal remote=home.create();
                   lookupText=remote.helloMan("Test");
              } catch (Exception e) {
                   // TODO: handle exception
                   e.printStackTrace(out);
    Many Thanks

    Hi Saleem Mohammad.
               Thank a lot for your post. I got this idea from your link. The below code work fine.
              try {               
                   InitialContext ctx=new InitialContext();
                   Object obj= ctx.lookup("localejbs/sap.com/HelloMan_EAR/HelloManBean");
                    ClassLoader homeCl = obj.getClass().getClassLoader();
                    Class<?> localHome = homeCl.loadClass(HelloManBeanLocalHome.class.getCanonicalName());
                    java.lang.reflect.Method method = localHome.getMethod("create");               
                    Object homeObj = (Object)method.invoke(obj);
                    ClassLoader localCl=homeObj.getClass().getClassLoader();
                    Class<?> local = localCl.loadClass(HelloManBeanLocal.class.getCanonicalName());
                    Class  args[] = {String.class};
                    java.lang.reflect.Method localMethod=local.getMethod("helloMan",args);               
                    Object params[]={"Thongie"};
                    Object localObj = (Object)localMethod.invoke(homeObj,params);
                    lookupText=(String)localObj;               
              } catch (Exception e) {
                   // TODO: handle exception
                   e.printStackTrace(out);

  • Using apex url to link to a page in another application

    hi all.
    i have 5 applications based on same schema in a single workspace. now i intent to have a single page with 5 button from where i will call all those 5 applications' home pages.
    i used following syntax for URL Target on a button to check it but it didnt work.
              f?p=102:101:&APP_SESSION.
      i can very easily to a page in same application (offcourse) but i want to ask that can we link to a page which is in another application in same workspace
    bundles of thanks in advance.

    Check out this link
    http://apps2fusion.com/at/64-kr/413-maintaining-authentication-between-apex-applications

  • EJB accessing web application classes

    Hi,
    what is the right method to enable packaged EJB to access classes of a
    web application? Packaging both the EJB and web application in same
    ear is not possible in this situation. We are running WebLogic 6.0 and
    ejb is in
    wlserver6.0/config/mydomain/applications/EJB.jar
    and the classes it should use are in
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes,
    i.e. not packed into war -package. adding
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes
    to WebLogic's CLASSPATH enables the ejb to deploy but seems to screw
    other deployments.

    Please address calling and EJB from a JSP using the EJB to JSP tags...?I'm throwing
    ClassCast errros on Object...
    William Kemp <[email protected]> wrote:
    This is addressed numerous times in this newsgroup and others. So, if
    you are
    insterested in additional explanations, a search of the newsgroups will
    be
    productive.
    The WLS 6.x classloading scheme for enterprise apps, ejbs, and webapps
    does
    not permit and ejb to access webapp classes in the WEB-INF/classes directory
    unless those classes are placed in the java system classpath, which,
    you have
    found, creates other problems.
    If classes are needed by both webapp and ejb, place them in a utility
    jar file
    that is packaged in the ear with the ejb, or webapp, or both, and refer
    to
    them with the Class-Path manifest directive in the ejb jar file or the
    webapp
    war file.
    For the details, see:
    http://e-docs.bea.com/wls/docs61/programming/packaging.html#1029830
    and the 7.0 stuff is good, too:
    http://edocs.bea.com/wls/docs70/programming/classloading.html#1029830
    Bill
    janne wrote:
    Hi,
    what is the right method to enable packaged EJB to access classes ofa
    web application? Packaging both the EJB and web application in same
    ear is not possible in this situation. We are running WebLogic 6.0and
    ejb is in
    wlserver6.0/config/mydomain/applications/EJB.jar
    and the classes it should use are in
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes,
    i.e. not packed into war -package. adding
    wlserver6.0/config/mydomain/applications/application_name/WEB-INF/classes
    to WebLogic's CLASSPATH enables the ejb to deploy but seems to screw
    other deployments.

  • JMS message from one application to the another appl in the same container?

    I have a question.
    Can I send JMS message from one application to the another application in the same container?
    If yes ...can you provide me info.
    I want to know in regards of EJB2.0 and EJB3.0.
    Thanks,
    Rahul

    So the receiver application is a Message Driven Bean, right?
    In your container, do you have a mean to ensure that it is correctly configured to listen the desired destination? Like an administrative console that would show the destinations, the number of pending messages, the number of active consummers...?
    btw what is the destination type? A queue or a topic?

  • When I try to eject my ipod after sync I get the following message:"The iPod cannot be restored because it contains files that are in use by another application.". I tried to restore but it doesn't work and I get the same message

    When I try to eject my ipod after sync I get the following message:The iPod cannot be restored because it contains files that are in use by another application.". I tried to restore but it doesn't work and I get the same message

    Go to your computer's System Tray and try ejecting.  If you can't eject, there is an application that is trying to access your iPod.
    Go to http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx and download ProcessExplorer.
    Go to http://support.microsoft.com/kb/555665 and follow the instructions under Resolution.
    Note that this is a good, general process any time you can't access any file.
    In my case an update to RealPlayer installed a program called RecordingManager that was accessing my iPod.

  • Same container, different ear files, remote lookup failing!

    I'm having severe problems with my ears! I used to have all my EJBs in one ear file and everything worked hunky dory. Now I have separated out various components into their own ear files as they may be deployed into a separate box and also this eases group development. My problem is that some (most) of the remote lookups don't work. I'm getting a Class cast exception when i use the narrow() method.
    I have tried all the methods I can think of now and I'm getting desperate! Initially when all the beans were in the same ear file I used the coded reference for the lookup. This did not work across separate ear files so I replaces the coded reference in the lookup() method to the JNDI name. Now this works for some lookups but not others. Invariably a client application running in the container in a separate ear will work no problem. However a session bean using the same code as the client can not succeed in referencing another bean.
    I'm baffled here because the lookup itself appears to succeed (if I but a garbage name in the lookup method it returns "name not found"). The error I'm getting is class cast exception! Occasionally though it does work - by that I mean it works for some inter-ear references but not others ie it's not intermittant.
    Can anyone shed some light on the correct/best method to lookup a remote reference to a EJB from an EJB living in a different ear file in the same container?

    Found the problem!
    I was using jdk 1.3.0_02 when I should have been using
    jdk 1.3.1_01
    painful...

  • In a single program how to lookup different EJB from different application

    Hi,
    I have deployed two applications app1 and app2 on oc4j.
    There is a stateless session bean in a1 called ejb1.
    And there is also a stateless session bean ejb2 in app2.
    I write a test jsp in app1 to lookup ejb1 and ejb2 as an application client. So I need to create an application-client.xml for it.
    <?xml version="1.0"?>
    <!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN" "http://java.sun.com/j2ee/dtds/application-client_1_2.dtd">
    <application-client>
    <display-name>ejbs</display-name>
    <ejb-ref>
    <ejb-ref-name>ejb1</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>class_of_ejb1Home</home>
    <remote>class_of_ejb1</remote>
    </ejb-ref>
    <ejb-ref>
    <ejb-ref-name>ejb2</ejb-ref-name>
    <ejb-ref-type>ejb2</ejb-ref-type>
    <home>class_of_ejb2Home</home>
    <remote>class_of_ejb2</remote>
    </ejb-ref>
    </application-client>
    However, When I run the test.jsp, It will report following error:
    javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'class_of_ejb2' found for the ejb-ref ejb2
    In fact, if I only lookup any of the ejb and the application-client.xml just specify only the according ejb-ref, everything is alright.
    But how to construct the application-client.xml so that it can suitable for 2 different ejb in different application? Do I miss something in doing it?
    Kindly advice!
    Queeny Tang

    Hi Debabrata Panda,
    I did add parent in web.xml, but it still encounter
    "Error reading application-client descriptor: No location specified and no suitable instance of the type 'class_of_ejb2' found for the ejb-ref ejb2"
    In my program, a jsp in app2 will lookup ejb1 of app1. In the same way, a jsp in app1 will lookup ejb2 of app2.
    if I declare in server.xml
    <application name="app2" path="../applications/app2.ear" parent="app1" auto-start="true" />
    <application name="app1" path="../applications/app1.ear" parent="app2" auto-start="true" />
    That will cause error reading application-client.xml for all
    ejbs.
    How to solve this.
    Thanks in advance!
    Yours Queeny

  • Cannot be updated because it contains files in use by another application

    I have spent hours looking for a solution to this problem after updating itunes to version 7.0.1.8 I was unable to update my ipod nano to version 1.2, came up with box stating cannot update ipod because it contains files that are in use by another application. Also could not eject ipod from itunes as it came up with same error, only way to disconnect was to 'safetly remove hardward' from notification area. After searching various sites I found a solution that worked Ist time and very easy.
    Look in the notification area at the bottom right of your screen, right click and remove/close any applications that might be using files, I closed OpenMG Jukebox, as soon as I had, my ipod could be updated in itunes and it could be ejected from itunes. I have now removed the OpenMG Jukebox from my system as I didn't use it anyway. Hope this helps others
      Windows XP  

    Look in the notification area at the bottom right of your screen, right click and remove/close any applications that might be using files, I closed OpenMG Jukebox, as soon as I had, my ipod could be updated in itunes and it could be ejected from itunes. I have now removed the OpenMG Jukebox from my system as I didn't use it anyway. Hope this helps others

  • How to access same ejb from different applications

    Hi
    I have two applications (.ear). Each application has 4 EJBs. These EJBs are same in both applications including their names. JNDI names are also same in each application.
    in detail
    ApplicationA (appA.ear) contains
    web1.war
    ejb1.jar
    ejb2.jar
    ejb3.jar
    ejb4.jar
    and
    ApplicationB (appB.ear) contains
    web2.war
    ejb1.jar
    ejb2.jar
    ejb3.jar
    ejb4.jar
    both web1.war and web2.war has same JNDI references to these EJBs.
    The problem:
    If you access the applicationA, works fine. But if you access applicationB, it throws ClassCast Exception
    After restarting.....
    If you access the applicationB, works fine. But if you access applicationA, it throws ClassCast Exception
    Both the applications are not working same time.
    I suspect that It is because both applications have same ejbs and with same JNDI names.
    Please validate.
    Thanks
    Srinivas

    Hi Timo,
    Very sorry for reply so late!
    My case is that accessing a task flow(MaintainJobInstanceTaskFlow) through NevigationBean of UI Shell. please see the coding as following:
    taskFlowId_SubNavigation =
    "/WEB-INF/oracle/apps/pas/shell/ui/flow/SystemSetupTabFlow.xml#SystemSetupTabFlow";
    taskFlowId_TaskListNavigation =
    "/WEB-INF/oracle/apps/pas/shell/ui/flow/SystemSetupTaskListFlow.xml#SystemSetupTaskListFlow";
    taskFlowId_QuickSearch =
    "/WEB-INF/oracle/apps/pas/shell/ui/flow/SystemSetupQuickSearchFlow.xml#SystemSetupQuickSearchFlow";
    taskFlowId_LocalArea =
    "/WEB-INF/oracle/apps/pas/transactions/ui/flow/MaintainJobInstanceTaskFlow.xml#MaintainJobInstanceTaskFlow";
    break;
    In my case, how to transfer parameters to MaintainJobInstanceTaskFlow in java?
    Thanks!
    Susan

  • How to lookup EJBs deployed in OC4J from a standalone client application

    Hello all,
    I am trying to lookup an EJB deployed in OC4J 10.1.3 from a standalone client application using the following code:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791");
    env.put(Context.SECURITY_PRINCIPAL, "jazn.com/test");
    env.put(Context.SECURITY_CREDENTIALS, "test");
    Context context = new InitialContext(env);
    Object ref = context.lookup("ejb/Dispatch");
    I get the following error:
    javax.naming.NameNotFoundException: ejb/Dispatch not found
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
    For the lookup string I've also tried:
    "java:comp/env/ejb/Dispatch" and "Dispatch"
    For the Context.PROVIDER_URL property I've also tried:
    opmn:ormi://localhost:6003:instance
    The result is always the same.
    I appreciate if someone could help me with this?
    Thanks,
    Georgi

    Georgi,
    Your question has been discussed many times on this forum. Search the forum archives for "RMIInitialContextFactory".
    The PROVIDER_URL needs to include the name of the deployed application that your EJB is part of, for example:
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791/MyApp");The lookup name has to be the value of the "ejb-name" element in your "ejb-jar.xml" descriptor file.
    Your SECURITY_PRINCIPAL value looks strange to me. Personally, I use "principals" (and not JAZN), so I modified the "application.xml" file (in the "j2ee/home/config" subdirectory) to use "principals". Look for the following comment in that file:
    &lt;!-- Comment out the jazn element to use principals.
          When both jazn and principals are present jazn is used  --&gt;Good Luck,
    Avi.
    Message was edited by:
    Avi Abrami

  • Trying to eject my ipod from my PC after syncing b4 disconnecting but a msg pops up saying "ipod cannot be ejected becuz it contains files that are in use by another application

    Trying to eject my ipod nano from my PC after syncing complete b4 disconnecting but a message keeps popping up "ipod cannot be ejected becuz it contains files that are in use by another application ?

    Hi, arthur260, I presume you've solved this by now, but I came across this post looking for the same solution for my ipod nano. In my case the problem was that I had the box checked to "Enable disk use" under the options for the ipod. It immediately solved the problem when I unchecked this.

  • EJB to EJB Performance in same container

    I'm very new to this technology so please excuse me if my question is naive.
    Is RMI used between two EJB's that are located within the same container? If so, how significant is the performance overhead to do this?

    WebLogic by default only uses RMI (and thus serialization) when calling from
    one machine to another. You can force RMI to be used on one machine, but
    performance degrades significantly per method invocation (going from direct
    invocation to RMI invocation).
    Most web containers have to use RMI to talk to EJB containers. What I have
    described is a WebLogic-specific optimization that is a big selling point
    for them. Of course it is also the cause of the 5.1 classloader headaches,
    but they have repeatedly said that those will be fixed for the next release.
    Cameron Purdy
    "Scott Czadzeck" <[email protected]> wrote in message
    news:398f5714$[email protected]..
    I'm very new to this technology so please excuse me if my question isnaive.
    >
    Is RMI used between two EJB's that are located within the same container?If so, how significant is the performance overhead to do this?

Maybe you are looking for