-
1. Re: user defined system properties for JBoss configurations
alesj Nov 19, 2008 9:33 AM (in response to dbschofield)"dbschofield" wrote:
Any ideas?
You can always add another bean to binding.xml.
e.g.<deployment xmlns="urn:jboss:bean-deployer:2.0"> <classloader><inject bean="bindings-classloader:0.0.0"/></classloader> <classloader name="bindings-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true"> <root>${jboss.common.lib.url}jboss-bindingservice.jar</root> <root>${jboss.common.lib.url}my-custom-properties-reader.jar</root> </classloader> <bean name="MyCustomPropertiesReader" class="com.acme.PropReader"> <property name="file">\home\foo\myprops.properties</property>
Note: see that classloader root addition --> my-custom-properties-reader.jar -
2. Re: user defined system properties for JBoss configurations
dbschofield Nov 19, 2008 9:39 AM (in response to dbschofield)That could potentially work but I need the properties available for all configuration files. So the question is now where is the proper place in the JBoss startup process to add a bean which will load the properties before any configuration files are loaded?
-
3. Re: user defined system properties for JBoss configurations
alesj Nov 19, 2008 9:43 AM (in response to dbschofield)"dbschofield" wrote:
So the question is now where is the proper place in the JBoss startup process to add a bean which will load the properties before any configuration files are loaded?
See bootstrap.xml.
That's the order how boot files are deployed, vfs.xml being the first.
You can either update that one or squeeze your own in, as the first one. -
4. Re: user defined system properties for JBoss configurations
alesj Nov 19, 2008 9:45 AM (in response to dbschofield)"alesj" wrote:
vfs.xml being the first.
In CR2 there is no such file yet.
It was only added 2 weeks ago (in trunk) - under initialize.xml.
It was today renamed to vfs.xml.
Complicated. :-) -
5. Re: user defined system properties for JBoss configurations
dbschofield Nov 19, 2008 10:57 AM (in response to dbschofield)I appreciate your help on this. A new boot file at the beginning of bootstrap.xml looks like it will work perfect for what I need.
For my own knowledge I am curious to know where JBoss sets its standard system properties such as ${jboss.server.name} and ${jboss.lib.url}?
I have to admit I have not searched the source code yet. -
6. Re: user defined system properties for JBoss configurations
alesj Nov 19, 2008 11:12 AM (in response to dbschofield)"dbschofield" wrote:
For my own knowledge I am curious to know where JBoss sets its standard system properties such as ${jboss.server.name} and ${jboss.lib.url}?
ServerConfigImpl -
7. Re: user defined system properties for JBoss configurations
dbschofield Nov 19, 2008 8:44 PM (in response to dbschofield)I have been trying to create my own bootstrap configuration by referencing my-properties.xml at the beginning of the bootstrap.xml
<bootstrap xmlns="urn:jboss:bootstrap:1.0"> <url>my-properties.xml</url> <url>classloader.xml</url> <url>aop.xml</url> <url>jmx.xml</url> <url>deployers.xml</url> <url>bindings.xml</url> <url>profile.xml</url> </bootstrap>
I am running into problems loading the jar file which has my system properties loader implementation. If I try to create my own classloader I get messages about it not being registered and if I try to use an existing classloader like the bootstrap-classloader it complains that the classloader is already registered. Given my deployment file:<?xml version="1.0" encoding="UTF-8"?> <!-- Loads Java properties files into the System.properties for use in JBoss configurations --> <deployment xmlns="urn:jboss:bean-deployer:2.0"> <bean name="SystemPropertiesLoader" class="com.foo.SystemPropertiesLoader"> <constructor> <parameter>${jboss.server.home.dir}/conf/my.properties</parameter> <parameter class="boolean">true</parameter> </constructor> </bean> </deployment>
My question is, how do I need to define my own classloader in the deployment file with classpath "${jboss.home.url}/my_dir/lib/SystemPropertiesLoader.jar" so it plays nice with JBoss? -
8. Re: user defined system properties for JBoss configurations
alesj Nov 20, 2008 5:19 AM (in response to dbschofield)"dbschofield" wrote:
My question is, how do I need to define my own classloader in the deployment file with classpath "${jboss.home.url}/my_dir/lib/SystemPropertiesLoader.jar" so it plays nice with JBoss?
I don't think you can, until the classloading.xml is initialized.
But since you want to have your props handling before that,
I guess you will have to put your jar into JBOSS_HOME/lib.
Then add this to your bean:<bean name="SystemPropertiesLoader" class="com.foo.SystemPropertiesLoader"> <classloader><null/></classloader> <constructor> <parameter>${jboss.server.home.dir}/conf/my.properties</parameter> <parameter class="boolean">true</parameter> </constructor> </bean>
Note: classloader element ;-) -
9. Re: user defined system properties for JBoss configurations
dimitris Nov 20, 2008 6:39 AM (in response to dbschofield)have you also tried:
run -P path-to-properties-file -
10. Re: user defined system properties for JBoss configurations
dbschofield Nov 20, 2008 3:17 PM (in response to dbschofield)Thanks dimitris, I knew there was a silver bullet out there somewhere. Works like a champ.
To Ales's credit I have learned a lot about the bootstrap process in JBoss 5 :)