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.

Similar Messages

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

  • Recording a person remotely and locally at the same time

    Using the most recent version of Adobe Audition for the Mac...
    I'm recording 2 people on my end, but also need to be able to record a third person that is in another city at the same time. They all need to be able to hear each other and I need a decent recording. I've got great mics on this end and I'm using Adobe Audition to record onto a Mac. The remote person has a good USB mic but I am not sure how to get his audio in and a monitor of everything back out to him. Any ideas?

    Not a simple as it sounds...
    The first thing to consider is how you're getting the voice from the other city into your system?  Regular phone?  Skype?  Specialist IP transmission device?  Skype (or similar) might be easier but not up to the full quality you'll get locally.
    Second, you have to consider what's fed where.  The remote voice will wish to hear the two people local to you but NOT his own voice returning with heavy lag.  In a professional situation, you'd also have a facility to over ride the programme audio for a director (you?) to give direction and countdowns etc.
    I know there are specialist pieces of podcasting software that can do some or all of this on a single computer (though with varying degrees of success from what I gather).  However, depending on the resources available, if it was me, I'd use 2 computers (and a third at the remote end), a headphone amp and a small mixer with at least one pre fade aux.
    I'd use one computer to set up a Skype connection with the remote end, feeding the line out into one channel of the mixer.  I'd feed the two local mics into two other channels of the mixer and the main output(s) of the mixer into your Mac for recording.  Up to you (and what you have) whether you keep each voice in a separate track or maybe just pan the local mics to one side and the remote to the other to keep the two locations separate.
    I'd use the pre fade aux to feed to the remote location, turning up the two local mics but NOT his own voice.  If necessary (and it usually is) I'd set up a third basic mic into the pre fade aux so I could talk to the far end as required.
    Anyhow, that's how I'd do it.

  • Remote and Home Interfaces

    Why do we need a home interface and remote interface for a ejb.
    Must these interfaces be there for each ejb?

    Why do we need a home interface and remote interface
    for a ejb.The Home interface is like a factory for getting to your beans. The remote interface is what you use to speak "directly" to the bean. It's remote because the bean is usually on a remote server somewhere (not in the same VM as your client code). The same is true for the home interface in terms of it being remote.
    The corresponding LocalHome and Local interfaces are for use when the bean in question is not remote.
    Must these interfaces be there for each ejb?You need either a Home and Remote or LocalHome and Local interface for all beans except Message Driven Beans.

  • How local interfaces work in EJBs

    How exactly local interfaces work in EJBs and how should I use them ?
    Thank you.

    They are simply non-RMI interface implementations that directly delgate to the EJB's implementation. They are called and in turn call the EJB just as you would call any normal class.
    As such, there is no RMI or serialization overhead and the interfaces can include methods that update their arguments, something not possible in remote interfaces.
    Generally speaking, you should define local interfaces for all entities as one seldom if ever would access entities remotely. You might even consider defining ONLY local interfaces for entities, but that is a tougher call.
    You would define local interfaces for session EJB's that are invoked by other session EJB's within the same container. I would normally always define both local and remote interfaces unless there is some reason why I can eliminate one or the other.
    Chuck

  • Accessing the local interface of an EJB

    Hello.
    I am using Jdeveloper 11G and it's integrated application server. Using the Jdeveloper wizards, i created a simple stateless session EJB which has both a local and a remote interface (code listed below). I then used the "Create test client" option to create a simple test client.
    The way these classes and interfaces are set up by the wizards, i am using the remote interface. However, i would like to lookup the local interface and use that instead. But i just can't figure out how to lookup the local interface of the EJB. I have tried pretty much every variation i can think of but still no success. Is there anyone out there who can give me a hand? Is there a way to see the lookup name in the integrated WLS server?
    My remote interface looks like this:
    @Remote
    public interface SessionEJB {
    and the remote one:
    @Local
    public interface SessionEJBLocal {
    And my EJB class:
    @Stateless(name = "SessionEJB", mappedName = "NewTestApplication-SessionEJB")
    public class SessionEJBBean implements SessionEJBLocal, SessionEJB {
    My test client does this lookup that works fine:
    public class SessionEJBClient1 {
    public static void main(String [] args) {
    try {
    final Context context = getInitialContext();
    SessionEJB sessionEJB = (SessionEJB)context.lookup("NewTestApplication-SessionEJB#model.SessionEJB");
    }

    Hi,
    Your lookup in your client would look something like
    SessionEJBLocal sessionEJB = (SessionEJBLocal)context.lookup("NewTestApplication-SessionEJB#SessionEJBLocal ");
    The part before the # in the lookup is your mapped name from your session facade, and after the # you have your package, like com.oracle. and ending it with your local interface name.
    Just remember that if your client is not actually running inside the application server container (which with the generated test client it wouldn't be, its a java standalone app with a main method), you will not be able to use the local interface, and you would have to look up remote interface. This can be done in exactly the same way as the above line of code, just replacing the local interface parts with the remote interface's. Hope this helps.
    Drikus
    Edited by: Drikus Britz on Jun 3, 2009 8:46 PM
    Edited by: Drikus Britz on Jun 3, 2009 8:50 PM

  • How can I get a reference to the Local interface of a EJB 3 session?

    Hi,
    How can I get a reference to the Local interface of a EJB 3 session?
    My session implements both the local and remote interfaces, so in my client, when I look up the remote interface using the following code, I did get a reference
              processor = (IItemProcessorRemote)initialContext.lookup(IItemProcessorRemote.class.getName());but if I also look up the local interface in th eclient using this:
    processorLocal =(IItemProcessor)initialContext.lookup(IItemProcessor.class.getName());I got errors like the following, do you know why? Thanks a lot!
    Exception in thread "main" javax.naming.NameNotFoundException: sessions.IItemProcessor not found
         at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:203)
         at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:175)
         at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
         at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:116)
         at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)

    BTW, findItemByTitle(String title) is a business method in my ItemProcessor session bean.
    public String findItemByTitle(String title) {
              AuctionItem item;
              String result = null;
              try {
                   Query query = entityManager
                             .createNativeQuery("SELECT i from AuctionItem i WHERE i.title LIKE : aTitle");
                   query.setParameter("aTitle", title);
                   item = (AuctionItem) query.getSingleResult();
                   result = item.toString();
              } catch (EntityNotFoundException notFound) {
              } catch (NonUniqueResultException nonUnique) {
              return result;
         }

  • Remote and Local Site Sync Problems

    I have a customer who is using Dreamweaver CS4 on Mac OS X. Dreamweaver is setup to have a local site as our development server(win 2k3) and the remote site as our live web server(win 2k3). The folder structure on both the development and live web server is the same. When you view the path in the manage site window of dreamweaver it shows both remote and local site listed as /Volumes/www/Data. When dreamweaver connects to both of these to sync the files nothing happens since it sees them as the same place.
    I have looked in the /Volumes folder on the customers computer and two listings appear for the servers www and www-1. This is not what dreamweaver shows and if you repoint the link to the www-1 folder it just changes back to www.
    I have tried to create alias' and symbolic links to distinguish one folder from the other however nothing I seem to change has any effect.
    If you use finder on the machine it can distinguish between the two folders I just need to figure out how to make dreamweaver do the same.
    Any assistance on this would be greatly appreciated.

    Unfortunately no I do not have a solution. I was not able to find out at the time and the problem went away with the migration to a content management system for our web server. Also the Develpment team changed hands and the new people all use windows machines.
    Good Luck trying to find a solution.

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

  • RPC web service session beans and local interfaces

    I am wondering if it is possible to use EJB 2.0's local
    interface (vs remote interface) with 6.1's RPC web service
    session beans. Since WLS generates the SOAP servlet that
    invokes the RPC session bean and I do not find
    a way to some how tell SOAP servlet to use local interface to
    get the session bean's local home interface, I am not sure
    this can be done.
    Any comments would be appreciated.
    Thanks.
    Peter

    Ta. Thanks for the info.
    Any idea when Local I/F support is due?
    -Nick
    "Neal Yin" <[email protected]> wrote:
    >
    "Nick Minutello" <[email protected]>
    wrote
    in message news:3d4413a4$[email protected]..
    I was just about to post the very same question - but for WLS 7.0.0.1.
    There are essentially two questions:
    1) (from a functional perspective)
    Can I expose Local Interfaces as SOAP using the auto-generation(servicegen ant
    tasks)?Local Interfaces support is coming.
    2) (from a performance perspective)
    Does the generated SOAP implementation go via the (expensive) RemoteInterface
    (ie marshalling) - or is the RMI marshalling optimised out (by setting<enable-call-by-reference>true</>)?
    You can set this option by yourself on your EJB. Web service runtime
    doesn't
    do any magic in this area.
    Regards,
    Nick
    "Peter" <[email protected]> wrote:
    I am wondering if it is possible to use EJB 2.0's local
    interface (vs remote interface) with 6.1's RPC web service
    session beans. Since WLS generates the SOAP servlet that
    invokes the RPC session bean and I do not find
    a way to some how tell SOAP servlet to use local interface to
    get the session bean's local home interface, I am not sure
    this can be done.
    Any comments would be appreciated.
    Thanks.
    Peter

  • JBoss and local interfaces (JNDI)

    I'm trying to do simple example involving local interfaces on JBoss.
    There is Bar remote interface, which uses Foo, local interface. And the problem is - i cant locate Foo within Bar:
    ejb-jar.xml:
    <session>
    <ejb-name>BarEjb</ejb-name>
    </session>
    <entity>
    <ejb-name>FooEjb</ejb-name>
    </entity>To make FooEjb accessible for Bar via local interface, as manual says, i have to put additional reference in ejb-jar.xml for Bar:
    <ejb-local-ref>
         <ejb-ref-name>LocalFooEjb</ejb-ref-name>
         <ejb-ref-type>Entity</ejb-ref-type>
         <local-home>beans.FooHome</local-home>
         <local>beans.Foo</local>
         <ejb-link>FooEjb</ejb-link>
    </ejb-local-ref>But it doesnt change anything, JBoss maps Foo like this: "Bound EJB LocalHome 'FooEjb' to jndi 'local/FooEjb@13595063'", and
    public class  Bar ... {
    Object ref = context.lookup("LocalFooEjb");
    }resuluts in exception:
    "java.lang.RuntimeException: LocalFooEjb not bound ..."
    Question: how do i map local interfaces within JBoss to some human-readable and predictable name?
    Thanks for help.
    update:
    specifying JNDI names in jboss.xml does the trick, but i still dont understand why JBoss ignores local-ref element. So anyone who can explain is welcome.
    jboss.xml
    ...xml declaration..
    <jboss>
         <enterprise-beans>
              <session>
                   <ejb-name>StockListEjb</ejb-name>
                   <jndi-name>remote/StockListEjb</jndi-name>
              </session>
              <entity>
                   <ejb-name>StockEjb</ejb-name>
                   <local-jndi-name>local/StockEjb</local-jndi-name>
              </entity>
         </enterprise-beans>
    </jboss>Edited by: anykeyN on Jun 29, 2008 7:06 AM

    [skipped]

  • CMR and Local Interfaces

    I have a question on setting up CMR in an environment where I want to utilize local
    interfaces within a weblogic server instance. In the deployment descriptor, I have
    set up the home, remote, local-home, local, and ejb-class entries. I then want to
    define the relationships between two CMP entity beans. Here is where I run into
    problems.
    1) If I define the CMR field using the local interface, I get an error stating that
    the type defined by the bean for the field does not match that of the remote interface.
    2) If I define the CMR field using the remote interface, I get an error stating that
    the bean must use the local interface for the CMR if one exists.
    Seems kind of circular to me. What am I missing?

    If you want to be able to have mutiple children companies for a parent
    company and you want to be able to query for the parent company for a given
    comapnay then this is the XML I would do something like the following. In
    your xml you had the mutiplicities inverted and also the cmr field was
    either in the wrong place or misnamed (ie, if it had to be in the top block
    then it should have been "childCompanies" instead of "parentCompany").
    Assuming the bean name in the descriptor for the CompanyEJB is Company:
    <ejb-relation>
    <ejb-relation-name>Company-ParentCompany</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ChildCompanies</ejb-relationship-rol
    e-name>
    <multiplicity>one</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ParentCompany</ejb-relationship-role
    -name>
    <multiplicity>many</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>parentCompany</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    In the CompanyEJB you would have:
    public abstract CompanyLocal getParentCompany();
    public abstract void setParentCompany( CompanyLocal parent );
    -- Anand
    "Steve Ebersole" <[email protected]> wrote in message
    news:[email protected]...
    >
    The jar I am running through ejbc is attached (with source). The EJBobject naming
    conventions are as follows:
    ejb-class = CompanyEJB
    home = CompanyHome
    remote = Company
    local-home = CompanyLocalHome
    local = CompanyLocal
    The pertinent ejb-jar snippet:
    <ejb-relation>
    <ejb-relation-name>Company-ParentCompany</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ChildCompanies</ejb-relationship-rol
    e-name>
    <multiplicity>Many</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>parentCompany</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Company-Has-ParentCompany</ejb-relationship-role
    -name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Company</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    And the weblogic-cmp-rdbms-jar snippet:
    <weblogic-rdbms-relation>
    <relation-name>Company-ParentCompany</relation-name>
    <weblogic-relationship-role>
    <relationship-role-name>Company-Has-ParentCompany</relationship-role-name>
    </weblogic-relationship-role>
    <weblogic-relationship-role>
    <relationship-role-name>Company-Has-ChildCompanies</relationship-role-name>
    <column-map>
    <foreign-key-column>PRNT_COMP_ID</foreign-key-column>
    <key-column>COMP_ID</key-column>
    </column-map>
    </weblogic-relationship-role>
    </weblogic-rdbms-relation>
    In the CompanyEJB, these are the two scenarios I tried:
    1)
    public abstract Company getParentCompany();
    public abstract void setParentCompany( Company prnt );
    2)
    public abstract CompanyLocal getParentCompany();
    public abstract void setParentCompany( CompanyLocal prnt );
    The only way I have been able to get it to work so far is to use thesyntax in #1
    above and then to remove all references to the local interfaces in thedeployment
    descriptors.
    Thanks for all help

  • Local Interface in weblogic-ejb-jar.xml file

    I used Local Interface in WLS 7.0, and specifies the jndi-name as
    <weblogic-enterprise-bean>
    <ejb-name>MailboxService</ejb-name>
    <jndi-name>ejb/MailboxServiceHome</jndi-name>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>MailboxServiceLocal</ejb-name>
    <jndi-name>ejb/MailboxServiceLocalHome</jndi-name>
    </weblogic-enterprise-bean>
    When I migrate to WLS 8.1, I keep receiving warning messages like:
    "[java] WARNING: Warning from ejbc: <jndi-name> must be defined for a bean
    with remo
    te interface. 'RecognitionServiceLocal(Jar: C:\ebdev\dev\make\eb-ejb\..\..\dist\eb-ejb.j
    ar)' does not have a remote interface."
    What is wrong here?
    Thanks in advance.

    jndi-name is specified for a remote interface.
    local-jndi-name is specified for a local interface.
    thanks,
    Deepak Vohra
    "Andy yang" <[email protected]> wrote:
    >
    I used Local Interface in WLS 7.0, and specifies the jndi-name as
    <weblogic-enterprise-bean>
    <ejb-name>MailboxService</ejb-name>
    <jndi-name>ejb/MailboxServiceHome</jndi-name>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>MailboxServiceLocal</ejb-name>
    <jndi-name>ejb/MailboxServiceLocalHome</jndi-name>
    </weblogic-enterprise-bean>
    When I migrate to WLS 8.1, I keep receiving warning messages like:
    "[java] WARNING: Warning from ejbc: <jndi-name> must be defined
    for a bean
    with remo
    te interface. 'RecognitionServiceLocal(Jar: C:\ebdev\dev\make\eb-ejb\..\..\dist\eb-ejb.j
    ar)' does not have a remote interface."
    What is wrong here?
    Thanks in advance.

  • Remote and Home interface binding to an EJB2.1/3.0 bean.

    When deploying a complete ejb bean,
    -What associated a bean class, within the container,
    with it's home and remote interfaces?
    -JBoss Application server requires that the Bean class
    directly implement both interfaces.
    -Assuming EJB 2.1, is this approached by
    interface implementation, a naming convention,
    a common location in a package/directory,
    or is this put in the deployment descriptor xml file?
    What is the standard approach?
    Z.

    If you have included the HTTP server with your 10.1.3.2 installation you could also setup a proxy/proxy-reverse setup in the portal http server for the /app08 mountpoint and point this to your 10.1.3.2 server....

  • Remote and local databases

    let say that i access a oracle form through the web and that form access data from two distributed databases, then will there be a remote database and local database for the user or all the databases will be remote databases to the user

    In my opinion.
    using local databases -- access tables without DB_link
    using Remote databases -- access tables through DB_link

Maybe you are looking for