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

Similar Messages

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

  • 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

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

  • Error in the module RSQL accessing the database interface

    I have written the following query.
    SELECT  a~no
             a~hist_no
             a~chk_stat
             a~chk_date
             a~user as chk_user
             b~name as chk_by
             into corresponding fields of table hist
             from zhist as a INNER JOIN zuser as b on
             auser = bbname
             where pspnr = v_pspnr
             and   chk_no = v_chk_no.
    I am getting the dump "Error in the module RSQL accessing the database interface".
    Please provide me the solution.
    Thanx,
    Selva.

    Hi,
    As i have analysed your query in that you are putting the data in the internal table 'hist' which is also a standard structure and if you check in SE11 'hist' is the standard structure for 'Tablespace History' and might be because of that it is causing the problem.
    Kindly check by changing the name of the internal table to tt_hist and then try.
    I think that will solve the problem.
    Regards,
    Harsh Goel

  • Error saying "Error in the module RSQL accessing the database interface"

    Hi,
    there is a standard program available for retrieving the assets for the given cost centres on the selection screen.
    Our requirement is instead of cost centre we have to retrieve the assets for the given cost centre group.
    We have to find all the cost centres available on the given cost centre group and its child nodes.
    For all these cost centres we will be retriving the asset history data.
    So we copied the standard program into another Y program and made the changes to it.
    What's happening is if we give the top most Cose centre group node there are 16000 cost centres available . while retriving the asset history data for all these cost centres an runtime error occurs in a standard program saying
    "Error in the module RSQL accessing the database interface, " DBIF_RSQL_INVALID_RSQL ".
    The error occurs while executing the statement Fetch Next cursor in a standard Include program.
    <b>This happens only if we give huge range of data. If we give small range of data it
    works fine</b>.
    Can anyone help me in this by saying why it occurs and what will be the solution for this.
    Thanks.

    Hi camila,
    The huge range is part of the query string passed to the database.
    While an MP3 music gadget easily stores a gigabyte of data, ORACLE was able to increase the maxium size of a query string from 16 k to 32 k bytes in the last 5 years.
    <b>Unbelievable but true!</b>
    Just multiply the number of entries in the range with the field length and see where go go...
    Regards,
    Clemens

  • Access the local Mac's Time Machine without its external USB HDD?

    Hello.
    Is it possible to access the local Mac's Time Machine without its external USB HDD? Or is the external backup HDD required? This is assuming Mac OS X 10.8.5. I am not sure if the newer versions can do it.
    Thank you in advance.

    Eric Root wrote:
    Those are local snapshots. The best thing to due is backup Time Machine and then access it.
    Local Snapshots on Portable Macs
    How do I access these local (one/1)s without the external HDD connected? I do not get the TM icon option in my top menu bar.

  • How can I access the IrDA Interface ?

    How can I access the IrDA Interface (LABWindows/CVI) in my application to transmit data serial, for example between a Laptop and a device?

    How does your IrDA interface show up in your system? (COM Port, custom device, etc.)

  • Add-spshelladmin : Cannot access the local farm - SharePoint 2013

    Hello,,
    We installed a SharePoint tool on a SharePoint 2013 server, and now the site is down.  One error is happening:
    add-spshelladmin : Cannot access the local farm. Verify that the local farm is
    properly configured, currently available, and that you have the appropriate
    permissions to access the database before trying again.
    Prior to installing this tool, the SharePoint PowerShell was working. I am running the power shell with admin rights.  The farm account is still in the local admin group, and its in the WSS_RESTRICTED_WPG_V4 group.  All commands and the site were
    working fine, until we installed the tool.
    How can I get the PowerShell Management shell working again?
    Thanks.
    Paul

    It sounds like your tool has brought down SharePoint or messed with your permissions. Restart the server and then starting at the SQL work your way through SQL connections, IIS Application Pools, IIS Sites, event logs and so on until you find a reason for
    where the farm is broken.
    Also try to identify what exactly else is and isn't working. If the entire farm is dead then complaining that PowerShell doesn't work is like complaining that your water seems to be seeping into your stateroom on the titanic and it's getting the carpet damp,
    it may be true but it's not the most significant issue...

  • I got a new computer, and now i cannot access the local files for my website (Dreamweaver)...help?

    I got a new computer, and now i cannot access the local files for my website (Dreamweaver)...
    the new computer is a Mac.
    I see the site on my computer files, but it will not connect with Dreamweaver on this new computer.
    can anyone help with this?
    thanks,
    Margaret

    no special characters...
    see if this gives you any info...

  • HT4211 Alternatives for accessing the multitasking interface ...?

    Is there any other way then the "double-clicking of the home button" to access the multitasking interface ?
    Like "pinching the screen" with all fingers for example ? 
    ( I don't like clicking the home button all that much )
    BabaO

    Geeeezuus I thought I had checked all of that Settings/General .....
    Generally though: why is it that when you're looking for something specific you never find it, despite "it" starring you right in the face !!??!
    Thank you for taking the time

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

  • How to access the local server host website in the internet

    I set up the server and host on local website, I wonder how I could use other mac to access this local website via the internet?
    Thanks!

    The following should give you enough to search for discussions, as well as some general details of IP network gizmos and boxes:  You'll need an ISP tier of service that allows remote access and preferably with a static IP address (static versus dynamic IP).  This as various ISPs prohibit server-oriented protocols such as HTTP TCP port 80 traffic, and some firewall server-oriented ports.   You'll then either need to use either dynamic DNS with your public dynamic IP — this is the hacking-around and not-really-for-production approach — or static IP with traditional DNS, and you'll also need to enable what's called port forwarding (sometimes also called virtual server) through your gateway-firewall-NAT device and into your server for TCP port 80 and possibly also TCP port 443.  This port forwarding gets the incoming connections from the 'net into your public IP address (static or dynamic) mapped through to your NAT'd IP address space and your private IP address for your server. 
    As the first part of getting any of this to work with OS X Server, launch Terminal.app on the server and issue the following harmless diagnostic command:
    sudo changeip -checkhostname
    This checks for common errors in the local DNS setup, and broken networking and broken DNS tends to cause other errors elsewhere in the environment.  You'll need to enter an administrative password for the sudo, you might get a one-time informational message from the sudo, and you'll then get some configuration details and then an indication that DNS and local networking needs no changes, or that there are configuration issues.

  • JAAS: How can I access the JAAS subject in an EJB?

    Hello,
    I try to understand the JAAS integration in J2EE 1.3.
    I know:
    J2EE defines a role-based container managed authorization for the web and ejb container. Roles, users and their relationship are defined in the realm.
    JAAS has a more sophisticated policy-based authorisation model. Since J2EE1.3 I can define a realm using JAAS having the role-based authorization of the container managed security.
    My question:
    How can I access the JAAS subject object in an EJB or servlet to use the policy-based authorization?
    Thank you for your answers
    Peter

    May be I should redefine my question:
    If I use JAAS as J2EE-Realm, how can I receive the subject?
    All JAAS-Tutorials contains code fragments like
    LoginContext lc = new LoginContext("entryFoo");
        try {
            // authenticate the Subject
            lc.login();
            System.out.println("authentication successful");
            // get the authenticated Subject
            Subject subject = lc.getSubject();But if I use JAAS as J2EE-Realm the container creates the LoginContext.
    Whom can I ask for the subject now?
    There is no such method implemented in the EJBContext, the HttpServlet or HttpServletRequest!
    Peter

  • Preventing ejbgen generating a pk setter on the local interface

    The spec states (10.3.1) that the setter for the pk cmp-field should
    not be exposed on the component interface yet the interface
    generated by ejbgen does in fact generate the setter.
    How do I prevent this?

    Just make sure that you delete something like the following on top of the
    setter
    @ejbgen: local-method
    "Aaron" <[email protected]> wrote in message
    news:3f88ecce$[email protected]..
    >
    The spec states (10.3.1) that the setter for the pk cmp-field should
    not be exposed on the component interface yet the interface
    generated by ejbgen does in fact generate the setter.
    How do I prevent this?

Maybe you are looking for

  • Using airport disc as a music server, and playing music over airtunes

    I know that I can put my itunes library on an external hard drive, and that I could access this external hard drive wirelessly if I attached it to an airport extreme. However, if i did this would I still be able to play music over airtunes. It seems

  • Dialer Watch List on Pri dialer????????

    Dear All, I have a 2811 router... In which I want to configure the dialer watch list.. Plz clarify which ip shud we put on dialer watch list...???? Is it the route . plz find the example below.. boot-start-marker boot system flash c2800nm-entbase-mz.

  • Can't install Photoshop Elements 11 licensed version because of trial version

    I can't install Photoshop Elements 11 licensed version because of trial version that is still on my computer and is not being completely uninstalled.  The intended folder to install has some files remaining from the trial version, and this prevents t

  • Why is Safari failing to work on more and more websites?

    From unresponsive form boxes, to failure to respond to search requests, to working with 1Password extension, the Apple browser has stopped being effective and unresponsive on more and more websites. I switch to Firefox and all is well.  What gives?

  • Adding sound to rollovers,buttons.. etc..etc.. ok.. i'm new ( forgive me)

    Greetings.. I'm helping the community develop a webpage to promote .. well.. the community.. and have been put in chagre of sounds... Is there an easy way, using java, to add rollover, button down, etc..etc sounds to a webage??? I guess all sounds wo