Remote interface / Local interface

Hi
I would like to if its possible to avoid using remote interfaces completely and improve performance by using - JSP -> Servlet -> (local interface) Session bean -> Entity bean ???
Let the client call from JSP which is sent to control servlet which uses local-interface to send the request to a session bean that may in turn interact with Entity bean ?
Is there any specific guidelines regarding that ?
Thanks
Ramesh

building thru ANT is much more helpful, fast and efficient(I personally haven't tried any tools for builing EARs...:-)....Check out the EAR task in the ANT documentation...it describes each of its option and you will also find the EXAMPLES which you can download and tweak according to your beans....

Similar Messages

  • Remote and local interface on same ejb 3.0 bean instance

    Hi,
    Is it posible to get remote and local interface on same ejb 3.0 bean instance.
    For example get local interface of a bean and than pass it as remote to client.
    Both interfaces must operate on same bean instance.
    Thanks
    Zlaja

    yes. You can implement multiple interfaces on a single class, so you can add a local and a remote interface. One trick to avoid duplicate code is to simply make the remote interface extend the local interface; then you only have to add the @Remote annotation and you're done.
    For example get local interface of a bean and than pass it as remote to client.You don't pass an instances to a client, a client looks up a remote instance of the bean through JNDI.

  • Remote and local interfaces....

    Hey.. I used to work with weblogic 8, and now have to work with 10.01....
    I remember reading some documentation about that the container can see what JVM it is running in... and hence that creating localhome interfaces it not necessary.... creating remote interfaces should be ok... as the container wont be making any remote calls and serialization when it can see that the applications are running in the same JVM...
    But where can i find some documentation about this... ???
    Regards
    Kris

    Hi Kristian,
    The term local can be misleading ...
    You've got to understand that when you talk about local with EJBs, it's not in the same JVM but within the same EAR.
    If you want to go further, I detailed the use of EJB3 on WLS 10 on my blog :
    http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html
    Regards,
    Maxence.

  • Local Interfaces in WebLogic 7.0 Not Faster Than Remote Interfaces?

    I was curious how much faster calling business methods in
    a stateless session EJB in WebLogic 7.0 would be through
    a local interface than calling the same business methods
    through a remote interface. I timed both ways of calling
    the same methods and much to my surprise the times were
    nearly identical. I double-checked that in one case I really
    used the local interface (using ejb-local-ref, local-jndi-name,
    local interfaces in source code). Does anybody (perhaps from
    BEA) have an explanation for this? By the way, I ran the
    same experiment with other J2EE application servers such
    as IBM's WebSphere 5 (Beta) and there was a tremendous
    performance difference between local and remote interface
    usage.
    Thanks,
    Reinhard

    "Reinhard Klemm" <[email protected]> wrote in message
    news:[email protected]...
    I appreciate your response and, at the same time, I am somewhat
    surprised about it. Here are the reasons for my surprise:
    1. Your response indicates that WebLogic uses RMI for
    EJB local method calls, i.e., even if the client is on the same VM.
    I would have assumed that WebLogic would bypass RMI in such
    a situation.That is not what I said. Local interfaces wont use rmi.
    But remote interfaces do better if the call is from the same VM. This is
    weblogic rmi optimization. Please see Rob's posting also.
    2. Other J2EE application servers fare a lot better. In one
    experiment, I timed WebLogic against WebSphere 5.0 Technology
    for Developers (i.e., WebSphere 5.0 Beta, which is expressly
    NOT for performance testing) and against the Sun Reference
    Implementation. Here are the numbers for calling business
    methods in a stateless session EJB through its local interface:
    WebLogic: 5.15 ms on the average
    WebSphere: 0.41 ms on the average
    Sun Reference Implementation: 0.11 ms on the average
    This indicates to me that both WebSphere and the Sun Reference
    Implementation are better optimized than WebLogic by excluding
    RMI when making local EJB calls.
    Reinhard
    "Maruthi Nuthikattu" <[email protected]> wrote in message
    news:<[email protected]>...
    Can you post some numbers so that we can visualize the difference.
    Please add the numbers with other J2EE appserver also.
    Otherwise top of my head, the reason is:
    Weblogic rmi is well optimized for the calls with in the same JVM andsame
    J2EE application.
    This could be the reason you are not seeing much difference.
    ..maruthi
    "Reinhard Klemm" <[email protected]> wrote in message
    news:[email protected]...
    I was curious how much faster calling business methods in
    a stateless session EJB in WebLogic 7.0 would be through
    a local interface than calling the same business methods
    through a remote interface. I timed both ways of calling
    the same methods and much to my surprise the times were
    nearly identical. I double-checked that in one case I really
    used the local interface (using ejb-local-ref, local-jndi-name,
    local interfaces in source code). Does anybody (perhaps from
    BEA) have an explanation for this? By the way, I ran the
    same experiment with other J2EE application servers such
    as IBM's WebSphere 5 (Beta) and there was a tremendous
    performance difference between local and remote interface
    usage.
    Thanks,
    Reinhard

  • Use remote or local interface in my CMP EB?

    I found it's suggested to writer your CMP EB with Local interface.and a Session Bean with Remote interface.and bundle them into a same EJB JAR file.my end-user client (WAR file) call SB in another JVM.
    I wrote two methods in my SB named [CreateAuser & DeleteAuser] which call enity bean by local interface.
    and I found it wokrs good anywhere while doing Create or Remove an enity object in my jsp files;
    But I have no way to directly call enity bean in jsp files to do database query.
    Do I have to write a method like findbyuserid which calls entity bean's home method findByPrimaryKey()? if so I should rewriter many methods in my SB to meet my jsp files need.
    What shall I do ,what is the common way to do sth like that?

    Hi,
    You SessionBean (Session Facade pattern) should provide service such as Business Service (Create User, Remote User, GetUser ...) that's the role of SessionBean as Session Facade.
    All the method you expect to call from Presentation Tier.
    Regards
    Sebastien Degardin.

  • Get a remote interface from a local instance

    hi,
    I want to construct a bean locally on a server and then I want to pass the remote interface for that constructed bean back to a client. Is this possible?
    Thanks

    Yes. Take a look at SessionContext class. You can't construct a bean yourself, as its life is managed by container.
         * Obtain an object that can be used to invoke the current bean through
         * the given business interface.
         * @param businessInterface One of the local business interfaces
         *        or remote business interfaces for this session bean.
         * @return The business object corresponding to the given business
         *         interface.
         * @exception IllegalStateException Thrown if this method is invoked
         *         with an invalid business interface for the current bean.
        <T> T getBusinessObject(Class<T> businessInterface) throws IllegalStateException;

  • Configure webapp to use local or remote interface based on environment

    Hi,
    I have the following problem I am trying to solve (app server is Weblogic 10g by the way).
    I have a webapp (war-project) and an ear project containing stateless session beans.
    In our development environment I would like to deploy the war and ear separately, because that is easier for development (war-project can then be deployed as a directory, so changes to jsp's and such have immediate effect).
    Deploying the war and ear separately means that the war-project can only call the session beans through their remote interfaces. For development this is not a problem.
    In a production environment however we would like to package the war INSIDE the ear, so that the webapp can use the local interfaces to call the session beans, as this will improve performance.
    So I am looking for a solution where I can configure the way beans are called. Local if the war is inside the ear, remote if the war is separate from the ear. I was thinking along the lines of packaging a properties file with the war that determines the mode (local or remote). Or maybe packaging a different deployment descriptor, if that is a possibility.
    This is what I have so far:
    Business Interface_
    package be.cegeka.test.ejb3.service;
    public interface TestService {
         public void doSomething();
    Remote Interface_
    package be.cegeka.test.ejb3.service;
    public interface TestServiceRemote extends TestService {
    Local Interface_
    package be.cegeka.test.ejb3.service;
    public interface TestServiceLocal extends TestService {
    Bean implementation_
    package be.cegeka.test.ejb3.service;
    import javax.ejb.Local;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    @Stateless(mappedName="ejb/TestService")
    @Local(TestServiceLocal.class)
    @Remote(TestServiceRemote.class)
    public class TestServiceBean implements TestService {
         @Override
         public void doSomething() {
              System.out.println("I'm doing something");
         @Override
         public void doSomethingLocal() {
              System.out.println("I'm doing something local");
    JSF backing bean_
    package be.cegeka.test.ui;
    public class MyWebAppBackingBean {
         @EJB(mappedName="ejb/TestService", beanInterface=TestServiceRemote.class)
         private TestService testService;
         public String doSmth() {
              testService.doSomething();
              return "success";
    }The part that I would like to be configurable is the "+beanInterface=TestServiceRemote.class+" part in the JSF backing bean. Depending on the environment (development vs. production), this should be "+beanInterface=TestServiceRemote.class+" for development and "+beanInterface=TestServiceLocal.class+" for production.
    Is something like this possible?
    I would like to avoid having to fill my web.xml with ejb-refs and having to do the JNDI-lookups myself if at all possible, to keep things as easy and clean as possible.
    Any ideas are welcome!
    Steven

    Hey Manish,
    comments inline.
    "manish kumar" <[email protected]> wrote in message
    news:1794338.1102557677925.JavaMail.root@jserv5...
    So If they are supposed to be in the same JVM -
    then
    1. the cluster of 3 weblogic servers are three JVMs. So does that meanLOCAL INTERFACES CAN'T BE USED IN CLUSTERED ENVIORONMENT ?
    Sure they can, but the calling component in an enterprise app will not call
    an intance of the local bean on another node in the cluster. It will make a
    by-reference call to the local component in the same EAR. Local interfaces
    are not Remote, so they cannot be used with by-value RMI semantics.
    >
    2. ARE YOU SURE ABOUT THIS FACT THAT THAT LOCAL INTERFACES CAN BE USEDONLY INSIDE THE SAME APPLICATION, I THOUGHT IT CAN BE USED AS LONG AS CLINET
    IS IN THE SAME JVM?
    PLEASE CONFIRM.........!!!!!!!!!!!!!Dead sure:
    http://e-docs.bea.com/wls/docs81/programming/classloading.html#1073506
    http://e-docs.bea.com/wls/docs81/ejb/understanding.html#1126831
    http://e-docs.bea.com/wls/docs61/ejb/cmp.html#1085452
    http://www.theserverside.com/discussions/thread.tss?thread_id=14628
    Also, search the ejb newsgroups. I know Rob Woollen has addressed this in
    here somewhere. And, if Rob says it's so, trust me, it's so.
    Bill

  • How to deside weather to write local interface or remote interface

    Hi All.
    in Ejb 2.0 the concept of local and remote interface is introduced.then how to deside weather to wrire local interface or to write remote interface.
    thanks

    Here in lies the problem. That decision shouldn't be up to a developer, it should be the role of the deployer who decides this. I think they got this wrong in 2.0, its been put at the wrong level. You as the coder need to make scalability decisions about the deployment, which you shouldn't need to. One of the big stengths of the EJB's is that anyone can code them because the container does the hard work for you. That paradigm has been broken now, IMHO.
    Having said that, I was at a SUN developer day just the other day and they suggested that the local interface was mainly for fine grained entity beans and that the course grained entity beans would access the fine grained over local interfaces thus allowing a 'cheaper' implementation of relationship modeling in the entity bean layer. In this scheme of things you would then use the remote interface from session beans to access the course grain entity beans.
    Cheers,
    Peter.

  • Local versus remote interface

    Hello
    i'm working with Bea weblogic 8.1 sp1. We are now looking to change our remote
    interface into locale interface to avoid serialization. But someone tell me that
    bea weblogic already manage remote interface as local interface if we are inside
    a ear application deploy on one server !
    I look in Bea documentation but i was not able to find anything that confirm this.
    Do someone know abou this!!!!!

    If by serialization you mean call-by-value, then take a look at
    enable-call-by-reference. You can avoid the cost of copying by setting this
    to true. Otherwise, the default value is false.
    "Benjamin Léonard" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hello
    i'm working with Bea weblogic 8.1 sp1. We are now looking to change ourremote
    interface into locale interface to avoid serialization. But someone tellme that
    bea weblogic already manage remote interface as local interface if we areinside
    a ear application deploy on one server !
    I look in Bea documentation but i was not able to find anything thatconfirm this.
    Do someone know abou this!!!!!

  • Convert a local interface to the remote interface

    Hello *
    Is it possible to convert a local interface to the same bean's remote interface?
    Regards,
    Lukas

    Thanks for the reply.
    I have simpliefied the lookup to the following:
    Context ctx = new InitialContext();
    spiHome = (ServiceProviderBeanLocalHome) ctx.lookup ("ServiceProviderBeanEJB");
    I still get the following exception:
    javax.naming.NameNotFoundException: ServiceProviderBeanEJB not found
    at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:174)
    I looked up the deployment descriptor from J2EE RI and took the name
    to lookup from the ejb-name:
    <ejb-jar>
    <display-name>localSPIJAR</display-name>
    <enterprise-beans>
         <entity>
              <display-name>ServiceProviderBeanEJB</display-name>
              <ejb-name>ServiceProviderBeanEJB</ejb-name>
    I presume that this is the correct name to use.

  • Super interfaces on EJB 3.0 Remote interface in OC4J 10.1.3

    We are implementing (on OC4J 10.1.3) an EJB 3.0 Stateless Session Bean with 2 business interfaces (remote and local) both of which extend an inteface we have defined in our system.
    When we look up the local interface we see our interface in the bean.
    When we look up the remote interface we do not see our interface in the bean.
    Any ideas?
    Thanks,
    Ed Dirago
    Computer Sciences Corp.
    FAA TFMS System

    The EJB 3.0 Remote Business references are not directly stored in CosNaming. EJB 3.0 Remote references do not have the cross-vendor interoperability requirements that the EJB 2.x Remote view had.
    You can still access Remote EJB references from a different JVM as long as the client has access to SJSAS naming provider. Please see our EJB FAQ for more details :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • Remote interface distribution

    Hi,
    I am just learning to use RMI, have a typical setup, Server and Client and everything works fine, BUT.......
    I have compiled my remote classes, ie RmtServer, RmtServerImpl, then run the rmiregistry
    and then started the service, so far so good.
    I then compile etc the Client class and run
    My question is this, I am currently working from the same directory for all classes, I would like to truly
    distribute the client and server. Do I need to put a copy of the RmtServer interface on the client?
    Currently in my client I have the line:
    RmtServer server = (RmtServer)Naming.lookup("rmi://" + serverHost + "/ProjectServer");
    I have been reading about dynamic class loading but I am slightly confused!!!
    It says that the stubs created by running "rmic" on the server classes can be loaded dynamically, thats great, but the stubs created and the RmtServer interface are not the same thing. If I have to have a "local" copy of every interface I want to use then it seems a bit limited.
    My impression was that I could specify a location for a class repositry on a remote machine and then
    instantiate classes from the server on the local machine! So then I would only need to have one interface on the client to enable me to connect to the server for the first time!!!
    Im really confused as people can probably tell. Any help would be really appreciated

    The purpose of dynamic loading is really so that you don't have to distribute the stub, or the implementation classes of any interfaces.
    You can certainly load the remote interface dynamically from the codebase in the client, e.g. with URLClassLoader, but you will also have to have already loaded all the classes that use the remote interface the same way, rather than via the system class loader. Otherwise they won't load (NoClassDefFoundError). You can download the entire client actually, and this is not a bad way to go: see the the RMI 1.1 Specification, 'Bootstrapping the client', for details (if you can find it: try http://java.sun.com/products/archive/jdk/1.1/index.html), and the RMI-USERS archives of about five-six years ago for discussions (see http://archives.java.sun.com/archives/rmi-users.html). The description of this was removed from the 1.2 specification for some reason, and I did encounter problems migrating a 1.1 bootstrap client to 1.2, so beware.

  • Remote Interface problem using Sun ONE App & web server

    HI,
    1) I am using an S'less SB. I have local & remote interfaces. I am using the sun one appserver7 & the sun ones's htttp server. By default it doesnt pick up the remote interfaces is it ? How do i make my remote interfaces work ? what are the changes required in config/xml ?
    2) However i changed my client code (i.e my action class which is called by the struts action servlet ) to access the localhome rather than the remote home, but then i get java.lang.classcastexception.
    pls help !
    sanjay

    Hi parsuram,
    Thanks for the tip. After looking at the sample source code, I did finally figure out the solution - so I'll post it in case anyone else happens to be working with websphere studio has the same issue deploying on sun one.
    To access local interface ejb, you must have the following
    1. ejb-local-ref tag in the ejb-jar.xml like so underneath the <session> or <entity> tag of the bean which you plan to access the local ejb with.
    <ejb-local-ref>
    <ejb-ref-name>TestL</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>memory.simple.TestLLocalHome</local-home>
    <local>memory.tool.simple.TestLLocal</local>
    <ejb-link>TestL</ejb-link>
    </ejb-local-ref>
    2. similar ejb-ref tag in sun-ejb-jar.xml
    <ejb-ref>
    <ejb-ref-name>TestL</ejb-ref-name>
    <jndi-name>localejbs/module_memory.betaEJB/TestL68640023372300293</jndi-name>
    </ejb-ref>
    note: sun generates the <jndi-name> and overwrites whatever you put in that tag no matter what you put in there.
    3. here is the code to access
    Context initial = new InitialContext();
    TestLLocalHome tlHome=(TestLLocalHome) Initial.lookup
    ("TestL");
    //the string must match <ejb-ref-name> underneath <ejb-local-ref>
    4. note that the jndi name for the local interface bean becomes irrelevant. only the <ejb-ref-name> in the ejb-jar and sun-ejb-jar matter. furthermore, both <ejb-ref-name> must be the same or you won't be able to deploy.
    5. This is completely my fault for not checking the "proper" way to access local interfaces. in websphere, they let you get away without the ejb-ref tags and just use the string "local:/TestL"!
    -matt

  • TraderService Remote Interface

    Why is the TraderService back end stateless session EJB implemented with remote
    interfaces instead of local interfaces. If I'm not mistaken, upon reaching this
    service, all processing will be co-located on one server, therefore, wouldn't
    it be more performant to implement this EJB with local interfaces?

    Hello,
    The examples are simply starting points to assist your own development
    work.
    You might want to take a look at the web service design guide [1] in the
    docs. If you are deploying to a cluster of WebLogic Server instances,
    by default the deployment targets all server instances in the cluster.
    This corresponds to homogenous module deployment, which is recommended
    in most clusters. See [2].
    Regards,
    Bruce
    [1]
    http://edocs.bea.com/wls/docs81/webserv/design.html
    [2]
    http://edocs.bea.com/wls/docs81/deployment/overview.html
    Sean Cohan wrote:
    >
    Why is the TraderService back end stateless session EJB implemented with remote
    interfaces instead of local interfaces. If I'm not mistaken, upon reaching this
    service, all processing will be co-located on one server, therefore, wouldn't
    it be more performant to implement this EJB with local interfaces?

  • How to lookup the remote interface in JNDI of the cluster (glassfish)

    I have write a simple sessionbean:
    package authority;
    import javax.ejb.Stateless;
    * Session Bean implementation class LoginSessionBean
    @Stateless
    public class LoginSessionBean implements LoginSessionBeanRemote, LoginSessionBeanLocal {
         * Default constructor.
        public LoginSessionBean() {
            // TODO Auto-generated constructor stub
        @Override
        public boolean login(String name, String password)
            boolean result = false;
            System.out.println("User: " + name + " is login with password: " + password);
            return result;
        @Override
        public LoginSessionBeanRemote create()
            // TODO Auto-generated method stub
            return this;
    }And I write a simple client to test it.
    package test;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import authority.LoginSessionBean;
    import authority.LoginSessionBeanRemote;
    public class SessionBeanTestClient
        public static void main(String[] args)
            try
                InitialContext context = new InitialContext();
                Object obj = context.lookup(LoginSessionBean.class.getName());
                LoginSessionBeanRemote loginService = (LoginSessionBeanRemote)PortableRemoteObject.narrow(obj, LoginSessionBeanRemote.class);
                loginService.login("Jason", "password");
            catch (NamingException e)
                // TODO Auto-generated catch block
                e.printStackTrace();
    }And it is OK, but after I deploy the sessionbean into a cluster with two instances on local host, it can not find the remote interface:
    javax.naming.NameNotFoundException: authority.LoginSessionBean not found
         at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)Is it different for cluster (for IIOP port?), I want to test the HA solution, how could I start it?

    Please look at http://otn.oracle.com/tech/java/oc4j/htdocs/oc4j-how-to.html. There is a How-To on local interface.
    thanks
    Debu

Maybe you are looking for

  • How to connect macbook pro to panasonic tv with hdmi cable

    How to connect macbook pro to panasonic hd tv with hdmi cable

  • Multiple Apps Crashing Unexpectedly /  System Crashes

    For the past few days now I have been plagued with apps crashing unexpectedly. I have ready quite a few threads on this issue, but to now avail. I have found no Ah Ha moment that gives me a fix. This is happening on my Mac Book Pro. So, I wanted to d

  • Auto Incrementing in Text Field

    I imported a tab file and one column was the city, state and zip code. For some reason, the Zip code auto increments. It just so happened that the first cell was Durham, NC 27701. All subsequent cells incremented the Zip code by one, so the second ce

  • Movie Storage using AppleTV

    I am thinking about an ATV or actually two of them (one in the theater and one in the family room). I have a couple of questions. First a little background, I have an Imac and macbook with a Time Capsule I use just for backing up the computers. I hav

  • TRACE OUTPUT - Please help

    hi there from Portugal I am running a trace using toad over an oracle 8 database which runs in a remote location. I do not have an account to acess that machine - Only can connect to database with toad or sql plus. Is there any other way to see the o