Hi everybody,
I am new to EJB3.0 and to this forum also.
I amtrying to develop a sample application usinf EJB 3.0 and trying to call it from a servlet in a web application.
I have made the injection of Remote interface using the @EJB annotation in my servlet class; but I am getting Null Pointer Exception at the place where I make a call to the Session Bean's business method.
Below i am pasting my servlet's code and also my Bean's code
AnyBody ;Please Help.

******************Servlet Code***************
public class NuxeoServlet extends HttpServlet {
Context ic;

//Static injection
// private static @EJB RemoteStatefulInterface sful;
private static @EJB RemoteStatelessInterface sless;



public NuxeoServlet() {
// TODO Auto-generated constructor stub
}

public void init(ServletConfig config) throws ServletException {
super.init(config);
try
{
Hashtable p= new Hashtable();
p.put("java.naming.factory.initial","org.jnp.inter faces.NamingContextFactory");

p.put("java.naming.factory.url.pkgs", "org.jnp.interfaces");
p.put("java.naming.provider.url","jnp://localhost:1099");
p.put("username", "Administrator");
p.put("password", "Administrator");

ic= new InitialContext(p);
}catch(Exception e )
{

}

}

protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,
IOException {
PrintWriter out=resp.getWriter();
try{
out.println("Invoking 3.0 SFSB-------->");

out.println("invoking stateless...");
out.println("Going to Look up");
//sless= (RemoteStatelessInterface)ic.lookup("java:comp/env"+RemoteStatelessInterface.class.getName());
out.println("Message from 3.0 Stateless Bean: "+sless.sayHello());

}catch(Exception e){
e.printStackTrace();
out.println("failed in Post Method!");
}
}//doPost() ends
}//class ends

*********************Bean Class Code********

package learning.ejb;

import javax.ejb.*;
import javax.annotation.*;

import org.jboss.annotation.ejb.RemoteBinding;
@Remote({RemoteStatelessInterface.class})
@Local({LocalStatelessInterface.class})

@Stateless


public class StatelessBean implements RemoteStatelessInterface,LocalStatelessInterface{
private String message=new String ("Hello from Stateless bean");

public String sayHello(){
return (message);
}
}
******************Staxk-Trace************
15:48:28,582 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
15:48:28,723 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
15:48:28,770 INFO [JkMain] Jk running ID=0 time=0/78 config=null
15:48:28,817 INFO [Server] JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=2006
05151000)] Started in 34s:672ms
15:49:09,910 ERROR [STDERR] java.lang.NullPointerException
15:49:09,910 ERROR [STDERR] at com.cg.ecm.NuxeoServlet.doPost(NuxeoServlet.java:8 3)
15:49:09,910 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
15:49:09,910 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(
ApplicationFilterChain.java:252)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.do Filter(Applicat
ionFilterChain.java:173)
15:49:09,910 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHead
erFilter.java:96)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(
ApplicationFilterChain.java:202)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.do Filter(Applicat
ionFilterChain.java:173)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrap
perValve.java:213)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invo ke(StandardCont
extValve.java:178)
15:49:09,910 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(Sec
urityAssociationValve.java:175)
15:49:09,910 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContext
Valve.java:74)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke( StandardHostVal
ve.java:126)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportVal
ve.java:105)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngin
eValve.java:107)
15:49:09,910 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter
.java:148)
15:49:09,910 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.
java:869)
15:49:09,910 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandl
er.processConnection(Http11BaseProtocol.java:664)
15:49:09,910 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpE
ndpoint.java:527)
15:49:09,910 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread .run(MasterSlav
eWorkerThread.java:112)
15:49:09,910 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
16:02:32,108 ERROR [STDERR] java.lang.NullPointerException
16:02:32,108 ERROR [STDERR] at com.cg.ecm.NuxeoServlet.doPost(NuxeoServlet.java:8 3)
16:02:32,108 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
16:02:32,108 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
16:02:32,108 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(
ApplicationFilterChain.java:252)
16:02:32,108 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.do Filter(Applicat
ionFilterChain.java:173)
16:02:32,108 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHead
erFilter.java:96)
16:02:32,108 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(
ApplicationFilterChain.java:202)
16:02:32,108 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.do Filter(Applicat
ionFilterChain.java:173)
16:02:32,108 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrap
perValve.java:213)
16:02:32,108 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invo ke(StandardCont
extValve.java:178)
16:02:32,124 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(Sec
urityAssociationValve.java:175)
16:02:32,124 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContext
Valve.java:74)
16:02:32,124 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke( StandardHostVal
ve.java:126)
16:02:32,124 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportVal
ve.java:105)
16:02:32,124 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngin
eValve.java:107)
16:02:32,124 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter
.java:148)
16:02:32,124 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.
java:869)
16:02:32,124 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandl
er.processConnection(Http11BaseProtocol.java:664)
16:02:32,124 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpE
ndpoint.java:527)
16:02:32,124 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread .run(MasterSlav
eWorkerThread.java:112)
16:02:32,124 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)


Some Body Please help!!!
I am using JBoss 4.0.4GA Application server
and for development I am using Eclipse IDE for JBoss

thanks in Advance,
Amit