Saturday, November 27, 2010

Create Java EE project using Eclipse Helios 3.6. and Weblogic 10.3.3

Add Weblogic 10.3.3 runtime in Servers tab

Create EAR project

Create EJB project

Create session EJB

Add Session EJB method implementation
package dave;

import javax.ejb.Stateless;

* Session Bean implementation class TestSesssionEJB
@Stateless(mappedName = "TestSesssionEJB")
public class TestSesssionEJB implements TestSesssionEJBRemote, TestSesssionEJBLocal {

* Default constructor.
public TestSesssionEJB() {


public String hello(String name){

System.out.println("Hello" + name);

return name;



Add EJB project into EAR

Run on Server - deployment

Create wlfullclient.jar by running in $WLS_HOME/server/lib
java -jar wljarbuilder.jar

Add wlfullclient.jar and testEJB project to client classpath

Create client class

Get EJB name from JNDI tree

Create client implementation
package dave;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class TestClient {

private static String INITIAL_CONTEXT_NAME = "weblogic.jndi.WLInitialContextFactory";
private static String PROVIDER_URL = "t3://localhost:7001";
private static String JNDI_NAME = "TestSesssionEJB#dave.TestSesssionEJBRemote";

public static void main(String[] args) throws Exception {

Context ctx = getInitialContext();

TestSesssionEJBRemote testEJB = (TestSesssionEJBRemote) ctx

System.out.println("Say hello: " + testEJB.hello("dave"));


private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
return new InitialContext(env);


Check server log
<Nov 27, 2010 8:44:32 AM CET> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING> 
<Nov 27, 2010 8:44:32 AM CET> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
Nov 27, 2010 8:44:42 AM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Sun's JavaServer Faces implementation (1.2_03-b04-FCS) for context '/console'
Nov 27, 2010 8:44:42 AM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Completed initializing Sun's JavaServer Faces implementation (1.2_03-b04-FCS) for context '/console'



  1. I don't know whether this will be of any use to future readers .. but for those getting the following error:

    java.lang.NoClassDefFoundError: weblogic/kernel/KernelStatus

    The following is needed to fix the error:
    In the classpath tab, be sure to add the wlclient.jar file located here \wlserver_10.3\server\lib to the User Entries section and remove the WebLogic System Libraries from the Bootstrap Entries section. If you forget to remove the WebLogic System Libraries, you will get a stack like this: Exception in thread "Main Thread" java.lang.NoClassDefFoundError: weblogic/kernel/KernelStatus

  2. The above is applicable to the client project created in the last few steps ( the one with the jndi lookup code)