Well the error could be due to a problem in the classpath .. i had a similar
incidence where my webserver ( servlet engine ) was on a different system
and the app server was on a diff system :)

Also if you are obtaining you context and home in the service methods you r
calling for performance problems.... becoz u r trying to obtain the home
during each service.. :(

Get the home in the init() and you do this only once :)
then simply use the home in your service methods. Thus only the first call
to the servlet will have to obtain the home .. then it doesnt need to ..

Regards
Rohit Parik
Netweb Software,
India


  ----- Original Message -----
  From: Ashwani Kalra
  To: [EMAIL PROTECTED]
  Sent: Wednesday, February 07, 2001 5:00 PM
  Subject: Re: Accessing beans from servlets !?


  Hi,
  The error that he is getting is not due to classpath. Also one can obtain
  home either in init or in post or get methods. I have tried both the ways.

  Warm Regards
  Ashwani Kalra
  Sr. Member Development Staff
  Aithent Technologies(P) Ltd.
  Email : [EMAIL PROTECTED]

  ----- Original Message -----
  From: Rohit Parik <[EMAIL PROTECTED]>
  To: <[EMAIL PROTECTED]>
  Sent: Wednesday, February 07, 2001 4:48 PM
  Subject: Re: Accessing beans from servlets !?


  > Check your classpath. Also I suggest that you obtain home of your bean
in
  > your init() method instead of the service method..
  >
  > Regards
  > Rohit Parik
  > Netweb Software,
  > India
  >
  >
  > ----- Original Message -----
  > From: Amit V Joshi
  > To: [EMAIL PROTECTED]
  > Sent: Tuesday, February 06, 2001 8:56 PM
  > Subject: Accessing beans from servlets !?
  >
  >
  > Hi all,
  >
  > I am trying to access a bean thru' a servlet. I am getting error as
  > "Conversation.UserHome not found"
  > Here Conversation.UserHome is the lookup name for the bean. Here is my
  code.
  > import javax.servlet.*;
  > import javax.servlet.http.*;
  > import java.io.*;
  > import java.rmi.*;
  > import java.rmi.server.*;
  > import java.util.*;
  > import javax.ejb.*;
  > import javax.naming.*;
  > import ejbeans.*;
  >
  > public class viewServlet extends HttpServlet
  > {
  >
  >         private Context context;
  >
  >     static
  >     {
  >         System.setSecurityManager(new RMISecurityManager());
  >     }
  >
  >     public void doGet(HttpServletRequest req,
  >                       HttpServletResponse res)
  >                        throws ServletException, IOException
  >     {
  >                 final Properties properties = new Properties();
  >         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
  > "allaire.ejipt.ContextFactory");
  >         properties.setProperty(Context.PROVIDER_URL,
  > "ejipt://itl-pc-1703:2323");
  >
  >         try
  >         {
  >                         context = new InitialContext(properties);
  >                         final UserHome home = (UserHome)
  > context.lookup("Conversation.UserHome");
  >                         final User user = home.create();
  >         }
  >         catch (Exception exception)
  >         {
  >             throw new RuntimeException(exception.getMessage());
  >         }
  >                 req.getRequestDispatcher("form.jsp").forward(req,res);
  >     }
  > }
  >
  > Any help in these regards is welcome
  >
  > Thanx.
  >
  > Amit.
  >
  >

===========================================================================
  > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
  body
  > of the message "signoff EJB-INTEREST".  For general help, send email to
  > [EMAIL PROTECTED] and include in the body of the message "help".
  >
  >

===========================================================================
  > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
  body
  > of the message "signoff EJB-INTEREST".  For general help, send email to
  > [EMAIL PROTECTED] and include in the body of the message "help".
  >


===========================================================================
  To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
  of the message "signoff EJB-INTEREST".  For general help, send email to
  [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to