Results 1 to 3 of 3
  1. #1
    mirik is offline Member
    Join Date
    Nov 2009
    Rep Power

    Question Cannot run EE client

    Hi all.

    I created a simple stateless EE EJB3 and its client.
    I succeed the execute the client with appclient:
    C:\j2ee-projects>appclient -client testclient.jar

    But I have a problem when running it with jar name:
    C:\j2ee-projects>java -jar testclient.jar
    Exception in thread "main" java.lang.NullPointerException
    at testclient.main(

    And also when running it with class name:
    C:\j2ee-projects>java -cp chapter1-ejb.jar;testbeans.jar testclient
    Exception in thread "main" java.lang.NoClassDefFoundError: testclient
    Caused by: java.lang.ClassNotFoundException: testclient
    at$ 200)
    at Method)
    at ava:188)
    at java.lang.ClassLoader.loadClass( 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche
    at java.lang.ClassLoader.loadClass( 52)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade
    Could not find the main class: testclient. Program will exit.

    This is the manifest file inside testclient.jar:
    Manifest-Version: 1.0
    Class-Path: chapter1-ejb.jar testbeans.jar
    Main-Class: testclient

    Could someone tell what is the problem there?

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Rep Power


    When you run it as a jar file, there is something required at line 9 of testclient which you are not providing and causing the null pointer.
    When you run it as a class, add the folder containing the testclient.class to the classpath as well. If it is the current directory then add dot, ie .

    P.S Better put your classes in packages and name then according to Java naming conventions.

  3. #3
    mirik is offline Member
    Join Date
    Nov 2009
    Rep Power

    Default Cannot run EE client

    Thanks for response r035198x.

    Here is the correct answer:
    The @EJB annotation can be used only inside another EE container or by appclient.
    In order to call it from POJO utility class you should write:
    Context ctx = new InitialContext();
    testint cls = (testint)ctx.lookup("testint");
    }catch(Exception ex) { ex.printStackTrace(); }

Similar Threads

  1. get client ip
    By Ozmosis in forum Networking
    Replies: 4
    Last Post: 11-07-2009, 05:12 PM
  2. Replies: 3
    Last Post: 07-29-2009, 04:52 AM
  3. client app
    By santhu538 in forum New To Java
    Replies: 1
    Last Post: 02-28-2009, 07:54 AM
  4. Replies: 1
    Last Post: 10-05-2008, 03:12 PM
  5. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 10:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts