[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

10/13/2009 at 06:38AM PDT, ID: 24807650 | Points: 500
[x]
Attachment Details

java.lang.NoClassDefFoundError: weblogic/kernel/KernelStatus

Asked by SBalaji in BEA WebLogic Application Server, Enterprise Java Beans (EJB)

Tags: EJB client in WebLogic workshop

i am getting the following error in my WebLogic workshop

Exception in thread "Main Thread" java.lang.NoClassDefFoundError: weblogic/kernel/KernelStatus
at weblogic.jndi.Environment.<clinit>(Environment.java:73)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at com.wily.ejb.HelloClient.main(HelloClient.java:32)

can you please give me a client which i can use to invoke my EJB?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
Server code:
 
package com.wily.ejb;
 
import javax.ejb.SessionBean;
import weblogic.ejb.GenericSessionBean;
import weblogic.ejbgen.Session;
import weblogic.ejbgen.JndiName;
import weblogic.ejbgen.FileGeneration;
import weblogic.ejbgen.Constants;
 
/**
 * GenericSessionBean subclass automatically generated by Workshop.
 *
 * Please complete the ejbCreate method as needed to properly initialize new instances of your bean and add
 * all required business methods. Also, review the Session, JndiName and FileGeneration annotations 
 * to ensure the settings match the bean's intended use.
 */
@Session(ejbName = "Hello")
@JndiName(remote = "ejb/HelloRemoteHome")
@FileGeneration(remoteClass = Constants.Bool.TRUE, remoteHome = Constants.Bool.TRUE, localClass = Constants.Bool.FALSE, localHome = Constants.Bool.FALSE)
public class Hello extends GenericSessionBean implements SessionBean {
	private static final long serialVersionUID = 1L;
	
 
	/* (non-Javadoc)
	 * @see weblogic.ejb.GenericSessionBean#ejbCreate()
	 */
	public void ejbCreate() {
		// IMPORTANT: Add your code here
	}
 
	// IMPORTANT: Add business methods
	public String sayHello(String name) {
		return "Hello "+name;
	}
}
 
Client code:
 
/**
 * 
 */
package com.wily.ejb;
 
import java.util.Hashtable;
 
import javax.naming.Context;
import javax.naming.InitialContext;
 
/**
 * @author sirba01
 *
 */
public class HelloClient {
 
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try{
		//Hashtable tab = new Hashtable();
		//tab.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
		//tab.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
		//tab.put("java.naming.provider.url", "jnp://localhost:1099");
		
			Hashtable tab = new Hashtable();
		tab.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
		//tab.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
		tab.put(Context.PROVIDER_URL, "t3://localhost:7001");
		Context ctx = new InitialContext(tab);
		Hello obj = (Hello) ctx.lookup("ejb/HelloRemoteHome");
		
		//service = (ReviewService) ctx.lookup("java:comp/env/ejb/ReviewManager");
 
		//InitialContext ic = new InitialContext(tab);
		//Hello obj = (Hello) ic.lookup("ejb.HelloRemoteHome");
		
		System.out.println(obj.sayHello("Srujana"));
		}
		catch(Exception e){
			e.printStackTrace();
		}
		
 
	}
}
[+][-]10/13/09 07:31 AM, ID: 25560302

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/13/09 07:38 AM, ID: 25560392

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/13/09 07:46 AM, ID: 25560509

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/14/09 02:25 AM, ID: 25568499

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74 - Hierarchy / EE_QW_3_20080625