This is a very simple question,but I don't know.Please me.Thank you!

I am a Chinese student in a university.I have a very simple question to ask.
I have writed a EJB module,and I have deployed to Weblogic8.1 successfully.
1.Now I want to write a client program.Is it necessary that the client program is packaged in the EJB package.For example ,the EJB package is Beans,is "package Beans " or "import Beans.*" necessary in my client program.
2.If I only know the EJB interfaces,that means the EJB module is writed by other programer.I want to know how I can write the client program.How can I call EJB module's method writed by other programer.Could you give me a simple example?
Thank you very much.

I have writed a EJB module,and I have deployed to
Weblogic8.1 successfully.:-)
1.Now I want to write a client program.Is it
necessary that the client program is packaged in the
EJB package.For example ,the EJB package is Beans,is
"package Beans " or "import Beans.*" necessary in my
client program.You need not package your client with the EJB. It can be a JSP/servlet or a stand-alone application.
2.If I only know the EJB interfaces,that means the
EJB module is writed by other programer.I want to
know how I can write the client program.How can I
call EJB module's method writed by other
programer.Could you give me a simple example?
import java.util.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import examples.*;
class TestEJBHello {
    public static void main(String[] args) {
        Context context   = null;
        Object object     = null;
        // Hashtable for environment properties.
        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "t3://localhost:7001");
        HelloHome home            = null;
        HelloWorld hello          = null;
        try {
            context     = new InitialContext(env);
            object      = context.lookup("HelloWorldTest");
            System.out.println(" JNDI Looked up >>> " +object);
            home        = (HelloHome)PortableRemoteObject.narrow(object, HelloHome.class);
            hello       = home.create();
            System.out.println(hello.hello());
        } catch(Exception e) {
            e.printStackTrace();
        } finally {
            close(context);        // Closes the initial context.
    private static void close(Context context) {
        try {
            context.close();
            System.out.println("*** Context closed. ***");
        } catch (NamingException namingException) {
            namingException.printStackTrace();
        } catch(Exception exception) {
            exception.printStackTrace();
}Here's a sample client app code I use for a HelloWorld EJB. You need to have a EJB client JAR containing the home and remote interfaces in the classpath during compile time and runtime.
x

Similar Messages

  • When I go to buy an app that isn't free it asks for my security question but I don't know what my security question is so I go to change it and it said it will send the info to this email that I don't even have. What do I do?

    When I go to buy an app that isn't free it asks for my security question but I don't know what my security question is so I go to change it and it said it will send the info to this email that I don't even have. What do I do?

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
         4. Account security issues almost always require you to speak directly to an
             Apple representative to securely establish your identity as the account holder.
             You can set it up so that Apple calls you, either immediately or at a time
             convenient to you.
                1. Go to www.apple.com/support.
                2. Choose Contact Support and click Contact Us.
                3. Choose Other Apple ID Topics and choose the appropriate topic for
                    your issue.
                4. Follow the onscreen instructions.
             Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                            Apple ID- All about Apple ID security questions.

  • I forgot my security question and it won't let me buy any songs but whenever i go to manage my apple id it says i need to tell the answers to the security questions but i don't know them someone please help

    i forgot my security question and it won't let me buy any songs but whenever i go to manage my apple id it says i need to tell the answers to the security questions but i don't know them someone please help

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, and filling out and submitting this form.
    (96813)

  • Please a simple problem but I don't know how to solve it. After installing 16 gb of ram all is good but when I turn on the computer it is a window signaling that all is correct. How is possible to delete once and for all that window? Thank you

    Please a simple problem but I don't know how to solve it. After installing 16 gb of ram all is good but when I turn on the computer it is a window signaling that all is correct. How is possible to delete once and for all that window? Thank you

    Well then maybe you could take a screenshot because the appearance of such a window is news to me.
    Also post your OS X version and what model Mac you have. The more detail, the better. Thanks.
    To take a screenshot hold ⌘ Shift 4 to create a selection crosshair. Click and hold while you drag the crosshair over the area you wish to capture and then release the mouse or trackpad. You will hear a "camera shutter" sound. This will deposit a screenshot on your Desktop.
    If you can't find it on your Desktop look in your Documents or Downloads folder.
    When you post your response, click the "camera" icon above the text field:
    This will display a dialog box which enables you to choose the screenshot file (remember it's on your Desktop) and click the Insert Image button.
    ⌘ Shift 4 and then pressing the space bar captures the frontmost window.
    ⌘ Shift 3 captures the entire screen.
    Drag the screenshot to the Trash after you post your reply.

  • I want to reconstruct my security questions but I don't know how to put a reconstruction e-mail adress to my apple ID

    I want to reconstruct my security questions but I don't know how to put a reconstruction e-mail adress to my apple ID

    Click here for information. If you're trying to do this because you've forgotten the answers, you can't and need to contact Apple.
    (88012)

  • I signed into my Apple ID on a new phone and I already had it on my iPod. When I signed into the new phone it won't let me buy anything unless I know my old security questions but I don't know the answers to them. How can I get past those or change them?

    I signed into my Apple ID on a new phone and I already had it on my iPod. When I signed into the new phone it won't let me buy anything unless I know my old security questions but I don't know the answers to them. How can I get past those or change them?

    See Kappy's great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
     Cheers, Tom

  • I'm trying to buy some apps and it aked me to enter my security question but I don't know them how do I rest them plz help

    I'm trying to buy something and it keeps asking me to answer my security questions but I don't know them and I want to rest them plz help

    Contact iTunes store support for assistance: https://ssl.apple.com/emea/support/itunes/contact.html.

  • What do I do when I want to get an app and I need to answer security questions but I don't know them

    What can I do when I'm tying to get an app but then it asks me to answer to security questions but I don't know them

    1. See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities.
    2. Here are two different but direct methods:
        a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
        b. Call Apple Support in your country: Customer Service: Contacting Apple for support
            and service.
    3. For other queries about Apple ID see Frequently asked questions about Apple ID.
    4. Rescue email address and how to reset Apple ID security questions
    5. For online assistance use Apple - Support - Express Lane

  • I want to buy a song but I have to answer a security question but I don't know the answer

    I want to buy a song but I have to answer a security question but I don't know the answer

    Contact iTunes
    Apple - Support - iTunes - Contact Us

  • I'm trying to update my IPAD 2 to iOs 7.1.2 but don't have enough memory to do so.  In I-Tunes I'm told to change my media sync options to gain more memory, but I don't know how.  Can you help?

    I'm trying to update my IPAD 2 to iOS 7.1.2 but don't have enough memory to do so.  In I-Tunes I'm told to change my media sync options to gain more memory, but I don't know how.  Can you help?

    Turn off the check mark to sync your music and also the check mark for the video. Sync the device. This will remove the items from you iPad but still keep them on your computer. Install IOS 7.1.2. Then turn on the check marks for your music and videos and resync the device.

  • Simple G5 Questions but I don't know the answer to them

    I am a PC guy. I have always been, but I decided on getting an Mac to test one out. So I bought a used one. I bought a Power Mac G5. It has the dual 2.5Ghz, with 2Gb of ram. When I got it, it wouldn't do anything. Took the side of the case off and found there was a red light behind one of the processors. No problem at all. I got 2 new 2.5 GHz processors with heatsink. I installed them. Now the machine will turn on, but nothing really happens. The power light turns on for a second and then it turns off. I can hear the hard drive spin up. I can hear the fans kick on. There is nothing on the monitor.
    Question 1: I put a new hard drive in it, does a Mac machine have a bios screen like a windows machine does?
    Question 2: Is there nothing happening because I have no operating system loaded or should I atleast see something on the monitor? If I need to load an operating system that is fine, but how? I know that there are a lot of keys you can push as the power button on and it allows it to do different things.
    Question 3: If it is none of these, whatelse could it be? I have black screen, no power light, hard drive is spinning, and fans are spinning.
    Any help would be much appreciated. I have pushed the little reset button on the systembaord several times. I have taken the battery out for a minute or so several times.
    Thanks,
    Mike

    You should probably try booting into open firmware to begin with. Hold down the cmd-option-O-F keys at startup. You should eventually see the open firmware terminal screen, which is white background and black type. If you don't see it, you probably have a video card problem. Open firmware is about all you can really do on a machine without an OS somewhere, either on a hard drive or on an install or utility CD/DVD. Single user mode requires a regular OS installation and gives you essentially the Unix terminal.
    When you power up, the machine will go through a routine of power-on-self-test routines and if everything mostly passes, you will hear the famous Macintosh chime, which means that it is now looking for a boot volume. Some time later, a few seconds, the video card should light off initially and you might see some monitor activity. If your monitor has an indication of active video on its input, that is when it will show, either an LED color change or maybe a screen display situation. If you are not seeing anything to indicate that the monitor is being driven, then it may be that you have a tanked video card. If the video card is OK and other HW is working, then you should eventually get the grey Apple screen while the machine finds the boot volume. No boot volume will give you a folder/blinking question mark display.
    One final thing, which is you probably haven't formatted the drive to one of the Apple formats, which may also be hanging things up. You might want to disconnect the drive and see what happens when you power up as well.
    We know you are coming over from the dark side, but we're here to help you through to the light.

  • This might be a dumb question but i need to know?

    i have the new ipad 3rd gen 64g retina display and my question is does it hurt the ipad display if you take a picture of it with a cameras flash.does the cameras flash damage a ipad screen in any way?
    thanks everyone its been bugging me to know and im curios about it any answers would be great.

    No.

  • I'm trying to reset my security questions but I don't know what email it's sending to

    It won't let me download music off my phone till I answer my security questions but I forgot them. I tried resetting them but the email is sending to an email that isn't mine. I don't know what to do.

    The email address that shows for the reset link will be the rescue email address that you put on your account. If you don't have access to that email account (you won't be able to change the rescue emai address until you can answer 2 of your questions) then you will need to contact iTunes Support / Apple to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset you can then use the steps half-way down this page to view/updat your rescue email address for potential future use : http://support.apple.com/kb/HT5312

  • I know this is in the wrong place but I don't know where to ask. Anyway...

    I was wondering how long it takes to get the iPod rebate after paying for it with your MacBook Pro order? If nobody knows the answer could you please point me in the right direction in terms of who to ask?
    Thanks alot!
    -George

    I guess they would better know how long it has been taking for the rebates.
    When we were making the order
    You previously wrote, "I haven't ordered the iPod yet"
    "PURCHASE RESTRICTIONS: Except as otherwise provided in these terms, the Apple _computer and iPod must be purchased on the same invoice/sales receipt_."
    If you already ordered the computer but not the iPod, you do not qualify for the rebate.

  • My new MacBookPro makes a low grinding noise when starting from shutdown. It interferes with the normal startup music. Is this normal or should I take it back to the store, please? Thank you. Colin.

    My MacBookPro makes a low grinding sound when it starts up from shutdown. Is this normal or should I return it to the store. The sound is not unlike the CD drive starting in my old computer. It kind of creeks. Thank you. Colin.

    If it is a brief sound, perhaps a half second in duration, it may very well be the OS checking the internal optical drive.  That is part of the OS startup process which is normal.  Start your MBP and put your ear next to the optical drive and see if this is the case.
    Ciao

Maybe you are looking for

  • Opening multiple RAW files in Adobe Camera RAW

    Former CS6 user. Now trying CC but can't find a way to select an open only the RAW files in ACR, in a folder that has both RAW and jpeg files. There are options for select certain types of files but RAW is not an option like it was in CS6. I need to

  • Check for Vendor PAN Number

    Hi, I want to make a check in vendor code creation. If vendor PAN Number not maintained then system will give an error message. Who I can make this check. Please provide me suggestion. Thanks & Regards, Hemant Maurya

  • Set diferent font in a paragraph text.

    In xml file,there is the following element: When I open the xml file in FrameMaker,the font of string "ZCCC2.1" should Times new roman,the font of string "ADCCCCCCCC" should another font. In EDD,title element is a framemaker element.How Can I deal wi

  • I have created a Muse site for a client that wishes to host with Business Catalyst. How do I publish the site with their account rather than using one of my free sites?

    I have created a Muse site for a client that wishes to host with Business Catalyst. How do I publish the site with their account rather than using one of my free sites? This is so I can keep my free ones for personal projects but also so they can pay

  • Project Structure Saving

    Dear all; i have a problem when saving projects specially in CJ20N. the entire structure is expanded (WBS's, Networks, Activities, Copmponents,... etc.). and all the data is read before the saving process takes place. So for large customers' projects