Welcome Guest   Login
This website is maintained for archive purpose. Website available for sale. Send your quote to reach at dkay.in
Jul 18, 2024
Registered Users



Fedora & Vista Blog

EJB 2.1 example from Mastering Enterprise JavaBean 3.0 book.    

Example mentioned in Chapter 2 of Mastering Enterprise JavaBean 3.0 is incomplete. As per today’s standards, we don’t get reference implementation of Java Enterprise Edition, but we get Glassfish server from Sun along with NetBeans.

You can code all the files in NetBeans 6.8 as mentioned in chapter 2 of Mastering Enterprise JavaBean 3.0.
It requires some additional files.

1. Add the Glassfish specific deployment descriptor sun-ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">

2. create a new web application for client and update JSP with this.
           Context ctx = new InitialContext();
           Object obj = ctx.lookup("HelloHome");
           HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
           Hello hello = home.create();

Do not create client as mentioned in the book, since you wont be able to reach out to JNDI from rich application.

Posted by: scbcd

Old Articles
Mastering Enterprise JavaBean 3.0 book for SCBCD Certification
Simplest JPA Example
EJB 2.1 example from Mastering Enterprise JavaBean 3.0 book.
No new edition for Head First EJB - SCBCD 5 book

(Only admin can see)



My New Blog

My Award winning Whitepaper

Contradicting Light
My Personal Blog

Trace Mobile Location

My Book Reviews

Tech Jokes Worth Reading

www.deepjava.com 1999-2024 (C) Developed and maintained by D-Kay Consultancy