EJB 2.1 session bean calling EJB 3 session bean?

I have a WL 10 (JDK 1.5/EE 5) server that has several EJB 3 stateless session beans deployed and working well. But now I need to allow a JBoss 3.2.3 (JDK 1.4) EJB 2.1 session bean make remote calls into these EJB 3 EJBs. Can this even work?
It seems to me that EJB 3 calling EJB 2 would be fine, but not in the reverse?

I have a WL 10 (JDK 1.5/EE 5) server that has several EJB 3 stateless session beans deployed and working well. But now I need to allow a JBoss 3.2.3 (JDK 1.4) EJB 2.1 session bean make remote calls into these EJB 3 EJBs. Can this even work?
It seems to me that EJB 3 calling EJB 2 would be fine, but not in the reverse?

Similar Messages

  • JBoss message driven bean calling a session bean

    Hi guys, can you please help me? I want my mdb to call my session bean....can you provide me some examples of ejb-jar.xml and jboss.xml with regards to this configuration....thanks...im creating my deployment descriptors manually

    Here is a little example, I hope it will help you.
    ejb-jar.xml
    =============================================
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <display-name>TestSessionEJB</display-name>
    <ejb-name>TestSession</ejb-name>
    <home>mdbtest.interfaces.TestSessionHome</home>
    <remote>mdbtest.interfaces.TestSession</remote>
    <local-home>mdbtest.interfaces.TestSessionLocalHome</local-home>
    <local>mdbtest.interfaces.TestSessionLocal</local>
    <ejb-class>mdbtest.session.TestSessionEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    ... </session>
    <!-- Message Driven Beans -->
    <message-driven >
    <description><![CDATA[]]></description>
    <display-name>TestMessageEJB</display-name>
    <ejb-name>TestMessage</ejb-name>
    <ejb-class>mdbtest.message.TestMessageEJB</ejb-class>
    <transaction-type>Container</transaction-type>
    <message-selector></message-selector>
    <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    <subscription-durability>NonDurable</subscription-durability>
    </message-driven-destination>
    <ejb-local-ref >
    <ejb-ref-name>ejb/TestEjb</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>mdbtest.interfaces.TestSessionLocalHome</local-home>
    <local>mdbtest.interfaces.TestSessionLocal</local>
    <ejb-link>TestSession</ejb-link>
    </ejb-local-ref>
    </message-driven>
    </enterprise-beans>
    </ejb-jar>
    jboss.xml:
    =============================================
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>TestSession</ejb-name>
    <jndi-name>ejb/MdbTest/TestSession</jndi-name>
    <local-jndi-name>TestSessionLocal</local-jndi-name>
    <configuration-name>Standard Stateless SessionBean</configuration-name>
    </session>
    <message-driven>
    <ejb-name>TestMessage</ejb-name>
    <destination-jndi-name>queue/MyTestQueue</destination-jndi-name>
    <configuration-name>Standard Message Driven Bean</configuration-name>
    </message-driven>
    </enterprise-beans>
    <resource-managers>
    </resource-managers>
    </jboss>

  • Can CMT Session Bean call BMP Entity Bean in WebLogic 6.0?

              Hi
              Does anybody successfully use CMT Session Bean calling BMP +CMT Entity bean in
              WebLogic6.0? I have the following problem.
              Any idea will be appreciated.
              --Winston
              Let's say we have a Session bean SB, it uses container to manage the transaction.
              A method of SB will call an Entity Bean EB which adopts bean-managed persistence.
              Both SB and EB use CMT and all of their methods use "required" in the descriptor
              file.
              1. If the connection con.getAutoCommit() is true in the EB, then the transaction
              within SB cannot be rolled back as the ejbCreate() has already commit into the
              database.
              2. On the other hand if Connecton of EB con.getAutoCommit() is false, then container
              cannot successfully commit the transaction from SB's method, as EjbCreate and
              EjbStore() in EB are likely using the different database connections, which causes
              EbjStore() fail and the following error message will be sent to the Console:
              ============================================================
              "<Jul 9, 2001 4:16:48 PM PDT> <Error> <EJB> <Exception during commit of transacti
              on transaction=(IdHash=7738920,Name = [EJB TraderBeanImpl.buy()],Xid=105:5e6719a
              ded42e332,Status=Rolled back. [Reason = weblogic.utils.NestedRuntimeException:
              E
              rror writing from beforeCompletion - with nested exception:
              [java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
              xception: ejbStore: AccountBean (4003) not updated]],numRepliesOwedMe=0,numRepli
              esOwedOthers=0,seconds since begin=0,seconds left=30,SCInfo[examplesServer]=(sta
              te=rolledback),properties=({weblogic.transaction.name=[EJB TraderBeanImpl.buy()]
              })): java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEnt
              ityException: ejbStore: AccountBean (4003) not updated
              at weblogic.ejb20.internal.EJBRuntimeUtils.throwRemoteException(EJBRunti
              meUtils.java:57)
              at weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:364)
              at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManag
              er.java:211)
              at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
              erSCInfo.java:511)
              at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
              rverSCInfo.java:78)
              at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
              dChain(ServerTransactionImpl.java:893)
              at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
              ServerTransactionImpl.java:1229)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
              sactionImpl.java:168)
              at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
              01)
              at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
              mpl.java:37)
              at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
              derBeanEOImpl_WLSkel.java:76)
              at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
              va:373)
              at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
              va:237)
              at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
              andler.java:118)
              at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
              .java:17)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              --------------- nested within: ------------------
              weblogic.utils.NestedRuntimeException: Error writing from beforeCompletion - wit
              h nested exception:
              [java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
              xception: ejbStore: AccountBean (4003) not updated]
              at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManag
              er.java:220)
              at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
              erSCInfo.java:511)
              at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
              rverSCInfo.java:78)
              at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
              dChain(ServerTransactionImpl.java:893)
              at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
              ServerTransactionImpl.java:1229)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
              sactionImpl.java:168)
              at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
              01)
              at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
              mpl.java:37)
              at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
              derBeanEOImpl_WLSkel.java:76)
              at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
              va:373)
              at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
              va:237)
              at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
              andler.java:118)
              at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
              .java:17)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              --------------- nested within: ------------------
              weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion
              : sync = weblogic.ejb20.internal.TxManager$TxListener@356eb0
              Error writing from beforeCompletion - with nested exception:
              [weblogic.utils.NestedRuntimeException: Error writing from beforeCompletion -
              wi
              th nested exception:
              [java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
              xception: ejbStore: AccountBean (4003) not updated]]
              at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
              TransactionImpl.java:1261)
              at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
              sactionImpl.java:218)
              at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
              01)
              at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
              mpl.java:37)
              at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
              derBeanEOImpl_WLSkel.java:76)
              at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
              va:373)
              at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
              va:237)
              at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
              andler.java:118)
              at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
              .java:17)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >"
              

    We did receive a 4.5.1 / 5.1 interoperability patch - but it wasn't quite 'seamless'.
    We never tried to use it.
    SOAP? Isn't that around 50 times slower than RMI?
    Mike
    "Gary Mui" <[email protected]> wrote:
    We ran into this issue last fall and got some feedback from weblogic
    support. They originally said that it could be done (as well as different
    versions talking to one another via JMS) but it turned out that they
    were
    incorrect and ended up saying that it is not possible. Before 6.0 went
    GA,
    BEA said that there would be a interoperability patch to do this, but
    I've
    never seen nor heard of anything regarding it. As a workaround, we
    implemented 4.5.1 / 6.0 communication via SOAP.
    Mike Reiche wrote in message <3b1bcaec$[email protected]>...
    I have the same question - and more. Last year we were told that wecould
    not use
    RMI (and ejbs) between 4.5.1 and 5.1. Which seems kinda weird becauseI've
    heard
    of people using WL ejbs from Tomcat. This issue has caused us to avoidusing
    WL ejbs in any future development which has any chance of ever beingused
    by any
    app server (WL included) that is not under the direct control of thedata
    center.
    I've been trying to convince the Architecture team here that we canuse WL
    EJBs
    and we can call them from other app servers - but can't seem to getany
    supporting
    statement from BEA (maybe I haven't tried hard enough).
    Anyway, a response from BEA would be appreciated.
    - Mike
    "Madhu K" <[email protected]> wrote:
    Is it possible to call a (stateless session) bean deployed in weblogic
    6.0
    from a bean in weblogic 5.1? I have two versions of weblogic running
    on two
    different hosts and I have to call a bean that is running in 6.0 from
    5.1.
    Are there any limitations?
    Appreciate any feedback/suggestions.
    Thanks,
    Madhu

  • Ejb reference not bound when calling a stateless bean in jboss

    hi there !
    i am trying to deploy a simple stateless session bean in Jboss3.0.4_tomcat-4.1.12
    my bean is successfully deployed but when it is looked up in a jsp i am getting an exception as below :
    javax.naming.NameNotFoundException ejb not bound
    my ejb-jar.xml is as follows :
    <session>
    <display-name>FirstEJB</display-name>
    <ejb-name>First</ejb-name>
    <home>com.ejb.session.FirstHome</home>
    <remote>com.ejb.session.First</remote>
    <ejb-class>com.ejb.session.FirstEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    jboss.xml is as follows:
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>First</ejb-name>
    <jndi-name>ejb/First</jndi-name>
    </session>
    </enterprise-beans>
    </jboss>
    my jsp is as follows :
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
    props.put(Context.PROVIDER_URL,"localhost:1099");
    props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces" );
    props.put("java.naming.rmi.security.manager","yes");
    Context ctx = new InitialContext(props);
    System.out.println("Before LookUp");
    FirstHome home = (FirstHome)ctx.lookup("session.First");
    System.out.println("LookUp Successfull");
    First bean = home.create();
    Can anyone fix this ?
    Thanx in Advance

    Hi,
    hi Vicky !
    thanx again for ur response.
    i created a Demo.jar file as u said.
    and now where should i place my JSP ?
    first i will tell u my folder structure
    <jboss-home>/server/default/deploy/index.war
    index.war has the following
    firstEJB.jsp
    Web-inf/web.xml
    Web-inf/jboss-web.xml
    Web-inf/lib/First.jar
    First.jar file has my home , remote , bean classes.
    and ejb-jar.xml and jboss.xml files
    web.xml has the <welcome-file-list>
    jboss-web.xml has the <context-root>/</context-root>
    plz tell me where i have messed up my code.
    i have created the Demo.jar file now as u said.
    so plz tell me where should i place my jsp file.
    thanx
    lakshmi
    Since your application is having the jsp and ejb hence the deployment should be done as per the J2EE specification, where you have
    1)web-module
    2)ejb-module
    3)appliction-client module
    4)JCA(It is included in J2EE1.3+)
    Now follow the following steps:
    1)Demo.ear folder
    2)Create META-INF/application.xml
    3)Put your Demo.war and Demo.jar in Demo.ear
    4)Demo.jar and Demo.war should be as expalined earlier.Also no need to place the ejb related classes in the WEB-INF/lib of Demo.war.
    5)Write the following contents in the applicaiton.xml
    <?xml version="1.0"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
    <application>
         <display-name>Project</display-name>     
         <module>
         <ejb>
         Demo.jar
         </ejb>
         </module>     
         <module>
              <web>
                   <web-uri>Demo.war</web-uri>
                   <context-root>/demo</context-root>
              </web>
         </module>
    </application>
    6)You can create the compressed form of ear or keep it exploded in the Jboss/server/default/Demo.ear
    7)Note the console for the results of deplotment
    8)call http://localhost:8080/demo/yourjsp.jsp
    Hope now I have explained in the detail and it should work now.
    Regards
    Vicky

  • JNDI Naming Problem accessing Session Bean from Message Driven Bean

    Hi,
         I am facing a very strange problem in JNDI look up accessing a Session Bean from a Message Driven Bean. I have a session fa�ade bean(Remote Bean) which is being called from Struts Action class getting the home reference from the ServiceLocator (I have implemented ServiceLocator pattern to obtain JNDI reference for all EJBs). When I am calling the session fa�ade EJB from the Struts Action class everything is working fine.
         But when I am trying to call the same EJB from my Message Driven Bean, I am getting a JNDI exception (NameNotFoundException - No Object bound to name �java:comp/env/ejb/EJBJNDIName�). I am trying to get the remote reference from the same ServiceLocator which is successfully providing me a reference while calling from the struts action class. But the same ServiceLocator is not able to provide me a reference while calling from the Message Driven Bean. If I use the JNDI name directly like �EJBJNDIName� in the lookup it is working fine. The lookup for the name is working fine and I am able to call the Session Fa�ade bean with that reference.
         I am really not sure what exactly the problem is. If I have any problem in the ServiceLocator, it should have given me the same error while calling from Struts Action class. But it is working fine with the full name �java:comp/env/ejb/EJBJNDIName� calling from the struts action class. I am not sure whether Message Driven Bean has something to do with it. Why I am not able to get a reference of the EJB with the full name? Please Help.
    Thanks
    Amit

    Hi Bhagya,
    Thanks for your response. I think from EJB container we can call Local EJBs with the full JNDI name. The session facade bean which is being called is a remote bean. From the session facade bean I am calling a local stateless session bean for database access. I am getting the reference of the local EJB from my session facade bean with full JNDI name "java:comp/env/ejb/EJBJNDIName". It is working fine with out any problem. My servicelocator is able to provide me the reference of the local EJB from the session facade remote bean with Full JNDI name. I am only having this problem calling from the MDB. I am really not sure whether what is causing it?
    Thanks
    Amit

  • Calling EJB 3.0 from ALBPM

    Hi,
    I tried calling EJB 2.1 from ALBPM and it worked.
    But I was nto able to call EJB 3.0.
    Is calling EJB 3.0 supported from ALBPM 6.0.2?
    If yes, how to call a business method in EJB 3.0?

    Frank,
    Thanks. The @LOB annotations are missing.
    Create table with:
    CREATE TABLE TestBlob (id number PRIMARY KEY, xmlCol BLOB);
    INSERT INTO TestBlob VALUES(1, EMPTY_BLOB());
    The following is the complete listing for the EJB 3 class generated from table TestBlob.
    package ejb3;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    @Entity
    @NamedQueries({
    @NamedQuery(name = "Testblob.findAll", query = "select o from Testblob o")
    public class Testblob implements Serializable {
    @Id
    @Column(nullable = false)
    private Long id;
    private byte[] xmlCol;
    public Testblob() {
    public Testblob(Long id) {
    this.id = id;
    public Long getId() {
    return id;
    public void setId(Long id) {
    this.id = id;
    public byte[] getXmlCol() {
    return xmlCol;
    public void setXmlCol(byte[] xmlCol) {
    this.xmlCol = xmlCol;
    }

  • Problem calling a session bean (EJB 3.0)

    Hello,
    I'm new to netbeans and J2EE. I'm using NetBeans 5.5 Beta 2 and sun application server 9 pe.
    I created a new enterprise application and i'm trying to access a Session Bean (Remote and Stateless)
    from the app-client (outside the main class).
    This is the loockup method that was generated by the IDE (Enterprise Resources > Call enterprise bean):
    private ejb.SessionBeanDoenteRemote lookupSessionBeanDoenteBean() {
    try {
    javax.naming.Context c = new javax.naming.InitialContext();
    return (ejb.SessionBeanDoenteRemote) c.lookup("java:comp/env/ejb/SessionBeanDoenteBean");
    catch(javax.naming.NamingException ne) {
    java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
    throw new RuntimeException(ne);
    When I run the application and try to invoke the lookup method my application gets the following exception:
    SEVERE: exception caught
    javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/Se
    ssionBeanDoenteBean
    at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.
    java:751)
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
    ava:156)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at intensivecare.entrada.JDialogEntrada.lookupSessionBeanDoenteBean(JDia
    logEntrada.java:219)
    at intensivecare.entrada.JDialogEntrada.buttonMenuGravarActionPerformed(
    JDialogEntrada.java:79)
    at intensivecare.JDialogWizzard$2.jButtonGravarActionPerformed(JDialogWi
    zzard.java:178)
    at componentes.JTaskPanelMenu$3.actionPerformed(JTaskPanelMenu.java:54)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
    49)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
    a:2169)
    Please... can someone help me?

    The portable way to acquire the dependency is through java:comp/env or @EJB. Accessing the
    global namespace directly is not recommended. If you use an ejb-ref, you need to define it
    in the component environment within which you'll be looking up the dependency. So if you're
    looking it up from an Application Client, you'll need to define the ejb-ref in application-client.xml.
    Also, the ejb-ref-name is the portion of the string after java:comp/env. There is no automatic
    "ejb" appended to it. If you do ic.lookup("java:comp/env/foo"), your ejb-ref-name would be "foo".
    You can use @EJB but it can only be defined in certain managed classes such as the
    Application Client main class.
    You can find additional info in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Call stateless session bean EJB 2.0 from Webdynpro Java UI

    Hello,
    Can someone please tell me asto how to call a stateless session bean EJB 2.0 from Webdynpro Java UI?
    The NWDS version is 7.0.
    Thanks and Regards,
    Arya

    Hi Aryadipta
    Please check this pdfs
    https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10&overridelayout=true
    Steps for calling stateless session bean in Webdynpro java
    Go to NWDS -> open perspective ->j2ee
    select EJB Module Project ->create a project with name
    Open the Project -->RC on ejb-jar.xml -> Select new --> EJB
    Give name to EJB Bean (First letter should be in capital letters)
    select the type of bean as Stateless session bean and give the package name to store that EJB bean.
    After that Expand ejb-jar.xml and then select the <projectEJB> 
    Double click on this on method  tab double click you will get business method where we will create the methods for business logic
    Double click on projectEJB and then RC on bean tab and write required business logic in bean window as follows(based on requirement we will design a business logic).
    After writing the business logic go to project -> rebuild
    Till now we have created one EJB jar file
    then go to File-->Enterprise Application Project -->create a project (projectEAR)
    After creating a project click on next-> here we will have ear projects and then we select specific project required for our application.(here select projectEJB)
    After that Calculate EAR project will be available on j2ee explorer.
    Right click on <Bean> here
    select New->Web Service->give a name to webservice and select Default configuration type as simple SOAP
    -->click next -> Finish.
    That webservice and related are created in ejb-jar.xml .
    Expand the ejb-jar.xml.and double click on < webservice>
    RC ProjectEJB -> Build EJB Archive RC on CalculateEAR ->Build applicationarchive.
    Expand the projectEAR->RC on CalculateEAR.ear->Deploy to J2EE Engine
    Double click on calculateEAR.ear ->Webservice navigator tab ->we eill servers expand the node
    select the specific WebService  
    Here we test the webservice by click on Test and test it.
    After that go to Web dynpro perspective ->create one webdynpro Project and one component
    RC on model> Select import Web Service model(last)>give model name and package
    and select radio button as local file system or URL
    Go to WSnavigator->copy the WSDL path and paste it in model WSDL path and click on finish.
    from here onwards steps are same as that adaptive RFC model
    Hope it helps
    Thanks
    Tulasi Palnati
    Edited by: Tulasi Palnati on Aug 26, 2009 12:15 PM
    Edited by: Tulasi Palnati on Aug 26, 2009 12:43 PM

  • Local Session Bean calling another local Session Bean in EJB 3.0

    Hi,
    In EJB 3.0, I am trying to do JNDI lookup of a local sesion bean from another session bean's helper class.
    I am not using @EJB injection mechanism here, as call to the local session bean is made in a helper class. Helper classes do not support resource injection.
    Following are the EJB class definitions used in my project. Call to "EJB3Local" made from "EJB1" fails as the "EJB2" helper class is calling "EJB1Local"
    @Stateless
    @EJBs({@EJB(name="EJB2Local", beanInterface=EJB2Local.class),
    @EJB(name="EJB3Local", beanInterface=EJB3Local.class)})
    public class EJB1 implements EJB1Remote, EJB1Local{
    public void findEJB3Local(){
    //1. JNDI lookup for EJB3Local ----
    //2. EJB3Local.someFunction()
    @Stateless
    @EJB(name="EJB1Local", beanInterface=EJB1Local.class)
    public class EJB2 implements EJB2Remote, EJB2Local{
    public void findEJB1Local(){
    //1. JNDI lookup EJB1Local
    // 2. Call EJB1Local.findEJB1Local method
    @Stateless
    public class EJB3 implements EJB3Remote, EJB3Local{
    public void someFunction(){}
    A remote call to EJB2.findEJB1Local() will invoke EJb1Local.findEJB3Local method and the call fails with "java:comp/env/EJB3Local" not found in EJB1Local.
    Has anybody encountered an issue like this issue with local interface calling another local interface?
    Thanks,
    Mohan

    To refer a Ejb from another Ejb include <ejb-ref> element
    in ejb-jar.xml
    <session>
    <ejb-name>SessionBeanA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>SessionBeanB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.ejb.SessionBeanBHome</home>
    <remote>com.ejb.SessionBeanB</remote>
    </ejb-ref>
    </session>
    Include a <reference-descriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>SessionBeanA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>SessionBeanB</ejb-ref-name>
    <jndi-name>com.ejb.SessionBeanBHome</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    In SessionBeanA Bean class refer to SessionBeanB with
    a remote reference to SessionBeanB.
    InitialContext initialContext=new InitialContext();
    SessionBeanBHome sessionBeanBHome=(SessionBeanBHome)
    initialContext.lookup("com.ejb.SessionBeanBHome");
    SessionBeanB sessionBeanB=sessionBeanBHome.findByPrimaryKey(primarykey);
    sessionBeanB.update();
    sessionBeanB.getAll();
    thanks,
    Deepak

  • Local session bean lookup in another local session bean in EJB 3.0

    Hi,
    I am doing JNDI lookup of a local session bean in a session bean. ( I do not want to use EJB dependency injection).
    Lookup of local interface from session bean is successful. But, when the calling session bean is a local session in another session bean, the lookup fails.
    Here is an example:
    @Stateless
    @EJBs({@EJB(name="EJB2Local", beanInterface=EJB2Local.class),
    @EJB(name="EJB3Local", beanInterface=EJB3Local.class)})
    public class EJB1 implements EJB1Remote, EJB1Local{
    public void findEJB3Local(){
    //1. JNDI lookup for EJB3Local ----
    //2. EJB3Local.someFunction()
    @Stateless
    @EJB(name="EJB1Local", beanInterface=EJB1Local.class)
    public class EJB2 implements EJB2Remote, EJB2Local{
    public void findEJB1Local(){
    //1. JNDI lookup EJB1Local
    // 2. Call EJB1Local.findEJB1Local method
    //THIS METHOD CALL WILL FAIL.
    public void findEJB1Remote(){
    //1. JNDI lookup EJB1
    / 2. Call EJB1Local.findEJB1 method
    @Stateless
    public class EJB3 implements EJB3Remote, EJB3Local{
    public void someFunction(){}
    This setup was working in EJB 2.1, as we had clear ejb-local-ref definitions in our ejb-jar.xml file.
    I am suspecting that EJB 3.0 has special annotation to use when lookup is made from another local session bean.
    Any comments will be appreciated.
    Thanks,
    Mohan

    From a private component environment perspective, declaring @EJB in a bean class is equivalent
    to using ejb-ref or ejb-local-ref for that same bean in ejb-jar.xml. In each case, the EJB dependency
    is declared for that bean. Each EJB component has its own private component environment, so
    code running within invocations on different EJBs can not see the component environment of the
    components that made the invocations.
    What exact error are you getting? Please post the stack trace if possible.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to intantiate Stateful session bean in EJB 3 ?

    In EJB 2.x, to instantiate a Stateful Session bean the process was:
    1. Lookup Home object
    2. call create(args) method on Home, that in turn would call corresponding ejbCreate(args) on the bean implementation.
    Now, in EJB 3, there is no concept of Home interaface, How can I instantiate a stateful session bean with some initialization parameters.
    Thanks

    Just the spec. NetBeans should only be providing the ability to add an ejbCreate method if the bean exposes a Local or Remote 2.x view.
    Each lookup or injection of a stateful session bean results in a new bean instance. As long as you call your methods to populate the additional
    state right after first acquiring the stateful session bean reference it will work.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • What role can ejb Session Beans  play  jsp session tracking

     

              I am also looking for a way to use JSP as ejb client with WLS5.1. i would appreciate any help.
              -Girish
              Prasad Peddada <[email protected]> wrote:
              >David,
              >     The beans which are refered in jsp specs are java beans and not EJB.
              >
              >Prasad
              >
              >David Levy wrote:
              >>
              >> Hello,
              >>
              >> We are using Jsp/Servlets which will hold session state and subsequently
              >> call ejb Session Beans for transaction/persistence coordination . We are
              >> not sure if we are using the correct techniques to control object memory.
              >>
              >> Summary of what we have:
              >>
              >> A jsp with the "useBean" directive:
              >> <jsp:useBean id="MySession" class="com....MySession"
              >> scope="session"></jsp:useBean>
              >>
              >> The class MySession holds other classes ( all serializable).
              >> The class MySession is NOT an ejb Session Bean
              >>
              >> Questions:
              >> We are considering making class MySession an ejb Session Bean so (via it's
              >> passivate/activate feature) we can control instances in memory as more web
              >> clients start the session from the jsp page. I.E. all web clients will have
              >> their own HttpSession instance which holds on to an ejb Session Bean object
              >> "MySession"( or a passivated representation of it)
              >>
              >> 1) Is this a sufficient approach or will there be other memory concerns?
              >> I.E. What about all the HttpSession objects out there? Do they need to be
              >> passivated as well?
              >>
              >> 2) If its a good idea to passivate the HttpSessions as well, then what
              >> mechanism should be used ( servlet session persistence)? Also, if we are
              >> passivating the HttpSession (which holds on to the MySession object graph)
              >> , then why bother with the SessionBean for passivation
              >>
              >> 3) Currently, we only have a single instance of a servlet handling all
              >> requests. Will multiple instances buy us anything?
              >>
              >> 4) How does clustering relate to this topic?
              >>
              >> 5) Can we change the "jsp:useBean" directive so MySession is an ejb Session
              >> Bean or do we have to do the "home.create()" within a jsp script?
              >>
              >> thanks,
              >> dave
              

  • How to use a session bean in another session bean (or an EJB in a session)

    JDev 11.1.1.4, WLS 10.3.4, Windows 7 x64
    I have a login controller with a session-scoped bean that manages logins.
    I have another session-scoped bean that manages menu security.
    both modules compile and work fine now I need to share the data from one to another.
    I need to reference the login controller in the menu security bean. How do I reference (include) the login bean in the security bean?
    I tried an EJB - what a farce - these are supposed to be universal and easy ( basis of the oop in Java).
    the bean is defined:
    @Stateless(name = "SecurityEJB", mappedName = "ZITASApplication-ZITASModel-SecurityEJB")
    I have tried :
    ic = new InitialContext();
    session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJBLocal");
    session = (SecurityEJBLocal)ic.lookup("java:ejb/model.security.logic.SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("java:ejb/SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("java:app/SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("java:module/SecurityEJB");
    All return null pointers and claim the name cannot be resolved.
    As you can see - I have found various claims to how to do this.
    One way says create a sevlet, generate a listener and use the sevlet. Basically one for every EJB - a lot of work to use the EJBs
    I would assume that this would be one of the easiest parts of java - as it is the foundation of re-usability and oop.
    I can do either in the application - the added complexity of the EJB is less desirable - but better programming?

    Hi,
    ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");This should work with remote interface. If you want to lookup local interface, you need to register it in web.xml. Quote:
    To access the business local interface you need to define ejb local references for your component environment (i.e. from your servlet environment). You can do this by defining references in your web.xml. For example:
    <ejb-local-ref>
    <ejb-ref-name>ejb/BusinessLogicBean</ejb-ref-name>
    <local>packagename.BusinessLogicBean</local>
    </ejb-local-ref>
    To lookup your local reference from your servlet you need to use the following JNDI reference:
    java:comp/env/ejb/BusinessLogicBean Another one
    First, declare a local ejb reference in your web.xml file (This will add it to JNDI):
    <ejb-local-ref>
    <ejb-ref-name>ejb/Foo</ejb-ref-name>
    <local>simple.ejb.FooLocal</local>
    </ejb-local-ref>
    Then it can be looked up from JNDI:
    InitialContext ctx = new InitialContext();
    FooLocal foo = ctx.lookup("java:comp/env/ejb/Foo");Hope this helps.
    Pedja
    Helpful links (judging from your first post, you are probably sick of these :) )
    How to lookup local EJB in Oracle Weblogic 10.3
    http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html
    http://www.coderanch.com/t/451012/EJB-JEE/java/EJB-Local-Lookup-not-working

  • Need of session bean in ejb?

    We can have the session beans business logic in Servlet using some support class(may be bean).I would like to know exact purpose & use of session bean in ejb specification.

    We can have the session beans business logic in
    Servlet using some support class(may be bean).I would
    like to know exact purpose & use of session bean in
    ejb specification.You can think of a SessionBean as a script. It handles certain business logic, for example, like book a flight. It might get the itinerary, charge the credit card, book a flight, etc. Usually, it is used as a facade, or front to one or more entity beans.
    Now, you could do these exact same things with servlets, but the session bean allows you to have:
    1. A single transaction scope. If one of your processes throws an exception and you've updated, for example 2 database tables, this transaction can be rolled back and everything will be consistant.
    2. Servlets, by nature, are threaded and you have to take special care with synchronization issues of any member variables that you may use in the servlet. With EJBs there are no synchronization issues.
    3. Security. You can specifically disallow/allow access to methods based on roles that you define.
    These are the big reasons for using EJBs. Yes, you can do all of this with servlets, but you'd have to do it yourself ... but why do it, if it is already done for you.
    I hope that that clears things up.
    Regards,
    Paul

  • Problem Calling Remote Session Bean Method

    Need help. I am trying to call a method in a remote stateless session bean in an EJB in my web application from a stateless session bean in a different EJB in the web application. I am getting a run-time error that says,
    "java.lang.NoClassDefFoundError: dtpitb.common.sb.reports.CommonReportsHome"
    ref = ctx.lookup( jndiName );
    // Cast to Local Home Interface using RMI-IIOP
    commonReportsHome = (CommonReportsHome)
    PortableRemoteObject.narrow(ref, CommonReportsHome.class);
    If while in a session bean of an EJB, I want to call a public method in the session bean of a totally different EJB, is there something in particular I am missing. I can make the call from the web application code. I can make a remote call from this session bean to itself in the exact same fashion. I just can't call a session bean in another EJB. All thoughts are welcome.
    Thanks,
    Pete

    Thanks for replying. That could very well be the case I suppose. I'm using JBuilder and WebLogic, and JBuilder pretty much does all of the deployment descriptor code for me. However, maybe this is something I need to incorporate manually.
    One EJB is in the same project as the web application code. The other EJB (common_ejb) is in another project. The calling session bean is in the project with the web app, and the remote session bean method that I'm targeting is in the common EJB session bean. Both EJBs are included in the web app's WEB-INF\lib dir and in the war file.
    So theoretically, this isn't an unconventional practice I assume?
    Thanks,
    Pete

Maybe you are looking for