Calling EJB from another EJB

I need to make a several calls to the methods inside EJB1 from EJB2. I was getting
the remote reference of the EJB2 inside the ejbCreate() of the EJB1, is it a good
practice ?? If not, do I need to get remote reference of the EJB2 every time I
need to call EJB2 method??
Thanks in advance.

To refer a Ejb from another Ejb include <ejb-ref> in ejb-jar.xml
<session>
<ejb-name>Ejb1</ejb-name>
<ejb-ref>
<ejb-ref-name>Ejb2</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.ejb.Ejb2Home</home>
<remote>com.ejb.Ejb2</remote>
</ejb-ref>
<session>
Include a <reference-discriptor> in weblogic-ejb-jar.xml
<weblogic-enterprise-bean>
<ejb-name>EjbSession</ejb-name>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>Ejb2</ejb-ref-name>
<jndi-name>com.ejb.Ejb2Home</jndi-name>
</ejb-reference-description>
</reference-descriptor>
</weblogic-enterprise-bean>
In Ejb1 bean class refer to Ejb2 method with a remote reference to Ejb2.
InitialContext initialContext = new InitialContext();
Ejb2Home ejb2Home = (Ejb2Home)initialContext.lookup("com.ejb.Ejb2Home");
Ejb2 ejb2 = ejb2Home.findByPrimaryKey();
Alex Pratt wrote:
I need to make a several calls to the methods inside EJB1 from EJB2. I was getting
the remote reference of the EJB2 inside the ejbCreate() of the EJB1, is it a good
practice ?? If not, do I need to get remote reference of the EJB2 every time I
need to call EJB2 method??
Thanks in advance.

Similar Messages

  • Error in calling an EJB from another EJB

    Hello All,
    I have a scenario where i need to call a method of an ejb from another ejb.
    Both the EJB's are in different DC's.
    EG: DC1 using DC2
    I have added the public part of DC2 in DC1.
    The following code is written in DC1 to access the EJB of DC2
          MyRemote l_remote;
           MyHome l_home;
           InitialContext l_ctx = new InitialContext();
    >>       l_home = (MyHome)l_ctx.lookup("JNDI Name");
           l_remote = (MyRemote)l_home.create();
    There is no error at build time and deploy time, but at run time "MyHome" class is not found.
    Even i am not able to access the helper class defined in the DC2 at runtime.
    Please help.
    Thanks in Advance

    First off, wrong forum section.
    Check if your JNDI name is correctly placed for the bean you're calling -- check j2ee-engine.xml for that. Check the EJB container if the ear file you deployed is there and updated.
    Try placing  "localejbs/JNDI name" on your lookup parameter.
    Regards,
    Jan

  • How tom invoke an EJB from another EJB using the sun rmi protocl in Weblogi

    Hi,
    I am particularly new to EJB.
    My scenario is
    client invoking-->EJB-----invoking ----(Either a webService or an EJB)
    in WEBLOGIC
    Is it possible that a call from EJB to another EJB or WebService use Sun's RMI as underlying protocol instead of t3 or IIOP which are used in Weblogic ?
    Would be really a great help if you could provide me some sample on it on weblogic.

    Hi Stefan,
    You don't need to provide the InitialContextFactory for running a standalone client. The following should work just fine:
    Context initial = new InitialContext();
    System.out.println("Looking up ...");
    Object objref = initial.lookup(EJB);  //the lookup name should be a global JNDI name      //and not from the java:comp namespace
    System.out.println("Looked up EJB");The JNDI implementation looks for the jndi.properties file in your classpath. So make sure that you have the appserv-rt.jar from your <server_installation>/lib directory in your classpath.
    HTH,
    Sheetal

  • HELP!!! How I can call to EJB from another EJB??

    I have two EJBs, for each EJB I have a jar, how I can call to EJB jar to another???
    I have tried the following, in the first EJB I have import the second EJB jar and call it with context, lookup, PortableRemoteObject etc.. but the instruction lookup not find the second EJB reference.
    The name in the lookup instruction is the JNDI name of the second EJB but not find a reference to it.
    Please help me!!! Thanks!!
    The error is:
    javax.naming.NameNotFoundException: Missing node. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:34)
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.extract(NotFoundHelper.java:50)
         at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:161)
         at com.inprise.j2ee.jndi.java.CorbaContext.resolveName(CorbaContext.java:242)
         at com.inprise.j2ee.jndi.java.CorbaContext.lookup(CorbaContext.java:261)
         at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:483)
         at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
         at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
         at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:937)
         at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:942)
         at javax.naming.InitialContext.lookup(InitialContext.java:350)
         at ejbclient.EnterpriseClientBean.addition(EnterpriseClientBean.java:115)
         at ejbclient.EnterpriseClientBean.actionPerformed(EnterpriseClientBean.java:97)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
         at avax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstr

    ok.. Here it goes.. I am writing a sample code..
    public class EJB1LogBean implements SessionBean {
    // test is a method of stateless session beam
    public void test ( TestVal val )
    throws RemoteException{
    try {
    EJB2LogHome ejb2Home= (EJB2LogHome)getHome("java:comp/env/ejb/EJB2LogHome",1);
    EJB2Log ejb2Log = ejb2LogHome.create ( val );
    } catch ( CreateException e ) {
         System.out.println("Create Exception occurred ");
         e.printStackTrace();
         } catch ( RemoteException e ) {
         System.out.println( "RemoteException Occured");
    e.printStackTrace();
         throw new RemoteException () ;
         } catch(Exception ee) {
    ee.printStackTrace();
    private EJBHome getHome(String jndiName,int type) {
    try {
    Context context = new InitialContext();
    Object ref = context.lookup( jndiName );
    switch(type)
    case 1:
    EJB2LogHome ejb2LogHome = ( EJB2LogHome )
    PortableRemoteObject.narrow( ref, EJB2LogHome.class );
    return ejb2LogHome;
    } catch ( Exception e ) {
    e.printStackTrace();
    return null;
    }//EJB1LogBean ends
    Here as you can see, EJB1LogBean(session bean) is calling a second EJB, EJB2LogBean (entity bean). TestVal is a sample value object passed. It is plain java class and can vary from app to app and it has got nothing to do with ejbs.
    "java:comp/env/ejb" is a J2EE standard and while getting a home interface, you have to append the home interface class name to "java:comp/env/ejb". Here I am passing "java:comp/env/ejb/EJB2LogHome" and "1" to getHome method, whose job is to get a reference to a home interface. getHome method is a local method. "1" is passed just to give a flexibility to getHome method as you can have more ejbs to invoked. In that case, you can go on adding different case statements for 2, 3 etc.
    The only thing you have to keep in mind is that your deployment descriptor for EJB1LogBean will contain the entires for both the beans i.e. for EJB1LogBean and EJB2LogBean. This is because EJB2LogBean is wrapped by EJB1LogBean.
    Hope this helps.
    Please let me know if you need anything more.
    - Amit

  • How to call an EJB from another EJB

    Hi
    I have a problem here. I need to execute a second EJB which has to get the input from the first EJB as data for execution. So when I call the first EJB, the first EJB should give the data to the second EJB and execute it and provide the result.
    Cheers,
    Raj

    ok.. Here it goes.. I am writing a sample code..
    public class EJB1LogBean implements SessionBean {
    // test is a method of stateless session beam
    public void test ( TestVal val )
    throws RemoteException{
    try {
    EJB2LogHome ejb2Home= (EJB2LogHome)getHome("java:comp/env/ejb/EJB2LogHome",1);
    EJB2Log ejb2Log = ejb2LogHome.create ( val );
    } catch ( CreateException e ) {
         System.out.println("Create Exception occurred ");
         e.printStackTrace();
         } catch ( RemoteException e ) {
         System.out.println( "RemoteException Occured");
    e.printStackTrace();
         throw new RemoteException () ;
         } catch(Exception ee) {
    ee.printStackTrace();
    private EJBHome getHome(String jndiName,int type) {
    try {
    Context context = new InitialContext();
    Object ref = context.lookup( jndiName );
    switch(type)
    case 1:
    EJB2LogHome ejb2LogHome = ( EJB2LogHome )
    PortableRemoteObject.narrow( ref, EJB2LogHome.class );
    return ejb2LogHome;
    } catch ( Exception e ) {
    e.printStackTrace();
    return null;
    }//EJB1LogBean ends
    Here as you can see, EJB1LogBean(session bean) is calling a second EJB, EJB2LogBean (entity bean). TestVal is a sample value object passed. It is plain java class and can vary from app to app and it has got nothing to do with ejbs.
    "java:comp/env/ejb" is a J2EE standard and while getting a home interface, you have to append the home interface class name to "java:comp/env/ejb". Here I am passing "java:comp/env/ejb/EJB2LogHome" and "1" to getHome method, whose job is to get a reference to a home interface. getHome method is a local method. "1" is passed just to give a flexibility to getHome method as you can have more ejbs to invoked. In that case, you can go on adding different case statements for 2, 3 etc.
    The only thing you have to keep in mind is that your deployment descriptor for EJB1LogBean will contain the entires for both the beans i.e. for EJB1LogBean and EJB2LogBean. This is because EJB2LogBean is wrapped by EJB1LogBean.
    Hope this helps.
    Please let me know if you need anything more.
    - Amit

  • How to call one EJB in another EJB?

    How to call one EJB in another EJB? Please explain with some example code.

    To refer a Ejb from another Ejb include <ejb-ref> element in ejb-jar.xml
    <session>
    <ejb-name>EjbA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>EjbB</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>com.ejb.EjbBHome</home>
    <remote>com.ejb.EjbB</remote>
    </ejb-ref>
    </session>
    Include a <reference-descriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>EjbA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>EjbB</ejb-ref-name>
    <jndi-name>com.ejb.EjbBHome</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    In EjbA Bean class refer to EjbB with
    a remote reference to EjbB.
    InitialContext initialContext=new InitialContext();
    EjbBHome EjbBHome=(EjbBHome)
    initialContext.lookup("com.ejb.EjbBHome");
    EjbB ejbB=EjbBHome.findByPrimaryKey(primarykey);

  • Trouble in communicating with another EJB from an EJB

    I have created a stateless session bean, and inside this bean I have methods that calls methods in another stateless session bean (called myEJB, for example). When I run the code, it kept giving me the "noClassDefFoundError":
    java.rmi.RemoteException: Error in ejbCreate:; nested exception is:
         java.lang.NoClassDefFoundError: com.mybean.myEJBHome
    Someone suggested to me that this is because they aren't remote objects, so I created local interfaces for "myEJB". When I run the code again (by binding to the Local interface now), I got this error:
    javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: Unable to resolve
    'app/ejb/mybeans.jar#myEJB/local-home' Resolved: 'app/ejb/ Unresolved:'mybeans.jar#myEJB' ;
    remaining name 'mybeans.jar#myEJB/local-home']; Link Remaining Name:
    'java:app/ejb/mybeans.jar#myEJB/local-home'
    Any ideas??
    Thanks

    To refer a Ejb from another Ejb include <ejb-ref> in ejb-jar.xml
    <session>
    <ejb-name>EjbA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>Ejb2</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.ejb.Ejb2Home</home>
    <remote>com.ejb.Ejb2</remote>
    </ejb-ref>
    <session>
    Include a <reference-discriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>EjbA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>Ejb2</ejb-ref-name>
    <jndi-name>protocol://<Ejb2host>:<PortNumber>/com.ejb.Ejb2Home</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    Example <jndi-name>:http://localhost:7001/com.ejb.Ejb2Home
    In EjbA bean class refer to Ejb2 method with a reference to Ejb2 remote interface.
    InitialContext initialContext = new InitialContext();
    Ejb2Home ejb2Home = (Ejb2Home)initialContext.lookup("protocol://<Ejb2host>:<PortNumber>/com.ejb.Ejb2Home");

  • How to Call one EJB from another

    Hi all
    I am trying to call one EJB in one system from another EJB residing on diferent system...
    Both are Stateless session beans ...
    I can't use No-args Intialcontext() as i need to specify the Ip address of other system to be looked up.....
    So i am using properties Dorg.omg.CORBA.ORBInitlalHost....
    But its not looking up..Its telling not bound...But i called it from standalone client remotely...
    Am i wrong..?
    I hope I am in right path....
    I hope ill get reply as fast as possible...
    Gopal V

    Hi ken Thanks for replying....
    Ya i packed it as a jar (using Export tool in Eclipse3.2)....
    I am using SUN AS 9.....
    I packed bean1 and bean2 as two different jars in the same domain...
    Here is my code...
    Bean1:
    @Stateless(mappedName="ejb/Second")
    public class SecondIMPL implements SecondRemote {
         public FirstRemote obj;
         public String connect() {
              try{
                   InitialContext ctx= new InitialContext();
                   FirstRemote obj =(FirstRemote)ctx.lookup("ejb/First");
                   System.out.println("Client :"+obj.bMethod());
              }catch(Exception e){
                   e.printStackTrace();
              return "Check server Log";
    }Bean2 :
    @Stateless(mappedName="ejb/First")
    public class FirstIMPL implements FirstRemote {
         public String bMethod() {
              return "From First Bean";
    Client:
    public static void main(String[] args) {
              try{
                   InitialContext ctx= new InitialContext();
                   SecondRemote obj =(SecondRemote)ctx.lookup("ejb/Second");
                   System.out.println("Client :"+obj.connect());
              }catch(Exception e){
                   e.printStackTrace();
    Here is my Stack Trace...
    [#|2007-05-24T18:35:17.214+0530|WARNING|sun-appserver-pe9.0|javax.enterprise.system.stream.err|_ThreadID=18;_ThreadName=p: thread-pool-1; w: 19;_RequestID=bb4848e7-829a-421d-a560-93659898eb02;|
    javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.SecondRemote[Root exception is java.lang.ClassNotFoundException: com.SecondRemote]
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:350)
         at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:61)
         at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.FirstBean.rediff(FirstBean.java:16)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
         at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
         at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
         at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
         at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
         at $Proxy36.rediff(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
    Caused by: java.lang.ClassNotFoundException: com.Second
         at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:701)
         at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:614)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:568)
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:320)
         ... 31 more
    |#]

  • EJB lookup from another EJB server

    Hi people,
    I have two application servers on two different computers. One
    of them contains an EJB, which I need to access from another EJB
    server. I know that I can achieve this using RMI, but will then
    security and transaction contexts be propagated to the called
    EJB?
    Sincerely,
    Sergei Batiuk.

    Here is the solution posted on another forum:
    [email protected] Dec 8, 6:03 am show options
    Newsgroups: ibm.software.websphere.studio
    From: [email protected]
    Date: 8 Dec 2004 06:03:04 -0800
    Local: Wed, Dec 8 2004 6:03 am
    Subject: Re: EJB lookup on from one server to another does not work
    Eric,
    I dealt with this same problem trying to run 2 local servers (websphere
    test servers), using 2 separate WSAD 5.1.2 workspaces. Running on 1
    server I have an application that contains an EJB, and running on the
    other server is an application that uses an access bean to make a
    remote call to my EJB, running on my other server. I too repeately
    received the "NameNotFoundException" when trying to lookup my EJB home
    reference.
    What you have to do to get around this is to modify the server
    configuration of the application that contains the EJB that you are
    attempting to call remotely. You must open the the server.wsi file for
    the server that is running the EJB and go to the "Configuration" tab.
    You must check the "Enable administrative console". Once this is
    complete, start your server. When it is started, right click on the
    server, and select "run administrative console". In the admin console,
    select
    servers -> application servers -> <your server> -> end points ->
    bootstrap address. For "host" you must change "localhost" to either
    your ip address or computer name (ive only tried my ip, but your
    computer name should work too). When building your properties to get
    the initial context, make sure you use
    "env.put(Context.PROVIDER_URL, "corbaloc:iiop:<the ip or computer name
    listed as the bootstrap host of server running ejb>:<the port listed as
    the bootstrap port of server running ejb, which is 2809 in your case>
    Restart your server and things should work.

  • Challenge: call local ejb from remote ejb on weblogic 9.2

    Hi ALL,
    How do I call to local ejb from remote ejb object. The jar file is deployed on weblogic server 9.2, if you want get it http://geocities.yahoo.com.br/lindembe/BEAProject.jar and the source code are http://geocities.yahoo.com.br/lindembe/BEAProject.zip. It is a sample app with two ejb that works so good on JBOSS, JOnAS, but BEA Weblogic.....
    The complete problem you watch http://forum.java.sun.com/thread.jspa?threadID=768718&messageID=4387570#4387570
    or
    http://forums.bea.com/bea/message.jspa?messageID=600043148&tstart=0

    Your code in SigemFacadeBean should just do:
    InitialContext ctx = new InitialContext();
    when you lookup the local EJB. (This will work on all app servers. There's no need to put an app-server specific intial context factory in your code.)
    Also, you can remove the jndi-name setting for the local ejb from your weblogic-ejb-jar.xml. jndi-name is only applied to remote ejbs.
    -- Rob
    WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • How do I run a JCA adapter when I am calling it from an EJB?

    How do I run a JCA adapter when I am calling it from an EJB? Do I need to create an EJB client and place it in a Client container? If my EJB and JCA adapter are deployed is there a way to call my EJB from the command line?
    Mike

    Hi. When you look at the code I provided for you in other thread you will see that connecting to adapter is done through JNDI lookup. The creation of the adapter is done in your J2EE server. Here is some code for you where you can find mapping from code to ejb-jar and orion-ejb-jar.
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
    version="2.1">
    <!--
    This file declares the interface (needs/promises) of the message-driven bean.
    The MDB requires:
    - a JMS queue (to receive messages from the client),
    - a JMS exception queue (to send undeliverable messages back to the source), and
    - a connection factory (to communicate with a JMS resource provider).
    Note that communication with the resource provider may be (and for this
    application is) via a JMS Connector rather than direct.
    -->
    <display-name>JMS Consume MDB - opp-ifs</display-name>
    <enterprise-beans>
    <entity>
    <description>Entity Bean ( BMP )</description>
    <display-name>EBEjbMecomsIFS</display-name>
    <ejb-name>EBEjbMecomsIFS</ejb-name>
    <local-home>EBEjbMecomsIFSLocalHome</local-home>
    <local>EBEjbMecomsIFSLocal</local>
    <ejb-class>EBEjbMecomsIFSBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>java.lang.Long</prim-key-class>
    <reentrant>false</reentrant>
    <service-ref>
    <service-ref-name>service/interceptor</service-ref-name>
    <service-interface>javax.xml.rpc.Service</service-interface>
    <wsdl-file>META-INF/wsdl/MHS5_Jms_In_RS.wsdl</wsdl-file>
    <service-qname xmlns:ns="http://oracle.com/esb/namespaces/PilotOWSM_MustHavesScenario5">ns:ESB_MHS5_Jms_In_RS_Service</service-qname>
    </service-ref>
    </entity>
    <message-driven>
    <display-name>JMS Consume MDB - MDB</display-name>
    <ejb-name>MDBEjbMecomsIFS</ejb-name>
    <!-- name of bean in deployment descriptor (including orion-ejb-jar.xml file) -->
    <ejb-class>MDBEjbMecomsIFSBean</ejb-class>
    <!-- bean's fully qualified Java class name -->
    <messaging-type>javax.jms.MessageListener</messaging-type>
    <transaction-type>Container</transaction-type>
    <!-- allow incoming messages to be included in transactions -->
    <!-- The ejb requires a connection factory to access an external resource (JMS). -->
    <ejb-local-ref>
    <ejb-ref-name>ejb/local/EBEjbopp_ifs</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>EBEjbMecomsIFSLocalHome</local-home>
    <local>EBEjbMecomsIFSLocal</local>
    <ejb-link>EBEjbMecomsIFS</ejb-link>
    </ejb-local-ref>
    <resource-ref>
    <!-- The resource's connection factory must be accessible at jndi location "java:comp/env/jms/QueueConnectionFactory". -->
    <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
    <!-- The resource's connection factory must implement the "javax.jms.ConnectionFactory" interface. -->
    <res-type>javax.jms.ConnectionFactory</res-type>
    <!-- container managed authorization -->
    <res-auth>Container</res-auth>
    </resource-ref>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <!--
    Declare that a global transaction is required when the onMessage method of the ejb named
    "MDBEjbName" is called. This will cause the app server to automatically initiate a
    global (XA) transaction before calling onMessage (actually, before even receiving the JMS
    message that triggers onMessage) and end the transaction after onMessage returns. The
    JMS Connector will automatically rollback the transaction if onMessage throws an
    exception. onMessage may also set the transaction to be "rollback only".
    Participating in global transactions requires that the connection factory provided in the
    activation spec (see the ConnectionFactoryJndiName property earlier in this file) must be
    XA-capable (it must implement the javax.jms.XAConnectionFactory interface).
    If this declaration is ommitted, then onMethod will not be part of any global
    transaction. In that case the connection factory provided in the activation spec must
    implement the javax.jms.ConnectionFactory interface.
    -->
    <container-transaction>
    <method>
    <ejb-name>MDBEjbMecomsIFS</ejb-name>
    <method-name>onMessage</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>EBEjbMecomsIFS</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    orion-ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNameSpaceSchemaLocation="http://www.oracle.com/technology/oracleas/schema/orion-ejb-jar-10_0.xsd">
    <enterprise-beans>
    <entity-deployment name="EBEjbMecomsIFS">
    <service-ref-mapping name="service/interceptor">
    <wsdl-location>http://on-poc62.ontw.alfa.local:7777/event/PilotOWSM/MustHavesScenario5/MHS5_Jms_In_RS?wsdl</wsdl-location>
    <service-qname localpart="ESB_MHS5_Jms_In_RS_Service" namespaceURI="http://oracle.com/esb/namespaces/PilotOWSM_MustHavesScenario5"/>
    <port-info>
    <wsdl-port namespaceURI="http://oracle.com/esb/namespaces/PilotOWSM_MustHavesScenario5"
    localpart="__soap_MHS5_Jms_In_RS_execute_ppt"/>
    <service-endpoint-interface>javax.xml.rpc.Service</service-endpoint-interface>
    <call-property>
    <name>javax.xml.rpc.service.endpoint.address</name>
    <value>http://on-poc62.ontw.alfa.local:7777/event/PilotOWSM/MustHavesScenario5/MHS5_Jms_In_RS</value>
    </call-property>
    <call-property>
    <name>javax.xml.rpc.soap.http.soapaction.uri</name>
    <value>execute</value>
    </call-property>
    <call-property>
    <name>javax.xml.rpc.soap.http.soapaction.use</name>
    <value>true</value>
    </call-property>
    <call-property>
    <name>javax.xml.rpc.soap.operation.style</name>
    <value>document</value>
    </call-property>
    <runtime enabled="owsm">
    <owsm init-home="/oracle/product/SoaAs/10.1.3/owsm/config/interceptors/C0003002"
    init-file="confluent.properties"/>
    </runtime>
    </port-info>
    </service-ref-mapping>
    </entity-deployment>
    <message-driven-deployment name="MDBEjbMecomsIFS"
    resource-adapter="OEMSJMSDRAopp-ifs"
    enabled="true" max-instances="10">
    <!--
    The ejb requires a connection factory implementing the "javax.jms.XAConnectionFactory"
    interface to be accessible at jndi location "java:comp/env/jms/QueueConnectionFactory". (see ejb-jar.xml and ....)
    A suitable connection factory is already accessible at jndi location "OEMSJMSDRASubcontext/MyXACF" (see oc4j-ra.xml)
    -->
    <resource-ref-mapping location="OEMSJMSDRASubopp-ifs/MyXACF"
    name="jms/QueueConnectionFactory"/>
    <!-- don't misspell this or you'll get an RP CF which doesn't work -->
    <!-- Required activation-spec properties. -->
    <!--
    ConnectionFactoryJndiName (string, no default)
    This should be the JNDI location of an RA connection factory.
    The JMS Connector will use this connection factory to create the JMS
    connection it uses to receive messages for this MDB's onMessage. If the
    exception queue is enabled (see UseExceptionQueue), the JMS Connector will
    also use a connection created from this connection factory for the production
    of messages to the exception queue.
    This connection factory must be compatible with the message domain(s). (For
    example, if the MDB is receiving messages from a queue, the connection
    factory should implement javax.jms.[XA]QueueConnectionFactory or
    javx.jms.[XA]ConnectionFactory.)
    For XA/non-XA considerations, see the <container-transaction> comments later
    in this file.
    -->
    <config-property>
    <config-property-name>ConnectionFactoryJndiName</config-property-name>
    <config-property-value>OEMSJMSDRASubopp-ifs/MyXAQCF</config-property-value>
    </config-property>
    <!--
    DestinationName (string, no default)
    This is JNDI location of the queue or topic from which messages to be
    delivered to the MDB's onMessage method should be received.
    The JNDI locations for RA destinations are defined in the
    oc4j-connectors.xml file.
    -->
    <config-property>
    <config-property-name>DestinationName</config-property-name>
    <config-property-value>OEMSJMSDRASubopp-ifs/MyQ</config-property-value>
    </config-property>
    <!--
    DestinationType (string, no default)
    This must be set to the type of the destination named by the above
    "DestinationName" property.
    The EJB 2.1 spec states that this must be set to either javax.jms.Queue or
    javax.jms.Topic. OracleGJRA also allows it to be set to
    javax.jms.Destination (which works for both queues and topics).
    -->
    <config-property>
    <config-property-name>DestinationType</config-property-name>
    <config-property-value>javax.jms.Queue</config-property-value>
    </config-property>
    <!--
    Other activation-spec properties.
    The following activation-spec properties supported by OracleGJRA are optional
    except where otherwise noted:
    -->
    <!--
    ListenerThreadMaxPollInterval (milliseconds, 5000)
    Listener threads "poll" to see if there is a message waiting to be processed.
    The more frequently this polling is performed, the faster (on average) a given
    listener thread can respond to a new message. The price for frequent polling is
    overhead - the resource provider must process a receive request each time it is
    polled.
    Oracle's JMS Connector implementation applies an adaptive algorithm which
    uses shorter polling intervals (high polling rates) during periods of activity
    (once activity is noticed) and longer polling intervals (lower polling rates)
    during periods of inactivity. The ListenerThreadMaxPollInterval property places
    an upper limit on the polling interval used by this adaptive algorithm.
    -->
    <config-property>
    <config-property-name>ListenerThreadMaxPollInterval</config-property-name>
    <config-property-value>5000</config-property-value>
    </config-property>
    <!--
    AcknowledgeMode (string, default = Auto-acknowledge)
    This should be set to Auto-acknowledge or Dups-ok-acknowledge. This
    controls the quality-of-service provided by listener threads which
    consume messages and call the MDB's onMessage method.
    MessageSelector (string, default = no message filtering)
    This is the selector expression used to filter messages sent to the
    MDB's onMessage method. (I.e., this is used as the messageSelector for
    the JMS sessions created for the listener threads.)
    SubscriptionDurability (string, default = NonDurable)
    For topics this should be set to Durable or NonDurable. (This should
    not be set for queues.) This controls the durability of the topic
    consumer used by the listener thread. When SubscriptionDurability is
    set to Durable (and DestinationType is javax.jms.Topic or
    javax.jms.Destination), the SubscriptionName property is required.
    SubscriptionName (string, no default)
    This property is required when SubscriptionDurability is Durable (and
    DestinationType is javax.jms.Topic or javax.jms.Destination). (In all
    other cases it is ignored.) This is the name used when creating the
    durable subscriber used by the listener thread. For a given JMS server,
    a given subscription name should be assigned to at most one MDB (which
    must have most one listener thread).
    ClientId (string, no default)
    If set, connection(s) used by the listener threads will be set to use
    this client ID.
    TransactionTimeout (milliseconds, default = 300,000)
    This limits the amount of time that the JMS Connector will wait for a
    message to arrive before exiting the current transaction. The
    transaction manager limits the amount of time a transaction can last
    (see transaction-timeout in transaction-manager.xml).
    TransactionTimeout should be set such that the transaction manager will
    not timeout the transaction during the onMessage routine unless
    something is wrong. For example, If the transaction mananager timeout
    is set to 30 seconds, and the onMessage routine will never take more
    than 10 seconds unless something is wrong, then this property could be
    set to 20 seconds (20000 milliseconds).
    EndpointFailureRetryInterval (milliseconds, default = 60,000)
    If an endpoint can not be processed (due to the app server WorkManager
    not accepting new work), it will be scheduled to be retried this many
    milliseconds later.
    ReceiverThreads (integer, default = 1)
    This sets the maximum number of listener threads to create for this
    endpoint. For queues, using more than one thread may be useful in
    increasing the rate at which messages can be consumed. For topics this
    value should always be 1. (Each listener thread gets its own session
    and TopicSubscriber. For durable subscribers it would be an error to
    have more than one subscriber with the same subscription name. For
    nondurable subscribers having more than one thread will not help because
    more threads translates into more subscribers which translates into more
    copies of each message.) See also: ListenerThreadMinBusyDuration
    UseExceptionQueue (boolean, default = false)
    When "UseExceptionQueue" is true:
    - Messages that would otherwise be discarded are sent to the
    exception queue. (Currently the only case where this happens is
    when the max delivery count is exceeded. See MaxDeliveryCnt
    property.) Rather than sending the original message directly to
    the exception queue, the following procedure is used:
    o Create a new message of the same type.
    o Copy the properties and body from the original message to the
    new message.
    o If the headers were copied, sending the message to the
    exception queue would cause most of them to be lost
    (over-written by the resource-provider). So instead,
    translate headers in the original to properties in the copy,
    assigning each header obtained via "getJMS{Header}" to
    property "GJRA_CopyOfJMS{Header}". Since
    javax.jms.Destination is not a valid property type, translate
    destination headers into descriptive messages.
    (Currently this same service is not provided for JMSX*
    properties, most notably the JMSXDeliveryCount property.)
    o If some part of the copy process (above) or augmentation
    process (below) fails, do not abort. Attempt to complete the
    rest of the procedure. (For Bytes/Map/Stream message types,
    this can mean that part of the body is copied and the rest is
    not.)
    o If the copy process is 100% successful, add a boolean property
    called "GJRA_CopySuccessful" with the value "true".
    o Add a string property called "GJRA_DeliveryFailureReason" which
    indicates why the message was not delivered.
    o If the MDB onMessage method generated an exception immediately
    prior to the delivery failure, add a string property called
    "GJRA_onMessageExceptions" which contains exception information.
    o Send the resulting message to the exception queue.
    Note that only one attempt is made to send the message to the
    exception queue. Should this attempt fail, the message will
    be discarded without being placed in the exception queue.
    See IncludeBodiesInExceptionQueue property for potential variations
    of the above procedure.
    - The ExceptionQueueName property is required.
    - In addition to being used for the primary destination, the
    connection factory specified by the ConnectionFactoryJndiName
    property will also be used for the exception queue. If the primary
    destination (specified by the DestinationName property) is a topic,
    then the connection factory must support both queues and topics.
    (I.e., the <connectionfactory-interface> [see oc4j-ra.xml] for the
    given connection factory must be either javax.jms.ConnectionFactory
    or javax.jms.XAConnectionFactory.)
    ExceptionQueueName (string, no default)
    This is the JNDI location of the javax.jms.Queue object to use as the
    exception queue. (See UseExceptionQueue property for information about
    the use of the exception queue.) This property is required when
    UseExceptionQueue is true, and ignored when UseExceptionQueue is false.
    IncludeBodiesInExceptionQueue (boolean, default = true)
    This controls whether or not messages sent to the exception queue will
    include a message body. (See UseExceptionQueue property for information
    about the use of the exception queue.) If many messages are sent to the
    exception queue during normal operation and the message body is of no
    use in the exception queue, then this property may be set false to
    improve performance. This property is ignored when UseExceptionQueue is
    false. There are two cases where this property does not apply:
    - If the original message did not have a message body, then the
    message sent to the exception queue will not have one either.
    - If a copy of the original message can not be created for any
    reason, then the original may be sent to the exception queue
    instead. This may result in a message body being sent to the
    exception queue.
    MaxDeliveryCnt (integer, default = 5)
    If a message has the "JMSXDeliveryCount" property and the value of that
    property is greater than MaxDeliveryCnt, then the message will be
    discarded (and not sent to onMessage). If the exception queue is
    enabled (see UseExceptionQueue), a copy of the message will be sent to
    the exception queue. If MaxDeliveryCnt is set to 0, no messages will be
    discarded. (Note that when an MDB responds to a message by throwing an
    exception, the message is not considered delivered and it may be
    redelivered. If the MDB might always respond to a given message by
    throwing an exception, and MaxDeliveryCnt is set to 0 to prevent the
    message from ever being discarded, the result may be an MDB stuck in an
    "infinite loop" - failing to process the same message over and over
    again.)
    -->
    <config-property>
    <config-property-name>MaxDeliveryCnt</config-property-name>
    <config-property-value>0</config-property-value>
    </config-property>
    <!--
    LogLevel (string, no default)
    This controls the level of detail of messages logged by the JMS
    Connector. These messages are primarily intended for debugging the
    JMS Connector itself, but may also be useful when debugging issues
    related to the use of the JMS Connector. This property should not be
    set in production code. (It should only be set temporarily for
    debugging purposes - specific log messages and log levels may be and
    will be added/removed/modified in future versions of the JMS
    Connector.) Currently the allowed values are:
    ConnectionPool
    ConnectionOps
    TransactionalOps
    ListenerThreads
    INFO
    CONFIG
    FINE
    FINER
    FINEST
    SEVERE
    WARNING
    OFF
    ListenerThreadMaxIdleDuration (milliseconds, default = 300,000)
    This is how long a listener thread which is not receiving any messages
    will be kept around. (At least one listener thread will remain as long
    as the endpoint is active.)
    ListenerThreadMinBusyDuration (milliseconds, default = 10,000)
    If a listener thread has just received a message, has not been idle (had to
    wait for a new message to arrive) at any point during the past
    ListenerThreadMinBusyDuration milliseconds, and the current number of
    listener threads for this endpoint is less than ReceiverThreads, then
    (application server willing) an additional listener thread will be created.
    ResUser (string, default = null)
    ResPassword (string, default = null)
    These properties allow a user/password to be passed to the resource
    provider. When neither of these properties are set, connections used for
    this MDB's inbound message handling (as well as for exception queue
    handling, if enabled) are created using the no-argument version of the
    create*Connection method. When one or both of these properties are set,
    they are passed to the create*Connection method as the user/password
    arguments. (If only one property is not set, then 'null' is used for that
    particular create*Connection argument.) The ResPassword property supports
    the standard password indirection options (e.g., using "->joeuser" to
    represent the password of "joeuser").
    Note that the commas used in many of the above default values and examples are
    included here for readability but can not be used in the actual activation spec.
    (I.e., integer/milliseconds values in the activation spec must not include
    embedded commas.)
    -->
    </message-driven-deployment>
    </enterprise-beans>
    <assembly-descriptor>
    <default-method-access>
    <security-role-mapping name="&lt;default-ejb-caller-role>"
    impliesAll="true"/>
    </default-method-access>
    </assembly-descriptor>
    </orion-ejb-jar>

  • Calling EJB from other EJB on other J2EE Server

    Can I call EJB from other EJB on other J2EE Server
    Servers - Websphere 5.0
    Do i require home & remote interface of that ejb on client side also
    Help me, please

    the problem is actually i require that is specific to websphere
    for example i want to call a method ion that ejb
    say my ejb name is myejb
    so the normal way i should call is
    InitialContext initialContext = new InitialContext();     
    Object homeObject = initialContext.lookup("ejb/MyEjbHome");
    MyEJBHome myEJBHome =(MYEjbHome )javax.rmi.PortableRemoteObject.narrow(homeObjectMYEjbHome.class);
              myEJB = lSHome.create();
    myEJB.someMethod();
    but here i am having class for home and remote available
    now if other app server i am not having this classes then what to do

  • Is it possible to call methods from another class from within an abstract c

    Is it possible to call methods from another class from within an abstract class ?

    I found an example in teh JDK 131 JFC that may help you. I t is using swing interface and JTable
    If you can not use Swing, then you may want to do digging or try out with the idea presented here in example 3
    Notice that one should refine the abstract table model and you may want to create a method for something like
    public Object getValuesAtRow(int row) { return data[row;}
    to give the desired row and leave the method for
    getValuesAt alone for getting valued of particaular row and column.
    So Once you got the seelcted row index, idxSelctd, from your table
    you can get the row or set the row in your table model
    public TableExample3() {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    // Take the dummy data from SwingSet.
    final String[] names = {"First Name", "Last Name", "Favorite Color",
    "Favorite Number", "Vegetarian"};
    final Object[][] data = {
         {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
         {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
         {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
         {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
         {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
         {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
         {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
         {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
         {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
         {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
         {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
         {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
         {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
         {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
         {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
         {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
         {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
         {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
         {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
         {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
         {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
    // Create a model of the data.
    TableModel dataModel = new AbstractTableModel() {
    // These methods always need to be implemented.
    public int getColumnCount() { return names.length; }
    public int getRowCount() { return data.length;}
    public Object getValueAt(int row, int col) {return data[row][col];}
    // The default implementations of these methods in
    // AbstractTableModel would work, but we can refine them.
    public String getColumnName(int column) {return names[column];}
    public Class getColumnClass(int col) {return getValueAt(0,col).getClass();}
    public boolean isCellEditable(int row, int col) {return (col==4);}
    public void setValueAt(Object aValue, int row, int column) {
    data[row][column] = aValue;
    };

  • Can an EJB extend another EJB?

    Can an EJB extend another EJB?
    Are there any limitations?
    Thank you in advance, Kostas

    Refer
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=ejb-interest&F=&S=&P=31185

  • We have a 5s active on our account.  After turning on a previously active 4s (it had the same number)  The 5s can no longer place call and when you call it from another phone the 4s rings, but will not pick up.  Texting over the cell networks works fine.

    We have a 5s active on our account.  After turning on a previously active 4s (it had the same number)  The 5s can no longer place call and when you call it from another phone the 4s rings, but will not pick up.  Texting over the cell networks works fine.  Any suggestions??

    hens0861,
    Hmm, let's ensure this is working as it should be! So what phone should be active on your account? Did you switch the devices online or how to did you activate the 5s? Please share details.
    KarenC_VZW
    Follow us on Twitter @VZWSupport

Maybe you are looking for