Standalone Client of Stateless Session Bean step by step

Let us develop standalone EJB client

The Enterprise Java Bean can be accessable from any Java program over the network.
Follow the below steps to create EJB client.

Step 1: Create Java project - "StatelessDemo1Client"
File -> New -> Project -> Java -> Java Project -> Next. You will get below screen.
EJB client
Specify the project name and click Next.

Click Finish :

Step 2: Add Weblogic.jar in the classpath
Right click on Java Project -> Properties -> Java Build Path -> Active Liberaries -> Add External Jars. You will below screen.
add weblogic.jar in classpath
Select the weblogic.jar from server installation directory. In my case it is - C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar and click ok.

Step 3: Add EJB project in the classpath
Right click on Java Project -> Properties -> Java Build Path -> Active Projects -> Add Project. You will get below screen

Step 4: Create and edit as below -
 package techmyguru.ejbclient;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import techmyguru.stateless.SessionConverterRemote;
public class StatelessClient1 
public static void main(String[] args) {
try {
Properties p = new Properties();
p.put(Context.PROVIDER_URL, "t3://localhost:7001");
InitialContext context = new InitialContext(p);
SessionConverterRemote remote = (SessionConverterRemote
System.out.println("The converted dollar is "+remote.convert("euro""10"));

catch (Exception e

Step 5: Run StatelessClient1 and get below output :
Right click on source code and Run As -> Java Application. You will get below screen.

Previous Download Source Code Next

Share your valuable comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code :