1 Reply Latest reply on May 22, 2005 1:11 PM by djpeanut

    Problem running client app for simple example bean

    djpeanut

      Hi all,

      I've been working through O'Reilly's 'Enterprise JavaBeans' textbook. Instead of just downloading the workbook examples for each chapter, I've written the code for the first bean (Cabin EJB), compiled it, written the deployment descriptors (standard and jboss-specific), packaged it as .jar and deployed it. JBoss reports that deployment is successful.

      The problem, however, is the first client class. It uses JNDI to find the remote home interface, creates an instance of the Cabin EJB, populates its fields, then retrieves the same fields using findByPrimaryKey() and prints them. This complies fine and I see no problem in the code. However, when I try to run it, I get the following error, which as far as I can tell from Google searches is something to do with my 'classpath' rather than the code:

      // JBoss console messages
      14:25:55,937 INFO [EjbModule] Deploying CabinEJB
      14:25:56,671 INFO [EJBDeployer] Deployed: file:/C:/jboss-4.0.1sp1/server/default/deploy/cabin.jar

      // error when running java
      C:\workbook\dev>javac com\titan\clients\client_1.java

      C:\workbook\dev>java com\titan\clients\client_1
      Exception in thread "main" java.lang.NoClassDefFoundError: com\titan\clients\client_1 (wrong name: com/titan/clients/client_1)
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)

      C:\workbook\dev>

      I don't really know what a classpath is, other than it's something to do with directories to do with java. JBoss startup gives me:

      JBoss Bootstrap Environment
      .
      JBOSS_HOME: C:\jboss-4.0.1sp1\bin\\..
      .
      JAVA: C:\j2sdk1.4.2_07\bin\java
      .
      JAVA_OPTS: -Dprogram.name=run.bat -Xms128m -Xmx512m
      .
      CLASSPATH: C:\j2sdk1.4.2_07\lib\tools.jar;C:\jboss-4.0.1sp1\bin\\run.jar


      Does anyone have any idea why I can't run my client? It's frustrating because I can't progress any further through the example application until I can run these clients...

      TIA!