Question Locked

How to solve exception in thread "main" in stateless session beans

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hi
iam running my first stateless session bean( hello world). I have deployed it successfully in weblogic 8.1. But when iam running client side application iam getting the following error:

C:\proj1\Client>java HelloClient
Exception in thread "main" java.lang.NoClassDefFoundError: javax/security/auth/c
allback/CallbackHandler
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
extFactory.java:131)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.(Unknown Source)
at HelloClient.main(HelloClient.java:15)

C:\proj1\Client>

My client machine code is:
import javax.ejb.*;
import javax.naming.*;
import javax.naming.Context.*;
import javax.naming.InitialContext.*;
import java.util.*;
public class HelloClient
{
public static void main(String args[])
{
try
{
Hashtable env=new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL,"t3://localhost:7001");
InitialContext context=new InitialContext(env);
Object obj=context.lookup("swetaJndi");
HelloHome hor=(HelloHome)obj;
Hello ror=hor.create();
System.out.println(ror.sayHello());
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

please somebody help me out in solving the problem.
whats the error means? and how to solve it
plz help me out in executing my first ejb stateless session bean.

thanks in advance

2 replies

by robo_dev

UnsupportedClassVersionError error is thrown when you use system classes which are different from the JDK version.

For example, you may have different installations of JDK on your machine and you may be using JAVA command from one JDK and rt.jar which is included in the classpath from another version.

This discussion is closed to new replies.