1 Reply Latest reply on Sep 17, 2007 1:32 AM by jaikiran pai

    ejb-jar.xml (env-entry) ignored when jboss.xml is present (.

    Niclas Lindberg Newbie

      Hello you all!


      We have a problem which we've been sitting with for a couple of hours. The problem is that we have an ejb-jar.xml with env-entry for the beans. We have jboss.xml that defines the JNDI names of the beans.
      Code uses @Resource to get the string values from the env-entry.

      Getting desperate.. (Also posted to EJB3 forum... Hard to define the context).


      We're running JBoss 4.2.1

      When Jboss.xml is not present we get @Resource injection to work but the default JNDI binding.

      When JBoss.xml i present we get the intended JNDI name but ResourceHandler log complains:
      Code:
      "14:36:16,125 WARN [ResourceHandler] Not injecting nodeID, no matching enc injec
      tor env/nodeID found"


      jboss.xml
      <?xml version="1.0" encoding="utf-8" ?>
       <jboss>
       <enterprise-beans>
       <service>
       <ejb-name>WitnessServiceBean</ejb-name>
       <jndi-name>NotaryA/witness1/WitnessServiceBean/remote</jndi-name>
       </service>
       </enterprise-beans>
       </jboss>


      ejb-jar.xml
       <?xml version="1.0" encoding="utf-8" ?>
       <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
       <enterprise-beans>
       <session>
       <ejb-name>WitnessServiceBean</ejb-name>
       <env-entry>
       <env-entry-name>nodeID</env-entry-name>
       <env-entry-type>java.lang.String</env-entry-type>
       <env-entry-value>NotaryA</env-entry-value>
       </env-entry>
       <env-entry>
       <env-entry-name>serviceID</env-entry-name>
       <env-entry-type>java.lang.String</env-entry-type>
       <env-entry-value>witness1</env-entry-value>
       </env-entry>
       </session>
       </enterprise-beans>
       </ejb-jar>


      Code: In StatessSessionBean
       @Resource(name="nodeID")
       private String nodeID;
      
       @Resource(name="serviceID")
       private String serviceID;



      Extremly thankful for any help on this... Deadline coming up..

        • 1. Re: ejb-jar.xml (env-entry) ignored when jboss.xml is presen
          jaikiran pai Master

           

          <?xml version="1.0" encoding="utf-8" ?>
           <jboss>
           <enterprise-beans>
           <service>
           <ejb-name>WitnessServiceBean</ejb-name>
           <jndi-name>NotaryA/witness1/WitnessServiceBean/remote</jndi-name>
           </service>
           </enterprise-beans>
           </jboss>


          Not sure what the problem is, but the jboss.xml does not look correct. Shouldnt it be:

          <?xml version="1.0" encoding="utf-8" ?>
           <jboss>
           <enterprise-beans>
           <session>
           <ejb-name>WitnessServiceBean</ejb-name>
           <jndi-name>NotaryA/witness1/WitnessServiceBean/remote</jndi-name>
           </session>
           </enterprise-beans>
           </jboss>