try
{
Context ctx = new InitialContext();
TestHome result = (TestHome)ctx.lookup("java:comp/env/ejb/TestBean");
//TestHome testHome = (TestHome) PortableRemoteObject.narrow(result, TestHome.class);
Test test = result.create();
String echo = test.echo("Test");
out.println("<font align=Center face=\"Garamond\"> Check EJB Reference : Call to bean method returned ->"+echo+" </font><br>");
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/MyDataSource");
Connection con = ds.getConnection();
out.println("<font align=Center face=\"Garamond\"> Check Resource Reference : Got Connection ->"+con+" </font><br>");