2 Replies Latest reply on Feb 27, 2002 10:29 PM by pazu

    Entity CMP bean not seen in JNDI Namespace - why?

    ebilange

      I have a basic entity bean deployed through the autodeployer. The trace gives me the following. I assume that everything goes well.

      ---------------------------------------------------------

      INFO ejb.AutoDeployer - Auto deploy of file:/C:/Development/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/deploy/entity.jar
      INFO deployment.J2eeDeployer - Deploy J2EE application: file:/C:/Development/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/deploy/entity.jar
      INFO deployment.J2eeDeployer - Create application entity.jar
      INFO deployment.J2eeDeployer - install EJB module entity.jar
      INFO ejb.ContainerFactory - Deploying:file:/C:/Development/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/tmp/deploy/Default/entity.jar/
      DEBUG ejb.ContainerFactory - Verifying file:/C:/Development/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/tmp/deploy/Default/entity.jar/ejb1009.jar
      INFO ejb.ContainerFactory - Deploying DemoEntity
      DEBUG plugins.EntityInstancePool - config - MaximumSize=100, strictMaximumSize=false, feederPolicy=null
      DEBUG local.BaseLocalContainerInvoker - Caching methods for localClass: interface entity.demo.LocalEntity
      DEBUG local.BaseLocalContainerInvoker - Caching methods for localHomeClass: interface entity.demo.LocalEntityHome
      DEBUG ejb.EntityContainer - Begin java:comp/env for EJB: DemoEntity
      DEBUG ejb.EntityContainer - TCL: java.net.URLClassLoader@9d96b1
      DEBUG ejb.EntityContainer - End java:comp/env for EJB: DemoEntity
      DEBUG jaws.JAWSPersistenceManager - Initializing JAWS plugin for DemoEntity
      DEBUG jaws.JAWSPersistenceManager - Loading standardjaws.xml : file:/C:/Developm
      ent/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/conf/default/standardjaws.xml
      DEBUG jaws.JAWSPersistenceManager - AutoGenerated finders - Home=null -- LocalHome=interface entity.demo.LocalEntityHome
      DEBUG jaws.JAWSPersistenceManager - Save AutoGenerated findByName public abstract java.util.Collection entity.demo.LocalEntityHome.findByName(java.lang.String)
      throws javax.ejb.FinderException
      DEBUG jaws.JAWSPersistenceManager - Finder:name
      DEBUG jaws.JAWSPersistenceManager - Table DemoEntity created
      INFO jaws.JAWSPersistenceManager - Created table 'DemoEntity' successfully.
      DEBUG jaws.JAWSPersistenceManager - Primary key of table 'DemoEntity' is 'localId'
      INFO ContainerManagement.DemoEntity - Initializing
      INFO ContainerManagement.DemoEntity - Initialized
      INFO ContainerManagement.DemoEntity - Starting
      INFO ContainerManagement.DemoEntity - Started
      INFO ejb.ContainerFactory - Deployed application: file:/C:/Development/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/tmp/deploy/Default/entity.jar/
      INFO deployment.J2eeDeployer - J2EE application: file:/C:/Development/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/deploy/entity.jar is deployed.
      INFO ejb.AutoDeployer - Auto undeploy of file:/C:/Development/jboss/JBoss-2.4.4_Tomcat-4.0.1/jboss/deploy/entity.jar
      DEBUG plugins.LRUEnterpriseContextCachePolicy - Resized cache for bean DemoEntity: old capacity = 1000, new capacity = 50

      ---------------------------------------------------------

      Now when I query the JNDI Namespace via the admin, I can just see the application reference:
      java:comp namespace of the DemoEntity bean:

      +- env (class: org.jnp.interfaces.NamingContext)

      but I do not see it in the Namespace.

      In the META-INF directory of my archive, the file jboss.xml specifies the following:


      false
      <container-configurations />
      <resource-managers />
      <enterprise-beans>

      <ejb-name>DemoEntity</ejb-name>
      <jndi-name>entity/Demo</jndi-name>
      <configuration-name></configuration-name>

      </enterprise-beans>


      and my ejb-jar is:
      <ejb-jar>

      <enterprise-beans>

      <display-name>DemoEntity</display-name>
      <ejb-name>DemoEntity</ejb-name>
      <local-home>entity.demo.LocalEntityHome</local-home>
      entity.demo.LocalEntity
      <ejb-class>entity.demo.DemoEntity</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Demo</abstract-schema-name>
      <cmp-field>
      no description
      <field-name>name</field-name>
      </cmp-field>
      <cmp-field>
      no description
      <field-name>address</field-name>
      </cmp-field>
      <cmp-field>
      no description
      <field-name>localId</field-name>
      </cmp-field>
      <primkey-field>localId</primkey-field>
      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>


      <query-method>
      <method-name>findByName</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql>select object(u) from Demo u where u.name = ?1</ejb-ql>


      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>DemoEntity</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      Any idea of why this EJB is not visible?
      Of course, any attempt from a client to access it fails...

      Obviously, I'm doing something wrong, but what?
      Thanks

        • 1. Re: Entity CMP bean not seen in JNDI Namespace - why?
          ebilange

          Ok, I found where the problem was:
          <local-home>entity.demo.LocalEntityHome</local-home>
          entity.demo.LocalEntity

          this is not supported by JBOSS apparently. This works well in the j2ee sdk (and actually this was created by it). Don't why exactly when you think twice since this directive <local-home> and explicitely call for local objects... (not sure, just guessing).

          I did the following:
          Changed my interfaced so that they inherit from EJBObject and EJBHome
          and declared them as
          ... ...

          Now my EJB is accessible

          • 2. Re: Entity CMP bean not seen in JNDI Namespace - why?
            pazu

            Perhaps you should study a bit more about J2EE. What you did was replace your local interface by remote interfaces. This has many implications. Take a look at the EJB standard for more info.

            By the way, JBoss 2.4.x supposedly support local interfaces, but in som cryptic way that I couldn't figure out. JBoss 3.0.0 supports local interfaces nice and clean.