1 Reply Latest reply on Jan 6, 2002 4:52 PM by Denis St Flour

    Local interface question

    Mark Hesketh Newbie

      I've got a local home i/f impl that has a findAll() on it. I have defined the local EJBLocalObject class with the relevant accessors for the attributes I want to manipulate in the web-tier. I'm having difficulty though, getting JBoss to deploy it due to the following stack trace:

      [17:22:21,355,ContainerFactory] Could not deploy file:/C:/tools/jboss-3.0.0alpha
      /deploy/Default/RomanEJB.jar
      java.lang.NullPointerException
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.loadSelectors(
      JDBCEntityBridge.java:213)

      I've checked the JDBCEntityBridge class on line 213 and it's fairly innocuous.

      Does anyone know what the problem is?


      ejb-jar.xml (ejb-ql):



      <query-method>
      <method-name>findAll</method-name>
      <method-params>
      </method-params>
      </query-method>
      <ejb-ql>
      SELECT OBJECT(w) FROM WorkAreaSchema as w
      </ejb-ql>



      Local i/f:


      public interface WorkAreaLocalHome extends EJBLocalHome
      {
      public abstract Collection findAll() throws FinderException;
      }

      Local obj:

      public interface WorkAreaLocal extends EJBLocalObject, IWorkArea
      {
      }

      I have also declared a helper method on my remote i/f for retrieving the snapshot objects rather than have a collection of remote objects to pore through in my JSP view pages.

      public Collection ejbHomeGetAllWorkAreas() throws RemoteException
      {
      Collection locals = null;
      try
      {
      WorkAreaLocalHome waLocalHome = getWorkAreaLocalHome();
      locals = waLocalHome.findAll();
      }
      catch (Exception e)
      {
      throw new RemoteException("Couldn't resolve the local home i/f for WorkArea",
      e);
      }

      Collection results = null;

      if (!locals.isEmpty())
      {
      results = new ArrayList(locals.size());
      WorkAreaLocal nextLocal = null;
      Iterator iter = locals.iterator();
      while (iter.hasNext())
      {
      nextLocal = (WorkAreaLocal)iter.next();
      results.add(
      new WorkAreaStateHolder(nextLocal.getWorkAreaID(),
      nextLocal.getName(),
      nextLocal.getDescription()));
      }
      }

      return results;

      }

      This is defined in the home i/f thus:

      public Collection getAllWorkAreas() throws RemoteException;

        • 1. Re: Local interface question
          Denis St Flour Newbie

          I had a similar problem and it turned out to be the method parameters tags was the cause of the problem. Also be careful of the name used in the abstract-schema-name tag. It turns out that the name is case sensitive and it must match the name used in the ejb-ql tag. I include an extract of my descriptor below:


          Team
          <ejb-name>Team</ejb-name>
          <local-home>com.meridianinfo.jsoccer.ejb.model.TeamHome</local-home>
          com.meridianinfo.jsoccer.ejb.model.Team
          <ejb-class>com.meridianinfo.jsoccer.ejb.model.TeamBean</ejb-class>
          <persistence-type>Container</persistence-type>
          <prim-key-class>java.lang.Long</prim-key-class>
          False
          <cmp-version>2.x</cmp-version>
          <abstract-schema-name>team</abstract-schema-name>
          <cmp-field><field-name>teamId</field-name></cmp-field>
          <cmp-field><field-name>teamName</field-name></cmp-field>
          <primkey-field>teamId</primkey-field>


          Find all teams

          <query-method>
          <method-name>findAllTeams</method-name>
          <method-params/>
          </query-method>
          <ejb-ql>
          SELECT OBJECT(t)
          FROM team t
          </ejb-ql>