Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while invoking ClientApplication of a EJB

sameer barale
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I m deploying my Stateless session bean on JBoss3.0.8. I m trying very simple example of Hello World. My Project Directory Structure is as Follows:

| |___examples/
| |___client java files(
| |___examples/
| |___server (bean) java files(
| |___META-INF
| |___ejb-jar.xml , jboss.xml
| |___examples/
| |___remote and home java files(,
|___client and server jars (helloclient.jar,helloserver.jar)
| |___examples/
| |___client,remote,home java classes(HelloClient.class)
| | **
|___server (bean), remote and home java classes

Client program
package examples;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
public class HelloClient
public static void main(String [] args) throws Exception
Properties props = System.getProperties();

Context ctx = new InitialContext(props);
Object obj = ctx.lookup("HelloHome");

HelloHome home = (HelloHome)
javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);

Hello hello = home.create();

ejb-jar.xml is:

jboss.xml is



******************** is

I compile client and server src files with:

javac -classpath %LIBDIR%\jboss-j2ee.jar -d
target\client src\client\com\examples\*.java

javac -classpath %LIBDIR%\jboss-j2ee.jar -d
target\server src\server\com\examples\*.java


I execute the following command from my c:\ejb_example\target\client directory:
jar cvf ..\..\assemble\helloclient.jar .


I execute the next command from my c:\ejb_example\target\server directory:
jar cvf ..\..\assemble\helloserver.jar .


Now, I put helloserver.jar in %JBOSS_HOME%\server\default\deploy directory
and start the server.
then, I wish to run the client:
I Create a LIBDIR environment variable and set it to the client directory under JBOSS_HOME (for instance, %JBOSS_HOME%\client).

From the command prompt (all as one line):

java -classpath helloclient.jar;%LIBDIR%\jnp-client.jar;%LIBDIR%\jboss-common-client.jar;

I set the following classpath:
C:\EJBPractice\src\assemble>set classpath=%classpath%;C:\EJBPractice\src\target\client;

and try to run the client
C:\EJBPractice\src\assemble>java -classpath helloclient.jar;%LIBDIR%\jbossall-client.jar;%LIBDIR%\jboss-client.jar;%LIBDIR%\jboss-common-client.jar;%LIBDIR%\jboss-j2ee.jar;%LIBDIR%\jboss-net-client.jar;%LIBDIR%\jnp-client.jar;%LIBDIR%\jnet.jar examples.HelloClient

But i got following Error:

Exception in thread "main" java.lang.NoClassDefFoundError: examples/HelloClient

well! is this aerror with classpath? and Is everithing ok with jndi and procedures i describe above.
Please help me if u can... )
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic