[jboss-user] [EJB 3.0] - Re: NullPointerException in JavaEEComponentHelper with JBoss

japase do-not-reply at jboss.com
Wed Apr 15 02:34:45 EDT 2009


Hi,

As requested I have now attached the zipped server.log file. I've also tested two other simple applications build upon our framework (generated code) with only two EJBs with EJB injection.

Content of those two applications:

anonymous wrote : 
  | jar -tf ifstest-ab.ear
  | META-INF/
  | META-INF/MANIFEST.MF
  | applicationsupport-ejb.jar
  | atestutlpkg-ejb.jar
  | btestservice-ejb.jar
  | enumerations.jar
  | ifs-fndfw.jar
  | ifs-wstest.war
  | ifs.properties
  | META-INF/application.xml
  | 

anonymous wrote : 
  | jar -tf ifstest-cd.ear
  | META-INF/
  | META-INF/MANIFEST.MF
  | applicationsupport-ejb.jar
  | ctestservice-ejb.jar
  | dtestutlpkg-ejb.jar
  | enumerations.jar
  | ifs-fndfw.jar
  | ifs-wstest.war
  | ifs.properties
  | META-INF/application.xml
  | 

In ifstest-ab.ear my web service is calling EJB contained within btestservice-ejb.jar, which in turn is calling an EJB in atestutlpkg-ejb.jar.
In the second application, ifstest-cd.ear, the situation is the opposite: my web service makes a call to ctestservice-ejb.jar, which calls dtestutlpkg-ejb.jar.

Both test applications are working, i.e. I don't have any problems related to the deployment order. And I don't use mappedName attribute in those test applications.

But I still have problems with EJB injection in my web service - the same one as in the "big" ifsapp.ear.

An example of how our web service looks like:


  | @WebService
  | public class BTestHandler
  | {
  |    @EJB
  |    private ifs.application.btestservice.BTestHandlerLocal local;
  | 
  |    private void checkInterface( Logger _log ) throws javax.naming.NamingException
  |    {
  |       if( local==null )
  |       {
  |          if(_log.warning) _log.warning("EJB injection doesn't work; interface is null. Looking it up...");
  |          local = (ifs.application.btestservice.BTestHandlerLocal)EjbUtils.lookupAnnotatedBean("BTestHandler", _log);
  |       }
  |    }
  | 
  |    @WebMethod
  |    public String sayHello( @WebParam(name="name") String name ) throws WebServiceException
  |    {
  |       Logger _log = LogMgr.getFrameworkLogger();
  | 
  |       try
  |       {
  |          ifs.application.btestservice.BTestServiceViews.V1 _param = new ifs.application.btestservice.BTestServiceViews.V1();
  |          _param.name.setValue(name);
  | 
  |          checkInterface(_log);
  | 
  |          _param = (ifs.application.btestservice.BTestServiceViews.V1)local.sayHello(_param, FndContext.getCurrentContext()).getResult();
  | 
  |          return _param.result.getValue();
  |       }
  |       catch( Throwable t )
  |       {
  |          _log.error(t);
  |          throw new WebServiceException(t);
  |       }
  |    }
  | }
  | 

The checkInterface() method I've added after discovering that EJB injection doesn't work. And I see the warning message...


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225522#4225522

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225522



More information about the jboss-user mailing list