";
String HR = " ";
String pepperImg = "";
/**
* The main method of this JSP
*/
public void main(HttpServletRequest request, HttpSession session, JspWriter out) throws Exception {
this.request = request;
this.session = session;
this.out = out;
InitialContext ctx = null;
ClassLoader myLoader = null;
try {
myLoader = this.getClass().getClassLoader();
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
p.put("openejb.loader", "embed");
ctx = new InitialContext(p);
} catch (Exception e) {
formatThrowable(e);
}
try {
out.print(HR);
out.print("
");
// ---------------------------------------------------
// Can I lookup a home interface from the testsuite?
// ---------------------------------------------------
printTest("Looking up an ejb home ");
Object ejbHome = null;
try {
ejbHome = ctx.lookup("MEJB");
if (ejbHome instanceof java.rmi.Remote) out.println(OK);
} catch (Exception e) {
e.printStackTrace(new PrintWriter(out));
out.println(FAIL);
return;
}
// ---------------------------------------------------
// Is the home interface visible?
// ---------------------------------------------------
printTest("Checking for the home interface class definition ");
Class homeInterface;
try {
homeInterface = Class.forName("javax.management.j2ee.ManagementHome", true, myLoader);
out.println(OK);
} catch (Exception e) {
out.println(FAIL);
return;
}
// ---------------------------------------------------
// Can I invoke a create method on the ejb home?
// ---------------------------------------------------
printTest("Invoking the create method on the ejb home ");
Object ejbObject = null;
try {
Class[] params = new Class[0];
Method create = null;
create = homeInterface.getDeclaredMethod("create", params);
ejbObject = create.invoke(ejbHome);
if (ejbObject instanceof java.rmi.Remote) out.println(OK);
} catch (Exception e) {
out.println(FAIL);
return;
}
// ---------------------------------------------------
// Is the remote interface visible?
// ---------------------------------------------------
printTest("Checking for the remote interface class definition ");
Class remoteInterface;
try {
remoteInterface = Class.forName("javax.management.j2ee.Management", true, myLoader);
out.println(OK);
} catch (Exception e) {
out.println(FAIL);
return;
}
// ---------------------------------------------------
// Can I invoke a business method on the ejb object?
// ---------------------------------------------------
printTest("Invoking a business method on the ejb object ");
Object returnValue = null;
try {
Method businessMethod = remoteInterface.getDeclaredMethod("getMBeanCount");
returnValue = businessMethod.invoke(ejbObject);
if (returnValue instanceof java.lang.Integer) out.println(OK);
} catch (Exception e) {
out.println(FAIL);
return;
}
out.print("
");
out.print(HR);
// out.println(" The Enterprise Bean returned the following message: