2 Replies Latest reply: Jun 10, 2010 7:15 AM by Fred Bricon RSS

    jboss.xml can't read properties set in system-properties.xml

    Fred Bricon Novice

      Hi,

       

      I'm trying to listen to a pop3 inbox from a JBoss AS 5.1 server. A (seam) mail listener configured in ejbproject.jar/META-INF/jboss.xml

       

      {code:xml}

      <jboss>
      <enterprise-beans>
         <message-driven>
           <ejb-name>SomeMailService</ejb-name>
           <activation-config>
           <activation-config-property>
             <activation-config-property-name>mailServer</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.mailServer}</activation-config-property-value>
           </activation-config-property>
           <activation-config-property>
             <activation-config-property-name>port</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.port}</activation-config-property-value>
           </activation-config-property>
           <activation-config-property>
             <activation-config-property-name>debug</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.debug}</activation-config-property-value>
           </activation-config-property>
           <activation-config-property>
             <activation-config-property-name>mailFolder</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.mailFolder}</activation-config-property-value>
           </activation-config-property>
           <activation-config-property>
             <activation-config-property-name>storeProtocol</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.storeProtocol}</activation-config-property-value>
           </activation-config-property>
           <activation-config-property>
             <activation-config-property-name>flush</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.flush}</activation-config-property-value>
           </activation-config-property>
           <activation-config-property>
             <activation-config-property-name>userName</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.userName}</activation-config-property-value>
           </activation-config-property>
           <activation-config-property>
             <activation-config-property-name>password</activation-config-property-name>
             <activation-config-property-value>${mail.receiver.password}</activation-config-property-value>
           </activation-config-property>
           </activation-config>
           <resource-adapter-name>mail-ra.rar</resource-adapter-name>
         </message-driven>
      </enterprise-beans>

      {code}

       

      The properties are defined in ${JBOSS_HOME}/server/default/conf/mail.receiver.properties and loaded via ${JBOSS_HOME}/server/default/deploy/system-properties.xml

       

      {code:xml}

      <mbean code="org.jboss.varia.property.SystemPropertiesService"
           name="jboss:type=Service,name=SystemProperties">
          <attribute name="URLList">
            ./conf/mail.receiver.properties
          </attribute>

      </mbean>

      {code}

       

      Upon server startup, properties are correctly loaded :

      {code}

      12:00:07,902 INFO  [SystemPropertiesService] Loaded system properties from: file:/P:/opt/JBoss/jboss-as-5.0.1.GA-jdk6/server/default/conf/mail.receiver.properties

      {code}

       

      BUT, it seems the mailListener isn't aware of that fact :

       

      {code}12:15:22,321 ERROR [MailActivation] Failed to execute folder check, spec=MailActivationSpec(mailServer=${mail.receiver.server}, storeProtocol=${mail.receiver.storeProtocol}, mailFolder=${mail.receiver.mailFolder}, pollingInterval=60000, messageSelector=null, userName=${mail.receiver.userName}, maxMessages=1, debug=false, starttls=false, port=0){code}

       

      I've checked in another class, the system properties are actually loaded :

      <code>System.err.println("${mail.receiver.mailFolder}:" + System.getProperty("mail.receiver.mailFolder"));</code> correctly returns INBOX

       

      Setting properties via <attribute name="Properties"> in system-properties doesn't work either.

       

      Passing properties from the command line work as expected ( -Dmail.receiver.server=someserver) -hopefully-

       

      I'm missing something with system-properties.xml? Seems like a bug to me.

       

      regards,

       

      Fred Bricon