in thread "main"

java.lang.NoClassDefFoundError: weblogic/kernel/KernelStatus
    at weblogic.jndi.Environment.<clinit>(Environment.java:78)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

I am getting this exception when I try to create a initial context to hit the weblogic server. This is the code I am trying from eclipse.I have added weblogic.jar and wlclient.jar in the classpath.

 Hashtable env = new Hashtable();
        // WebLogic Server 10.x connection details

        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
        env.put(Context.PROVIDER_URL, "t3://localhost:7001");
        env.put(Context.SECURITY_PRINCIPAL, "xxxxx");
        env.put(Context.SECURITY_CREDENTIALS, "******");
        return new InitialContext( env

Has anyone faced this issue,How to resolve it?

link|improve this question
feedback

2 Answers

Instead of wlclient.jar try using wlfullclient.jar

link|improve this answer
still the problem persists – Harish Nov 9 '10 at 20:42
feedback

java.lang.NoClassDefFoundError means the runtime version of the class in the classpath is not the same as that at compile time.

Note: it's not a ClassNotFound exception

Your problem is multiple versions of the class being found.

weblogic/kernel/KernelStatus is found in wlclient, so check if this class is also present in weblogic.jar and test by removing one of these from your classpath. I think you only need wlclient, so remove weblogic.jar and try first

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.