• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using properties-service.xml

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am using JBoss 4.2.2GA and have a multi environment setup, where I deploy my application in multiple environments.
Now,
To set the queue-names as they are different for all the environments , for eg
on environment one the queuename should be queue_dev1
on environment two the queuename should be queue_dev2

When I configure the queue property in the properties-service.xml :



and then in the destination xml to define the queue i use :



This does not work. Can someone give me an idea on how to do it ?

With the above configuration a queue is created : ${test.project.property.queuename} and not queue_dev1
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't have to use the properties-service.xml. Instead all you have to do is pass the value for the placeholder as a Java System property. Like this:



You can even add that -Dtest.project.property.queuename=queue_dev1 in the run.bat (under JAVA_OPTS section).
 
Vikram Saxena
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Jaikiran,

I can do that, but that will become impossible to configure 30-40 parameters in the run command.
Is it possible through the properties-service.xml ?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should be able to set the properties in the properties-service.xml file. I hope that you posted the wrong example because the property name in the properties-service.xml file was not the property you used in the destination xml file.

You could also place the properties into a text file and read them from there. For example, create my.properties in server/xxx/conf and then use:

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

I am using JBoss 4.3 Enterprise Edition.
I am facing a similar problem. I have modified properties-service.xml with the following content:


<attribute name="URLList">
${jboss.server.config.url}test.properties
</attribute>

Added the file test.properties file in $JBOSS_HOME/server/<profile>/conf.
The content of test.properties is:

sbm.ejb.naming.port=18026


I have modified jboss-minimal.xml in the section:

<mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming"
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">


<attribute name="Port">${sbm.ejb.naming.port:1099}<</attribute>

When I start the server it is seen that the server gets started with naming port as 1099
instead of 18026.

But instead of changes in properties-service.xml, if I pass the same property as
system property during server startup:

-Dsbm.ejb.naming.port=18026

the server gets started with naming port as 18026.


Is my usage proper or I am doing something wrong?

It will be really helpful if anyone can help me to solve this issue.

Thanks in advance,
Subhash
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You seem to be using the property in jboss-minimal.xml which is started even before the properties-service.xml is started. You do know that the Naming port can be changed in the port configuration file directly don't you? Instead of creating an extra indirection through a new propreties file.
 
Subhash Namboodiri
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,

Thanks for the reply.

Yes the value of the port can be changed directly in jboss-minimal.xml. But as JBoss has many ports and many are spread in many files we thought of consolidating all the properties in one location i.e. a property file. The benefit for us is that as the ports are replaced by installer, it needs to replace the tokens in only one file.

Passing it as JVM arguments can be done but in many windows boxes "Input line too long can be an issue".

It would be really helpful if you can please tell me when exactly properties-service.xml is getting loaded or where could I find the sequence of loading of files (services)?
So at least the ports and other values after the loading of properties-service.xml can be defined there.

Thanks in advance,
Subhash
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But as JBoss has many ports and many are spread in many files we thought of consolidating all the properties in one location i.e. a property file.



There is already such a file. See docs/examples/binding-manager/sample-binding.xml. and this: http://www.jboss.org/community/wiki/ServiceBindingManager
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this is an ancient thread, but applies to an issue I'm having.

GREAT tip on setting properties-service.xml - thank you.

However, I'm having a weird issue and it's had me stumped for hours and hours.

Using JBoss 6.0 Final and quartz 1.8.4 on Mac 10.6 (Linux with a pretty face) - and having a devil of a time - it wasn't loading my quartz.properties file when placed in either in %JBOSS_HOME%/bin or %JBOSS_HOME%/server/default/conf.

Using the tip, I added the following to %JBOSS_HOME%/server/default/deploy/properties-service.xml:


then renamed my quartz.properties file to my-quartz.properties and moved it to %JBOSS_HOME%/server/default/conf

When I start JBoss, it's definitely reading the properties-service.xml because it's throwing:
11:30:30,757 INFO [[/QuartzTest]] QuartzInitializer: Quartz Scheduler failed to initialize: org.quartz.SchedulerException: Properties file: 'file:/Users/me/jboss-6.0.0.Final/server/default/conf/my-quartz.properties' could not be found.

Yet when I enter the following (with the path and filename pulled from the log output above) at a command prompt, it displays the contents of my file:
less /Users/me/jboss-6.0.0.Final/server/default/conf/my-quartz.properties

Does anyone have any thoughts or ideas?

Thanks for all you do!
Larry
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Who's logging that message:


11:30:30,757 INFO [[/QuartzTest]] QuartzInitializer: Quartz Scheduler failed to initialize: org.quartz.SchedulerException: Properties file: 'file:/Users/me/jboss-6.0.0.Final/server/default/conf/my-quartz.properties' could not be found.



Are you sure that piece of code can handle the file: protocol prefix in that path to the file?
 
Larry D. Wilson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JBoss server log - and yes, because it's picking up the full pathname when reporting that it cannot find the file.

Also forgot to mention I've even tried starting jboss as root to make sure its not a file permission thing.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This discussion has now continued here http://community.jboss.org/message/584848#584848
 
reply
    Bookmark Topic Watch Topic
  • New Topic