Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

j2ee -ejb error

 
s prasanna
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai everybody
when i am try to run the following servlet-ejb in j2ee server i got some errors. Anybody give me a solution for this?

thanks in advance
prasanna
import javax.servlet.*;
import java.io.*;
import javax.rmi.*;
import javax.naming.*;
public class HelloServlet extends GenericServlet
{
public void service(ServletRequest req,ServletResponse res) throws
ServletException,IOException
{
PrintWriter out = res.getWriter();
try
{
Context c = new InitialContext();
Object ob = c.lookup("Hello");
HelloHome home = (HelloHome)PortableRemoteObject.narrow(ob,HelloHome.class);
HelloInter s = home.create();
out.println("Message : " + s.hello());
}
catch(Exception e1)
{
out.println(e1.getMessage());
}
}
}

error Message :
Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic