Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spring.Net: Property PlaceHolder

Status
Not open for further replies.

MadJock

Programmer
May 25, 2001
318
GB
Hi all,

I'm using Spring.Net and PropertyPlaceHolderConfigurers. This is used for two purposes: database connection (which works) and message bus connection (which doesn't work). The error I get is that it cannot resolve 'jms.url' which is the first of the properties 'served' via the placeholder.

App.Config
Code:
<configuration>
  <configSections>
    <sectionGroup name="spring">
      <section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
      <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
    </sectionGroup>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
    </sectionGroup>
    <section name="jmsSettings" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    <section name="databaseSettings" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  </configSections>

  <!-- Other Stuff -->
  <databaseSettings>
    <add key="db.datasource" value="Server=dbServer;Database=AtomAgent;Trusted_Connection=True;"/>
  </databaseSettings>

  <jmsSettings>
    <add key="jms.url" value="tcp://myMessageBusUrl.com:9090"/>
    <add key="jms.username" value="username" />
    <add key="jms.password" value="password" />
    <add key="jms.queue" value="qName" />
  </jmsSettings>
</configuration>

Spring.nte config
Code:
<objects xmlns="[URL unfurl="true"]http://www.springframework.net"[/URL]  xmlns:db="[URL unfurl="true"]http://www.springframework.net/database">[/URL]
  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
    <property name="ConfigSections" value="jmsSettings"/>
  </object>

  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
    <property name="ConfigSections" value="databaseSettings"/>
  </object>

  <db:provider id="DbProvider" provider="SqlServer-2.0" connectionString="${db.datasource}"/>

  <object id ="JmsQueuePublisher" type="dbAtom.JMS.Publishing.QueuePublisher, dbAtom.JMS">
    <property name="DbusServerUrl" value="${jms.url}"/>
    <property name="DbusUsername" value="${jms.username}"/>
    <property name="DbusPassword" value="${jms.password}"/>
    <property name="QueueName" value="${jms.queue}"/>
  </object>

</objects>

I can't see any difference between what's being done for the database and what is being done for the message bus. Any ideas?

If you need more information, please post back.

Thanks,

Graeme


"Just beacuse you're paranoid, don't mean they're not after you
 
since this question is framework specific I would post in either the spring.net forums or the JMS forums (if jms is separate from spring). In either case Tek-Tips won't yield good results.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Solved the issue. i will post answer here for anyone else encountering this.

App.Config remains unchanged from sample above. The Spring config should only have one PropertyPlaceholderConfigurer. See the example below where the two config sections are comma seperated rather than seperate objects:

Code:
  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
    <property name="ConfigSections" value="jmsSettings,databaseSettings"/>
  </object>

Thanks to for this information.

Graeme


"Just beacuse you're paranoid, don't mean they're not after you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top