Try specifying fully qualified class name in your imports. i.e.:
    import com.mycom.test.AddStateless
 
 
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Rahul Chaudhary
Sent: Thursday, November 11, 1999 2:14 AM
To: [EMAIL PROTECTED]
Subject: ClassCastException

Hello PPL
i ran into ClassCastException when trying to get the home interface of the EJB deployed in weblogic.
The Code is :
<%@ page errorPage="error.jsp" %>
<%@ page import="java.util.*, java.lang.*, javax.naming.*"%>
<%@ page import="javax.ejb.*, com.mphasis.common.bin.*"%>
<%@ page import="AddStateless, AddStatelessHome" %>

<HTML>
<HEAD>
<TITLE>Using Components</TITLE>
</HEAD>
<BODY>
<%
 String url          = "t3://localhost:80";
 String user         = null;
 String password     = null;

    try
 {
  Hashtable h = new Hashtable();
     h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
     h.put(Context.PROVIDER_URL, url);
     if (user != null)
     {
   out.print("user: " + user);
   h.put(Context.SECURITY_PRINCIPAL, user);
   if (password == null)
   password = "";
   h.put(Context.SECURITY_CREDENTIALS, password);
     }

  Context ctx = new InitialContext(h);

  out.print("<BR> Initialised Context again......");

  out.print("<BR> ctx class: " + ctx.getClass().getName());

// error occurring here
    AddStatelessHome home = (AddStatelessHome) ctx.lookup("AddStatelessHome");

  out.print("Found Home");

  AddStateless remote = (AddStateless)home.create();

  out.print("the result is " + remote.Add(4,5));
 }
 catch(Exception e)
 {
  out.print("<BR><B>" + e.toString() + "</B> Exception Occurred");
 }

%>
</BODY> =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". FAQs on JSP can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to