How to run EJB through a ide and not command line

I have been trying out a simple Cart EJB. I have no problem running the whole thing through command line using the runclient script. But when i compile and run the same code in my ide it chucks the following error
Caught an unexpected exception!
javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/SimpleCart
     at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)
     at javax.naming.InitialContext.lookup(InitialContext.java:350)
     at CartClient.main(CartClient.java:26)
Is there any reasons you cant run an EJB client code through an ide. This is the code i am using
// Decompiled by DJ v3.0.0.63 Copyright 2002 Atanas Neshkov Date: 8/20/2002 2:33:45 PM
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: CartClient.java
import java.io.PrintStream;
import java.util.Enumeration;
import java.util.Vector;
import javax.ejb.EJBObject;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class CartClient
public CartClient()
public static void main(String args[])
try
InitialContext initialcontext = new InitialContext();
Object obj = initialcontext.lookup("java:comp/env/ejb/SimpleCart");
CartHome carthome = (CartHome)PortableRemoteObject.narrow(obj, CartHome.class);
Cart cart = carthome.create("Duke DeEarl", "123");
cart.addBook("The Martian Chronicles");
cart.addBook("2001 A Space Odyssey");
cart.addBook("The Left Hand of Darkness");
Vector vector = new Vector();
vector = cart.getContents();
String s;
for(Enumeration enumeration = vector.elements(); enumeration.hasMoreElements(); System.out.println(s))
s = (String)enumeration.nextElement();
cart.removeBook("Alice in Wonderland");
cart.remove();
catch(BookException bookexception)
System.err.println("Caught a BookException: " + bookexception.getMessage());
catch(Exception exception)
System.err.println("Caught an unexpected exception!");
exception.printStackTrace();
}

Are you setting the system properties for your Java runtime in the IDE?
You might need some command-line options along the lines of
Djava.naming.provider.url=BAR -Djava.naming.factory.initial=FOO
Failing that you might have to do a global JNDI lookup instead of a local one but that'd be far from ideal.

Similar Messages

  • How to run jFram created by Netbeans in the command line or Jcreator

    Dear Friends
    I have designed a fram in Netbeans and the fram have many Jbox and Jcheck Boxes and Text areas. Net beans uses it is oun library. However after I used the facilities and finished the design I am looking to run it in faster IDE, such as Jcreator.
    The problem is that Netbean uses its library and Jcreator is not identifying it. My question, How to have it working else outside netbeans.
    here is the main problem, not sure how to have it available out side netbeans,ext such as
    getContentPane().add(jTextField11, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 120, 50, 20));
    Thanks for any help

    Dear Friends
    I have designed a fram in Netbeans and the fram have
    many Jbox and Jcheck Boxes and Text areas. Net beans
    uses it is oun library. However after I used the
    facilities and finished the design I am looking to
    run it in faster IDE, such as Jcreator. This is bullshit. You shouldn't run apps from within an IDE. And there's certainly no speed difference for your app.
    The problem is that Netbean uses its library and
    Jcreator is not identifying it. My question, How to
    have it working else outside netbeans.Import the library orjust use standard classes.

  • How to run a Servlet Project's .war from Command Line??

    Hi there,,
    Can anybody help me with how to run a Servlet Project's .war file from command line??In fact I tried it using the following command,
    java -jar TestServProj.war
    but I get the following error,,,
    Failed to load Main-Class manifest attribute
    I can't find the project''s manifest file in the META-INF folder.
    Moreover,plz help me about know how to execute a single servlet class from command line...
    Thanks in advance...

    you cant run a .war file from command prompt
    .war files should be executed in a server
    how to execute a single servlet class
    do you mean to run the servlet or compile the servlet?
    any way you need a server and if you are a beginner Apache tocat will be the best server to start with you can down load it from
    http://tomcat.apache.org/

  • How to run adt.bat created installer silently from command line?

    All,
    I totally get how to create an installer like so:
    adt -package -target native c:\AirExe\myApp.exe c:\AirExe\myAirApp.air
    Is it possible to run the installer silently from the command line?  Part of our smoke test process is to do nightly builds which would include the adt command above.  What we're missing right now is automatically copying the installer to a QA machine and silently install from the command line.  Currently, we have a QA engineer manually running the GUI installer.
    We want to automate as much of our process as possible and without installing silently from the command line, we're kind of dead in the water for automating this process.  Thanks...
    Matt

    Spent an hour last Friday on hold with Adobe support, bounced around to 4 different CSR's and no love getting my question answered.
    I spent part of my weekend solving this.  I'm sure there are other solutions, but here goes:
    1) Downloaded the 7-Zip utility from here: http://www.7-zip.org/
    2) Added c:/Program Files/7-Zip to my path (this helped with interactive testing from the command line)
    3) Made the following edit to my ant build.properties file:
         a) 7_ZIP_HOME=C:/Program Files/7-Zip
    4) Made the following edit to my ant build.xml file:
         a) <exec executable="${7_ZIP_HOME}/7z.exe">
               <arg line="x build/INSTALLER_CREATED_WITH_ADT.exe -obuild -y"/>
             </exec>
    Hope this saves someone else a little time...
    -M    

  • How to run audio through Optical in and out through PC speaker jacks

    Hi everyone, I recently purchased a SoundBlaster Z because of the optical audio ports, and I am trying to run Optical audio from my Playstation 3 through the Optical In port and out to my 5.1 Surround PC speakers. I can't find any settings in the control panel (literally there is only one setting, to change the encoder, no other options and profile button doesn't work). I tried running the speaker configuration application but nothing happens when executed. Can anyone provide assistance with this?
    I tried using the Auto update application, and go figure, it stops working every time I run it as well. Does any of their software work?

    Tried using Creative Diagnostics, and that too does not run at all.Creative Utility.jpgCreative Auto Update.jpg
    Is this what the Contol Panel is supposed to look like? It doesn't seem like there is anything to control, besides the volume and encoder.

  • How to run internet through Network provider conne...

    Hi i want to know how to run internet through netwok provider?
    I tried but not got anysolution it asking for WIFI only

    i have those settings but after i gave mobileto reinstall the firmvare software to NOKIA CARE, and now its not asking
    i have good service provider, on any mobile i insert sim the sim automatically sends messeage gets its settings and asks to install that settings
    But now its not asking on My N97 it means i already have butnot asking to choose
    I am using DOCOMO
    Message Edited by dbzbux on 29-Oct-2009 06:55 AM

  • How to run ejb application OC4J J2EE Container

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

  • How to run EJB IN WEBLOGIC8.1?

    Hi
    Can any one tell me how to run Ejb in Weblogic8.1?
    Thanks

    bikash2007 wrote:
    how to run ejb using WEBLOGIC8.1?you noticed, of course, that the original request was 3 years old.
    same as any other java ee app server, of course - package your ejbs in an ear and deploy it to the /application directory once you've created a user domain for that project. consult the bea docs for the details, but that should be enough to get you started.
    %

  • I am beginer with EJB .Someone can show me how to run EJB,please

    I am beginer with EJB .Someone can show me how to run EJB,please
    You can give me 1 example Complete and present Compltely!
    My Email : [email protected]
    Thanks you!

    Do the same that the rest of us do: buy a book. Enterprise Javabeans 3 from O'Reilly is an excellent book that will teach you all you need to know, if you are willing to put in a little effort.

  • How to run EJB in Tomcat4,1

    Hi All
    Can any one tell me how to run EJB in Tomcat4.1?
    Thanks

    Can any one tell me how to run EJB in Tomcat4.1?You would need something for that, like Open EJB
    http://openejb.codehaus.org/

  • I have an iTunes account with a $25.00 credit but everytime I go to purchase a song, it goes to my credit card details. How do I use the iTunes credit and not the credit card?

    I have an iTunes account with a $25.00 credit but everytime I go to purchase a song, it goes to my credit card details. How do I use the iTunes credit and not the credit card?

    Just to confirm, you are logged into the iTunes Store using the account in which the balance exists, and the balance is showing at the top of the iTunes Store window? And you're not trying to purchase gifts for someone else?

  • How do we delete duplicates songs easily and not one at a time in iTunes?

    how do we delete duplicate songs easily and not one by one in iTunes?

    I've written a script called DeDuper which can help remove unwanted duplicates. See this  thread for background.
    tt2

  • How do you move a single album, and not the whole library, in iPhoto to an external hard drive?

    How do you move a single album, and not the whole library, in iPhoto to an external hard drive?

    File -> Export to a folder and copy it over.
    That will give you a folder with the images. There is no way to move an album outside of iPhoto. You would need to have a library containing it.
    Regards
    TD

  • How do you print an email attachment and not the email itself. please.

    how do you print an email attachment and not the email itself.  please.
    This question was solved.
    View Solution.

    Hi there, if there is text in the body of the email it will print automatically when sent to an ePrint email address. The only way to just have the attachment print is for there to be no text in the email body.
    Hope that helps answer your question.
    If my reply helped you, feel free to click on the Kudos button (hover over the "thumbs up").
    If my reply solved your problem please click on the Accepted Solution button so other Forum users may benefit from viewing the post.
    I am an HP employee.

  • How do I upload my contacts, calendar and notes from outlook 2007 to my new iPad with retina display

    I just cleaned up my outlook 2007 contact files.
    I have an iPhone 5, a new iPad with retina display, and a PC, which is where the outlook program is.
    I also have an iCloud account
    How do I get the contacts, calendar and notes from outlook to any of these devices, so I can have one synced contact file on all three devices?
    I'm sure I am not the first one asking about this but I am new to Apple, and loving it.

    With your device connected and iTunes open, navigate to the 'info' tab and scroll down. You'll see the option to sync contacts and such from outlook.

Maybe you are looking for

  • Document "could not be saved"

    Hi everyone Frequent frustrating problem: Often get the error message, "The document ** could not be saved". Usually it is a .mov exported out of FCP for Soundtrack. Can anyone advise me what I am doing wrong? Very many thanks Roy

  • Windows error code 0x800f0922

    I want to install .net framework but i keep getting the same error code. How do i fix it? I've also tried it by the windows feature on and off, same thing, How do i fix this? Need some help....

  • Pagemaker 7and 2D barcodes

    Can anyone tell me what add-in/plug-in I need to add 2D barcodes to a Pagemaker 7 document? THanks

  • C3 'Touch And Type' IMAP Woes

    Hi all, Got a C3 Touch And Type and actually really like the phone. However, major shock came when I tried to configure IMAP email for my custom IMAP email account. Just can't get it to work. After starting Nokia Mail, I selected 'Other' from the emi

  • My msi GT60 OND-255AEK120.......... cannot registered thru msi website

    I bought msi notebook last 11 of January in United Arab Emirates in plugins marina mall, model GT60 OND, but when i tried to register to msi website saying that the serial number is not format or error, how can i registered this to get support form t