Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/purvgwtw/public_html/tutorials/common.php on line 7
EJB Hello World Example
Sponsered Links
Categories
Sponsered Links

EJB Hello World Example

 

This is a simple EJB Hello World Example.

RemoteSessionBean.java

package ejb;
import javax.ejb.Remote;

@Remote
public interface 
RemoteSessionBean {

    String getMsg();   

    String getName();
}

 

SessionBeanApp.java

package ejb;
import javax.ejb.Stateless;

@Stateless
public class
SessionBeanApp implements RemoteSessionBean, SessionBeanLocal {

    public String getMsg() {
        return "Hello World";
    }   
    public String getName() {
        return "JspServletTutorial.info";
    }
}

 

Main.java

package enterpriseapp;

import ejb.
RemoteSessionBean;
import javax.ejb.EJB;

public class Main {

    @EJB
    private static 
RemoteSessionBean sessionBean;

    public static void main(String[] args) {
        System.out.println("Displaying Result Here:");
        System.out.println("=================================");
        System.err.println("Name is : =" + sessionBean.getName());
        System.err.println("Message is : =" + sessionBean.getMsg());
        System.out.println("=================================");
    }
}

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2014 PURVACOMPUTERS.COM All Right Reserved