3 Replies Latest reply on Jul 29, 2004 10:23 AM by therion

    Same SLSB with different jndi name and different env-entries

    therion Newbie

      Hi,

      I have a service in a SLSB that receives an env-entry as a config param. I need to put this service in the same application but it needs to receive a diferent value in the env-entry.

      The problem is that when the service is doing the look-up of the env-entry, always brings the value of the previous service.

      Can i use a different env-entry for the same SessionBean with differents jndi name?

      Any help would be appreciated!

      Regards,

      Therion.

        • 1. Re: Same SLSB with different jndi name and different env-ent
          jamesstrachan Newbie

          Therion,

          You need to use a different EJB name as well as a different JNDI name.

          The partial deploymeent descriptor below is an example :-

           <session>
           <display-name>Audit Logging SSB</display-name>
           <ejb-name>AuditLoggingReceiver</ejb-name>
           <home>com.syntegra.nhs.nasp.tms.logging.LoggingReceiverHome</home>
           <remote>com.syntegra.nhs.nasp.tms.logging.LoggingReceiver</remote>
           <ejb-class>com.syntegra.nhs.nasp.tms.logging.LoggingReceiverBean</ejb-class>
           <session-type>Stateless</session-type>
           <transaction-type>Container</transaction-type>
           <env-entry>
           <description>Specify queue persistence</description>
           <env-entry-name>queuePersistent</env-entry-name>
           <env-entry-type>java.lang.Boolean</env-entry-type>
           <env-entry-value>true</env-entry-value>
           </env-entry>
           <resource-ref>
           <description>Link to Audit Connection Factory</description>
           <res-ref-name>jms/queueFactory</res-ref-name>
           <res-type>javax.jms.QueueConnectionFactory</res-type>
           <res-auth>Container</res-auth>
           </resource-ref>
           <resource-env-ref>
           <description>Link to Audit Queue</description>
           <resource-env-ref-name>jms/queueName</resource-env-ref-name>
           <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
           </resource-env-ref>
           </session>
           <!-- Session Bean for Diagnostic Logging -->
           <session>
           <display-name>Diagnostic Logging SSB</display-name>
           <ejb-name>DiagnosticLoggingReceiver</ejb-name>
           <home>com.syntegra.nhs.nasp.tms.logging.LoggingReceiverHome</home>
           <remote>com.syntegra.nhs.nasp.tms.logging.LoggingReceiver</remote>
           <ejb-class>com.syntegra.nhs.nasp.tms.logging.LoggingReceiverBean</ejb-class>
           <session-type>Stateless</session-type>
           <transaction-type>Container</transaction-type>
           <env-entry>
           <description>Specify queue persistence</description>
           <env-entry-name>queuePersistent</env-entry-name>
           <env-entry-type>java.lang.Boolean</env-entry-type>
           <env-entry-value>false</env-entry-value>
           </env-entry>
           <resource-ref>
           <description>Link to Diagnostic Connection Factory</description>
           <res-ref-name>jms/queueFactory</res-ref-name>
           <res-type>javax.jms.QueueConnectionFactory</res-type>
           <res-auth>Container</res-auth>
           </resource-ref>
           <resource-env-ref>
           <description>Link to Diagnostic Queue</description>
           <resource-env-ref-name>jms/queueName</resource-env-ref-name>
           <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
           </resource-env-ref>
           </session>
          


          This is from ejb-jar.xml. You also need to define jndi names in jboss.xml.
          James


          • 2. Re: Same SLSB with different jndi name and different env-ent
            therion Newbie

            James,

            Thanks for the reply. I'm doing exactly what you explain. I'm using different EJB Names and JNDI names.

            My descriptor is below:

             <session>
             <ejb-name>DefaultPersistenceFacade</ejb-name>
             <home>top.synergica.persistence.ejb.StatelessPersistenceFacadeHome</home>
             <local-home>top.synergica.persistence.ejb.StatelessPersistenceFacadeLocalHome</local-home>
             <remote>top.synergica.persistence.ejb.StatelessPersistenceFacade</remote>
             <local>top.synergica.persistence.ejb.StatelessPersistenceFacadeLocal</local>
             <ejb-class>top.synergica.persistence.ejb.StatelessPersistenceFacadeEJB</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Bean</transaction-type>
            </session>
            <session>
             <ejb-name>CachePersistenceFacade</ejb-name>
             <home>top.synergica.persistence.ejb.StatelessPersistenceFacadeHome</home>
             <local-home>top.synergica.persistence.ejb.StatelessPersistenceFacadeLocalHome</local-home>
             <remote>top.synergica.persistence.ejb.StatelessPersistenceFacade</remote>
             <local>top.synergica.persistence.ejb.StatelessPersistenceFacadeLocal</local>
             <ejb-class>top.synergica.persistence.ejb.StatelessPersistenceFacadeEJB</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Bean</transaction-type>
             <env-entry>
             <description></description>
             <env-entry-name>persistence/Component</env-entry-name>
             <env-entry-type>java.lang.String</env-entry-type>
             <env-entry-value>cache</env-entry-value>
             </env-entry>
            </session>
            <session>
             <ejb-name>PointServicePersistenceFacade</ejb-name>
             <home>top.synergica.persistence.ejb.StatelessPersistenceFacadeHome</home>
             <local-home>top.synergica.persistence.ejb.StatelessPersistenceFacadeLocalHome</local-home>
             <remote>top.synergica.persistence.ejb.StatelessPersistenceFacade</remote>
             <local>top.synergica.persistence.ejb.StatelessPersistenceFacadeLocal</local>
             <ejb-class>top.synergica.persistence.ejb.StatelessPersistenceFacadeEJB</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
             <env-entry>
             <description></description>
             <env-entry-name>persistence/Component</env-entry-name>
             <env-entry-type>java.lang.String</env-entry-type>
             <env-entry-value>pointservice</env-entry-value>
             </env-entry>
            </session>
            


            When i call the PointService and look up the env entry, the value is (for example) "cache" instead of "pointservice".

            Thanks, again.

            D.


            • 3. Re: Same SLSB with different jndi name and different env-ent
              therion Newbie

              Found the problem!

              It was our ServiceLocator. The entry was cached and never refresh it.

              Therion