EJB3 session bean injection

Hi,I have a problem about @EJB in session bean.
There are 2 session beans, SessionBeanA & SessionBeanB
in SessionBeanA:
@EJB(beanName="SessionBeanB")
SessionBeanBInterface sessionBeanB;
in SessionBeanB:
@EJB(beanName="SessionBeanA")
SessionBeanAInterface sessionBeanA;
when deploy the ejb, jboss will consider that SessionBeanA depends on SessionBeanA , and SessionBeanA depends on SessionBeanB, so jboss will output that:
--- MBeans waiting for other MBeans ---
What's the problem?How to solve it?
Thanks.

If they're both stateful session beans, it is an application error, since in that case injection has the side effect of creating a new stateful session bean identity. Allowing that would result in an infinite loop.
If at least one is a stateless session bean, there's nothing wrong with the code. EJB references are always proxies. There is no notion of initialization ordering dependencies between such beans if they're packaged in the same application. In this case the JBoss container would be restricting something that is allowed by the EJB specification so it's a JBoss bug.

Similar Messages

  • Ejb3 session bean lookup

    Hello, I have following problem with the ejb3 and session bean lookup:
    For example, I have a session bean with some dummy method, i.e. getInfo() :
    @Stateless
    public class MySessionBean implements MySessionLocal {
    public String getInfo() {return "Hello from Session bean";}
    When I lookup and use this bean in servlet in the following way, everything is OK:
    public class MyServlet extends HttpServlet {
    @EJB() MySessionLocal mySession;
    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
    out.println(mySession.getInfo());
    On the other side, when I create some java bean object as a facade, import and use it in servlet , it doesn't work:
    public class Facade {
    @EJB() MySessionLocal mySession;
    public String getInfo() { return mySession.getInfo();}
    public class MyServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
    Facade myFacade = new Facade();
    out.println(myFacade.getInfo());
    When servlet runs and gets to the command myFacade.getInfo(), NullPointerException is thrown, because mySession object in myFacade is null (ejb lookup method probably fails to perform...)
    I'm trying to use Facade to be able to use my Session Bean in JSP pages, i.e. to do something like <jsp:useBean id="myFacade" class="Facade" ...>
    Could someone clarify why lookup doesn't work in javabean object, despite the fact that it works in servlets?
    P.S. I'm running the latest promoted build (b31) of GlassFish (maybe this is the cause) and NetBeans IDE...

    Hi,
    Please try this ... http://weblogic-wonders.com/weblogic/2009/08/16/weblogic-10-3-ejb3-local-lookup-sample/ (Lookup from JSP)
    and
    http://weblogic-wonders.com/weblogic/2009/08/15/hello-world-2/  (Lookup/Injection from Servlet)
    Thanks
    Jay SenSharma

  • JDeveloper EJB3 Session Bean Problem

    Hi Everyone,
    I am new to JDeveloper. I tried to do a EJB3 Stateless Session Bean. I want to add the AroundInvoke Function to the Bean class. At below
    @AroundInvoke
    // mark this method as a bean interceptor
    public Object checkPermission(InvocationContext ic) throws Exception {
    System.out.println("*** checkPermission interceptor invoked");
    // you can implement your own security framework using interceptors
    if (!ic.getEJBContext().getCallerPrincipal().getName().equals("oc4jadmin")) {
    throw new SecurityException("Caller: '"
    + ic.getEJBContext().getCallerPrincipal().getName()
    + "' does not have permissions for method "
    + ic.getMethod());
    return ic.proceed();
    However, the Jdeveloper 11g keep show me the error message that AroundInvoke is not found. Then I put the import javax.ejb.AroundInvoke. It still complain import javax.ejb.AroundInoke not found.
    Please help and advise.
    Thank you

    A small tip - if you go to the add a library dialog in the project properties you'll see a search box at the top - you can put a class name there and JDeveloper will show you in which library it is.

  • EJB3 Session Bean from webproject (Netbeans 5.5.1 with Visual Web)

    I've been using J2EE 2 Sessoin Beans for some time but looking into moving into the new JavaEE EBJ3. I'm attempting to create a new enterprise project in netbeans and instead of using the web project that it creates I've created a visual web project and attached it to the enterprise project. Everything works great other than the fact that I cannot looking any Session Beans in my context. The logic that is calling the session bean lookup in the Bean of the webpage using JSF. Upon an action being called I'm attempting to lookup the session bean but I get name NameNotFound everyway I try. Below is the sample code. I'm trying injection but it doesn't appear to work from with the JSF Model Bean.
    * Page1.java
    * Created on September 1, 2007, 1:00 AM
    * Copyright smileyq
    package demo;
    import com.demo.aps.ejb.session.AuthenticationManagerLocal;
    import com.demo.aps.ejb.session.HelloWorldLocal;
    import com.demo.aps.model.AuthCredentials;
    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.rave.web.ui.component.Body;
    import com.sun.rave.web.ui.component.Button;
    import com.sun.rave.web.ui.component.Form;
    import com.sun.rave.web.ui.component.Head;
    import com.sun.rave.web.ui.component.Html;
    import com.sun.rave.web.ui.component.Link;
    import com.sun.rave.web.ui.component.Page;
    import com.sun.rave.web.ui.component.PasswordField;
    import com.sun.rave.web.ui.component.StaticText;
    import com.sun.rave.web.ui.component.TextField;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.ejb.EJB;
    import javax.faces.FacesException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    * <p>Page bean that corresponds to a similarly named JSP page.  This
    * class contains component definitions (and initialization code) for
    * all components that you have defined on this page, as well as
    * lifecycle methods and event handlers where you may add behavior
    * to respond to incoming events.</p>
    public class Page1 extends AbstractPageBean
        // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
        private int __placeholder;
        @EJB private HelloWorldLocal hwLocalRef;
         * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
         * This method is automatically generated, so any user-specified code inserted
         * here is subject to being replaced.</p>
        private void _init () throws Exception
        private Page page1 = new Page ();
        public Page getPage1 ()
            return page1;
        public void setPage1 (Page p)
            this.page1 = p;
        private Html html1 = new Html ();
        public Html getHtml1 ()
            return html1;
        public void setHtml1 (Html h)
            this.html1 = h;
        private Head head1 = new Head ();
        public Head getHead1 ()
            return head1;
        public void setHead1 (Head h)
            this.head1 = h;
        private Link link1 = new Link ();
        public Link getLink1 ()
            return link1;
        public void setLink1 (Link l)
            this.link1 = l;
        private Body body1 = new Body ();
        public Body getBody1 ()
            return body1;
        public void setBody1 (Body b)
            this.body1 = b;
        private Form form1 = new Form ();
        public Form getForm1 ()
            return form1;
        public void setForm1 (Form f)
            this.form1 = f;
        private StaticText staticText1 = new StaticText ();
        public StaticText getStaticText1 ()
            return staticText1;
        public void setStaticText1 (StaticText st)
            this.staticText1 = st;
        private TextField usernameTxt = new TextField ();
        public TextField getUsernameTxt ()
            return usernameTxt;
        public void setUsernameTxt (TextField tf)
            this.usernameTxt = tf;
        private PasswordField passwordTxt = new PasswordField ();
        public PasswordField getPasswordTxt ()
            return passwordTxt;
        public void setPasswordTxt (PasswordField pf)
            this.passwordTxt = pf;
        private Button loginBtn = new Button ();
        public Button getLoginBtn ()
            return loginBtn;
        public void setLoginBtn (Button b)
            this.loginBtn = b;
        // </editor-fold>
         * <p>Construct a new Page bean instance.</p>
        public Page1 ()
         * <p>Callback method that is called whenever a page is navigated to,
         * either directly via a URL, or indirectly via page navigation.
         * Customize this method to acquire resources that will be needed
         * for event handlers and lifecycle methods, whether or not this
         * page is performing post back processing.</p>
         * <p>Note that, if the current request is a postback, the property
         * values of the components do <strong>not</strong> represent any
         * values submitted with this request.  Instead, they represent the
         * property values that were saved for this view when it was rendered.</p>
        public void init ()
            // Perform initializations inherited from our superclass
            super.init ();
            // Perform application initialization that must complete
            // *before* managed components are initialized
            // TODO - add your own initialiation code here
            // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
            // Initialize automatically managed components
            // *Note* - this logic should NOT be modified
            try
                _init ();
            catch (Exception e)
                log ("Page1 Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException (e);
            // </editor-fold>
            // Perform application initialization that must complete
            // *after* managed components are initialized
            // TODO - add your own initialization code here
         * <p>Callback method that is called after the component tree has been
         * restored, but before any event processing takes place.  This method
         * will <strong>only</strong> be called on a postback request that
         * is processing a form submit.  Customize this method to allocate
         * resources that will be required in your event handlers.</p>
        public void preprocess ()
         * <p>Callback method that is called just before rendering takes place.
         * This method will <strong>only</strong> be called for the page that
         * will actually be rendered (and not, for example, on a page that
         * handled a postback and then navigated to a different page).  Customize
         * this method to allocate resources that will be required for rendering
         * this page.</p>
        public void prerender ()
         * <p>Callback method that is called after rendering is completed for
         * this request, if <code>init()</code> was called (regardless of whether
         * or not this was the page that was actually rendered).  Customize this
         * method to release resources acquired in the <code>init()</code>,
         * <code>preprocess()</code>, or <code>prerender()</code> methods (or
         * acquired during execution of an event handler).</p>
        public void destroy ()
         * <p>Return a reference to the scoped data bean.</p>
        protected SessionBean1 getSessionBean1 ()
            return (SessionBean1)getBean("SessionBean1");
         * <p>Return a reference to the scoped data bean.</p>
        protected RequestBean1 getRequestBean1 ()
            return (RequestBean1)getBean("RequestBean1");
         * <p>Return a reference to the scoped data bean.</p>
        protected ApplicationBean1 getApplicationBean1 ()
            return (ApplicationBean1)getBean("ApplicationBean1");
        public String loginBtn_action ()
            // TODO: Process the button click action. Return value is a navigation
            // case name where null will return to the same page.
            AuthCredentials credentials = new AuthCredentials();
            credentials.setUsername (usernameTxt.getText ().toString ());
            credentials.setPassword (passwordTxt.getText().toString ());
            hwLocalRef.printHello ();
            return null;
    }

    Hi,
    I've had the very same problem with RAD.
    Try to set the Transaction attribute to SUPPORTS. With SUPPORTS the EJB method will use the same transaction as the caller.
    package hu.bme.ett.raktar.facade;
    import hu.bme.ett.raktar.ejbs.Raktar;
    import hu.bme.ett.raktar.ejbs.controller.RaktarManager;
    import javax.ejb.Stateless;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    @Stateless
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    public class RaktarListazas implements RaktarListazasLocal {
         RaktarManager rm = new RaktarManager();
         * Default constructor.
        public RaktarListazas() {
            // TODO Auto-generated constructor stub
        public Raktar getRaktar(long raktId) {
             return rm.findRaktarByRaktId(raktId);
        public void createRaktar(long raktId) {
             Raktar r = new Raktar();
             r.setRaktId(raktId);
             r.setRaktAzonosito("Y1RAK-01" + raktId);
             r.setMegnevezes("Elso raktaram");
             try {
                   rm.createRaktar(r);
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Cheers,
    Viktor

  • Problem retreiving object from EJB3 Session Bean

    Please delete.
    Edited by: wsaxton1 on Oct 9, 2007 10:18 PM

    So we tested some things that are described in the SDN or by SAP with Connectors.
    We tested JCO version 2.0.12, 2.1.18 and 3.0 in J2EE Projects in netweaver and in Eclipse (Standalone).
    For version 2.0.12 there is a failure that this version is not compatible with the other things in netweaver.
    This version is for standalone and integrated sytems.
    For version 2.1.18 is only described as standalone and so failure happened in netweaver that other classes are coruppted or missed. The internal test in "content administrator" (Ping and Test) do not work and had the same error.
    For version 3.0 (that displace the other two versions) there is many to do in  settings and coding that we do not have tested yet because project is not that small to write it for JCO 3.0 only for testing. When we only displaced files in netweaver the server do not start any more.
    So:
    Is there a way to call R/3 from session bean and 1. create an JCO client or 2. add a client to the "standard" pool of netweaver to use it?
    Any ideas? help? links?
    Project have to be complete in september...
    Our combi is SAP Netweaver 2004 SP21 on Windows XP SP2 / Server 2003 Standard SP1 with JVM 1.4.2_16... need of any more info?
    thx

  • Flex + Glassfish EJB3 stateless session bean

    Hi, I'm new to Flex. We´re in the process of adopting a
    front end web technology. In the Server side we have a JavaEE
    Application with several EJB3 session beans deployed in Glassfish
    V2ur1. I just wonder if someone could lead me to a sample flex
    application that access stateless EJB3 session beans that return
    Entity Beans. Which is the best approach? Could anybody share some
    sample code with me? Thanks a lot.
    My mail is [email protected]

    Hi,
    1) First of all you'll need to download and deploy LiveCycle
    Data Services or BlazeDS on your application server.
    2) Then download the Flex EJB factory from Adobe Exchange (
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1089970)
    and add it to your Data Services.
    3) Declare your session beans as destinations in
    remoting-config.xml
    I remember having trouble to get it working on Glassfish so
    for Flex/EJB3 development I switched to JBoss. Maybe newer versions
    of Glassfish and Data Services will work together more easily.
    After setting up the server-side part you invoke session
    beans just like any other RemoteObjects (see Flex docs).
    Good luck :)

  • Session bean as web service using JAXB

    Hi all,
    can anybody answer my question:
    I have created java classes from XSD files using JDeveloper JAXB compilation. Is it possible to use these classes as parameters for webservice created as ejb3 session bean?
    I'have tried but got this error when invoked web service method:
    <env:Body>
    <env:Fault>
    <faultcode>env:Client</faultcode>
    <faultstring>Caught exception while handling request: deserialization error: java.lang.NullPointerException</faultstring>
    </env:Fault>
    </env:Body>
    </env:Envelope>
    thanks,
    Aigars

    Hi Torstein,
    <i>Seems to me that the problem is related to the msg sent to AE:
    "HTTP response contains status code 401 with the description Unauthorized XML tag Envelope missing in SOAP message header (SAP XI Extension)"
    </i>
    According to you, the problem occurs within the SOAP envelope. Does your incoming SOAP message looks like the one below here?
    If that's not the case, then make sure your SOAP/Web Service client is sending a valid SOAP envelope/request (like the sample below) to XI.
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <!--  Inbound Message -->
    <SOAP:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
    <SOAP:Header/>
    <SOAP:Body>
    <ns1:WebServiceRequest xmlns:ns1='http://company.com/xi/webservice/myws' SOAP:actor='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    <Customer xsi:type='xsd:string'>000025</Customer>
    <CompanyCode xsi:type='xsd:string'>BE01</CompanyCode>
    <KeyDate xsi:type='xsd:string'>20050310</KeyDate>
    <Selection>
    <OpenItems xsi:type='xsd:string'>X</OpenItems>
    <ClearItems xsi:type='xsd:string'></ClearItems>
    <GLItems xsi:type='xsd:string'></GLItems>
    <Dunning>
    <From xsi:type='xsd:string'>A</From>
    <To xsi:type='xsd:string'>Z</To>
    </Dunning>
    </Selection>
    </ns1:WebServiceRequest>
    </SOAP:Body>
    </SOAP:Envelope>
    Cheers,
    R.

  • Injecting session bean from different EAR

    Dear all,
    I am using ejb3. i have ejb.ear and web.ear. both deploy in same weblogic server.
    i want to inject session bean from ejb.ear inside web.ear.
    With Regards,
    WP

    hi,
    Currently, we want to separate it. Because may be we will deploy in different server in the future.
    So far, i can inject it using remote interface.
    How about local interface? is it possible to use local interface? because so far both deploy on same server.
    As far as i know, glassfish can't. isn't it?
    it is j2ee standard or server specific?
    With Regards,
    WP

  • EJB3 Design Patterns (Session Beans)

    I've been learning about EJB3 and JSF as a potential technology for a new web app. As part of my learning about EJB3 and JSF, I came across this tutorial on the NetBeans site:
    http://www.netbeans.org/kb/55/ejb30.html
    In the tutorial there is one entity class, NewsEntity, from which a session bean is created, NewsEntityFacade and the interface NewsEntityFacadeLocal. It seems a little weird to me that the interface is called NewsEntityFacadeLocal and the implementing class called NewsEntityFacade. I would think that the interface should be called NewsEntityFacade and the implementing class NewsEntityFacadeLocal.
    Question 1: Can anyone explain why the names are backwards (at least to my thinking)?
    Also, I've been trying to find some best practices on EJB3 design patterns, but haven't come up with much. I did find some at https://blueprints.dev.java.net/bpcatalog/ee5/persistence/ejbfacade.html. Based on this pattern and the NetBeans tutorial, I think I've come across two different patterns, but since most of the examples are very simple, it's hard to tell.
    Question 2: Are these two distinct patterns?
    1. Session facade/entity (NB example)
    2. Session facade which groups business logic and may reference multiple entity beans.
    Question 3: If I have identified two patterns, can anyone tell me what they consider the pros/cons of either/both?
    Thanks in advance!

    The SRDemo available as an automatic update in JDeveloper 10.1.3.0.4 shows an application using local EJB 3.0 session beans. To access them in the web application you will need an entry in the web.xml like:
      <ejb-local-ref>
        <ejb-ref-name>ejb/local/SRPublicFacade</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local>oracle.srdemo.model.SRPublicFacade</local>
        <ejb-link>SRPublicFacade</ejb-link>
      </ejb-local-ref>To lookup the session bean within you presentation you need to do a JNDI lookup. In my example I have:
    new InitialContext().lookup("java:comp/env/ejb/local/SRPublicFacade");Doug

  • Problem Deploying EJB3 Stateless session bean in Jboss4.0.3

    Hi All,
    I have developed an EJB 3 Stateless session bean and tried to deploy in JBoss 4.0.3 , But i get the following Exception.
    javax.naming.NameNotFoundException: ejb not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at org.apache.jsp.session_jsp._jspService(org.apache.jsp.session_jsp:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:157)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    I am sorry if the question is silly..... My Remote Interface will be one like this
    import javax.ejb.Remote;
    @Remote
    public interface CityService {
         public String getCity();
    And My Bean Class will be
    import javax.ejb.EJB;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityTransaction;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    @EJB
    @Remote(CityService.class)
    @Stateless(mappedName="ejb/CityService")
    public class CityServiceBean implements CityService {
    public String getCity(){
    return "Chennai Metropolitan";
    And the client which invokes the bean will be
    InitialContext ctx = new InitialContext();
    CityService c = (CityService)ctx.lookup("ejb/CityService");
    System.out.println("Msg from Bean"+c.getCity());
    please help me out of this issue....
    Thanks in advance

    ford wrote:
    If you deploy your application in a .ear, you also can use this:
    You have to set a name to your EJBBean -> @Stateless(name = "XXX")
    The client for remote interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Remote");
    The client for local interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Local");the problem with this approach is that if you version your ears, the version numbers show up in the jndi names, and your client code will be hard coded to specific server versions.

  • Reg. Issue with Session Bean -- EJB3

    Have a state full session bean (SFSB):
    @Stateful
    public class test implements itest{
    private static final long serialVersionUID = -4929837299158287545L;
    private int q= 0;
    public void assign(int p) {
    q = p;
    Inetrface is:.
    @Remote
    public interface itest extends Serializable {
    public void assign(int p);
    Accessed as:
    Properties properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.jnp.interfaces.NamingContextFactory");
    properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
    properties.put(Context.PROVIDER_URL, "localhost");
    InitialContext ctx = new InitialContext(properties);
    Object i = (itest) ctx.lookup("test/remote");
    itest t = (itest) PortableRemoteObject.narrow(i, itest.class);
    This piece of code fails giving error
    java.lang.ClassCastException: $Proxy135 ....
    But if i change, the state full session bean (SFSB) to stateless session bean (SLSB) i.e @Stateless
    Everything works fine.
    Environment : JBoss as the App Server.
    Any help appreciated.

    Hi Shailesh,
    Thank you for the reply.
    I checked the JCO's and everything is working fine.
    And to be more clear.
    I have the same application in 2 roles and in ESS role the application is working fine but the user in discussion is an external user and we have config in place for externals.
    In XYZ role where the application is not working we created a new role to satisfy the authorizations. which are same in dev and QA. the application for the user with same authorization is working fine in dev but the same is not working in QA.
    Any other inputs will be helpful.
    Thanks & Regards,
    Pramod

  • Testing EJB3.0 session beans

    Hi,
    recently, I spent some time to find out possible approaches to creating EJB 3.0 session bean tests. I also went over the following article http://www.oracle.com/technology/pub/articles/debu_testability_of_ejb.html.
    Article is referring to library ectest.jar which bring support for testing EJB 3.0.
    I understood from article that library is part of Oracle Application Server distribution. i have installed distribution version 101310 for windows, but library is missing.
    Do anyone know, where the library could be found?
    Thanks,
    Pavel

    Rajesh,
    Is this 12.1.1?
    There are 2 releases after 12.1.1: 12.1.2 and 12.1.3. These 2 version are very different from 12.1.1 and they run in JDK 7 only.
    Would it be possible to try with 12.1.3?
    WebLogic Server 12c (12.1.1), WebLogic Server 11g (10.3.6) and Previous Releases
    Best Regards
    Luz

  • 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

  • Calling Local Stateless session bean from Spring in weblogic 10.3

    We are in the process of upgrading to Weblogic 10.3 from OC4J (OAS). We are using Spring and Stateless Session EJB 3 Local beans (Don't ask me why, it is decided before I came to the project).
    Previously (OC4J):
    -> There is no ejb-jar.xml. EJBs are configured with annotation @Stateless. No "name" or "mappedName" are defined.
    Spring POJOs access EJBs by using "EJBMODULENAME_<<EJBBeanClass>>Local" as JNDI Name. I think this strange JNDI name is what OC4J assigns when there is no explicit JNDI name defined.
    Sample Spring Bean configuration -
    <bean name="securityEJB" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean" lazy-init="true">
              <property name="jndiName">
                   <value>myapp-ejb_SecurityEJBImplLocal</value>
              </property>
              <property name="resourceRef">
                   <value>false</value>
              </property>
              <property name="businessInterface">
                   <value>my.package.SecurityEJB</value>
              </property>
         </bean>
    I understand that weblogic 10.x doesn't give any global JNDI name (JNDI tree is empty) and also looked at the blog, Link: [http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html]
    So far I have tried,
    1. @EJB annotation works but, I don't want to add @EJB annotations in the entire application. Since we are using Spring and EJB3, I am trying to avoid mixing them -
    2. java:comp/env is supposed to work (since it is a local session bean), but it doesn't for me.
    I haven't added weblogic-ejb-jar.xml as I don't think it is going to help, as there is no global JNDI name defined. Am I missing some thing?
    Thx

    Hi,
    if you don't want to use @EJB to inject the EJB, then you'll need declare the EJB reference in deployment descriptor.
    Here is an example copied from EJB3 spec:
    <ejb-local-ref>
    <description>
    This is a reference to the local business interface
    of an EJB 3.0 session bean that provides a payroll
    service.
    </description>
    <ejb-ref-name>ejb/Payroll</ejb-ref-name>
    <local>com.aardvark.payroll.Payroll</local>
    </ejb-local-ref>
    then you can lookup the local ejb from "java:comp/env/ejb/Payroll".

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • ERROR in Patch BASIS  SAPKB62043 on 4.7 server

    Hi All I have installed a fresh SAP server 4.7 on windows 2003 server  /oracle 9.2.0.7 and done all post installation steps. I need to install BASIS patch and ABAP Patch I started with BASIS patch 42 it was done successfully after that I tried to ins

  • LMS 3.2.1 HUM and Tomcat

    Ever since upgrading to the SP1 for LMS. Tomcat have become very unreliable and shuts down when I access HUM reports for any period. Process= Tomcat     State  = Administrator has shut down this server     Pid    = 0     RC     = 0     Signo  = 0    

  • Tool like PathPing that can pinpoint packet loss and can be configured to run for 24 hours

    Does anybody know if there is a simple tool like PathPing that can pinpoint packet loss and can be configured to run for eg. 24 hours. I need it for windows XP preferable a cmd line tool like PathPing. Thanks Simon.

  • Deployment warning -- Compiled by different version of Weblogic Server?

    ####<Aug 23, 2001 12:17:54 PM PDT> <Warning> <EJB> <alpha> <admin> <main> <system> <> <010004> <The EJB deployment named: registration was compiled by a different version of the WebLogic Server.> I'm using WLS 6.0 SP1. I'm getting the above warning m

  • Inserting password missing font?

    When i require to insert me password to download a program or any updates it seems the font is missing and is replaced with this [A] sign. Does anyone know why it's doing this. I have recently updated my software to mac OS X V10.6 Snow Leopard and it