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

Similar Messages

  • 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 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

  • 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

  • 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.

  • 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

  • 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 :)

  • Calling a Session bean from a java client

    Hi
    I have been using OC4J for quite some while now, and I have a lot of programs to test my session beans. But with the new versions of the container 9.0.2.0.0 production release and 9.0.3.0.0 pre-release J2EE 1.3 certified, all my test program hang in the lookup method. I have an earlier pre-release of 9.0.3.0.0 (the same version number but not j2EE 1.3 certified -> confusing) where my test programs works without any problems.
    I have included a small code sample of how I call the session beans.
    I hope some one can see what I'm doing wrong or what have changed compared to the earlier versions!
    /Thanks
    Morten
    Properties prop = new Properties();
    prop.put Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    prop.put(Context.PROVIDER_URL, "ormi://mma:23791/rmitest" );
    prop.put(Context.SECURITY_PRINCIPAL, "admin");
    prop.put(Context.SECURITY_CREDENTIALS, "welcome");
    Context ctx = new InitialContext(prop);
    //look up jndi name
    Object ref = ctx.lookup("Enterprise1");

    I got i working right now, it seems like I was using the wrong version of oc4j.jar and ejb.jar when I was building my project!

  • Re: junit test for entity beans ... ejb 3.0

    I'm confused. I'm trying to test my entity bean.
    I have:
    - an entity bean
    - a stateless session bean for accessing the entity bean (facade)
    - an interface for accessing the the stateless bean
    And I'm trying to write a JUnit test class to test this bean. However, I am uncertain as to how to test this (I'm new to EJB 3.0, JBoss and Eclipse).
    What would the JUnit test look like? I'm confused as to whether or not I should be injecting the interface/bean/what???
    I've tried several variations. I either get "NameNotFound" - not bound exceptions or Null pointer exceptions.
    What would the @EJB syntax look like or how would I do it through the context?
    For Example:
    @EJB private TestFacade myTest; //interface to stateless bean ?
    OR
    InitialContext ctx = new InitialContext();
    TestResultFacadeBean myTest = (TestResultFacadeBean) ctx.lookup("localTest");
    I'm confused at to which method I should be using and what object I should be accessing. If I could get either one to work, I'd be happy. :)
    How do I ensure my bean is deployed to the container? What do I need to do?
    If anyone has a simple example or explanation as to which method I should use and how to use it, I'd be very grateful.
    Thanks very much,
    LisaD

    OK, you need to have several layers of testing.
    Layer 0. Test the entity beans are deployable (more on this later). Basically, you need to know that all your annotations work. Things to watch out for are multiple @Id fields in one class or @EmbeddedID or @IdClass in conjuction with @ManyToOne, @ManyToMany, @OneToMany, @OneToOne and fun with @JoinTable, @JoinColumn and @JoinColumns. Once you know how these are supposed to work with the spec, it's not too bad to write it correctly each time. But there are some gotchas that will break things later on.
    Layer 1. Do the functions in the classes that don't depend on annotations work as expected. Typically, this is just going to be the getters and setters in your entity classes. Of course JUnit best practice says we don't bother testing functions that look like:
    public T getX() {
    return this.x;
    or
    public void setX(T x) {
    this.x = x;
    as there is nothing that can go wrong with them. So in that case, your level 1 tests will just be initial values specified from constructors and verifying that the non-get/set pairs work, and that the getters you have tagged @Transient work (because you've likely put some logic in them)
    Layer 2. Test the session bean methods that don't require injection to work.
    Layer 3. Test the session bean methods that require injection (Mock Objects). Simulate the injection for yourself, injecting Mock Objects for the entity manager. Then you can confirm that the correct methods are being called in the correct sequences, etc.
    [Note this may require some skill in designing the mock.  I'm working on developing my own entitymanager mock, and if it looks usefull I'll release it to the world.
    Layer 4. Test the session bean methods that require injection (Real entity manager) (See Layer 0)
    For this you will need an out of container persistence implementation.  Currently Hibernate and Glassfish provide beta versions.  You will need a different persistence.xml file that lists all the entities.  You will have to use reflection to inject the entity manager(s) that you create from an entity manager factory unless you provide a constructor that takes an EntityManager as a parameter.  You may need to use reflection to call any @PostConstruct method if you made it private.
    Layer 5. Navigate the relationships in the objects returned from Layer 4 using a database that has been loaded with test data.
    I am currently using Layers 0, 1, 2 & 4 to test my session beans and entity beans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help !! Client for session bean

    I need your help for this roblem :
    I have deployed a session bean in helloClient.jar and wrote TestHello class to test the session bean.
    My problem ist to do this test ;i have tried with this command
    java -cp HelloClient.jar TestHello ,but it works not .
    Thanks.

    Without source code or any description of exceptions, your problem definition is useless.

  • 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.

  • Web Service Tester not sending parameter to Session bean?

    Hi,
    I've implemented an EJB3 entity bean, a stateless session bean and used the @WebService annotation to make it accessible.
    It deployed fine, and everything seems to work. I use the web service tester to test the methods.
    The findDepartments() method works fine (it doesn't take any input).
    However, this method does not work:
         * Find a specific department
        public Department findDepartment(BigDecimal pk)
            System.out.println("Incoming pk="+pk);
            return em.find(Department.class, pk);
        }Incoming pk is always null. Is there a bug in the WebService tester or something?

    Hmm, ok so this is a bug? As of now the tester page does not support value objects as parameters / return types. Agreed that the error message should be more useful :(
    I do get the same error if I use another soap client
    though, so I find it kind of strange.This is different though. In this case, is the request received at the service side at all ? Which version of app server are you using ? What kind of service is this ? JAXRPC or JAXWS ?

  • 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

  • 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.

Maybe you are looking for

  • JMS Receiver adapter

    Hi All, I have configured the JMS receiver adpter and given the target details of external JMS system.After testng it is showing the message (SXMB_MONI) as processed successfully. But the message is not received  to the specified queue.For the wrong

  • No Songs displayed but Ipod still full!?!?!?!

    Hi I've a 5G 30gb ipod. It was incorrectly disconnected as itunes crashed. On reconnecting, the ipod displays none of the music that has been added yet still indicates that there is only 6gb of space left on the ipod. This suggests that the music has

  • How to over come mutating error

    Can Anyone explain me how to OVERCOME Mutating error when firing a trigger ? Thanks in advance.

  • CRC Error

    Okay, so this is my problem. I have an iPod nano 3G and it's been working perfectly well for years until yesterday. i tried reinstalling iTunes and updating the drivers, but this still did not work. My computer suggested that I should format my iPod.

  • SWINGS Plz help ME...plz

    Dear Friends, I created a application in the following manner; class StudentUtilities{ //i want to keep a method to clear the JFrame components to clear; public void clear(FeePayments feepayments){ //code; also tell me how to access the components of