On Jun 5, 2007, at 1:46 PM, toby cabot wrote:
Hi Folks,
In my application of Geronimo I need to add a third-party log4j
appender to send log messages as SNMP traps. I can add the jars I
need to the j2ee-system pom.xml and build a custom Geronimo image, but
it would be better if I could do everything at run-time so I could use
an unmolested Geronimo.
Is there a way to add dependency jars to a configuration at run-time?
No. Some people think this is a good thing (me) and some people
think this is a bad thing.
It might work to put them in lib/endorsed, but I don't know if this
would work or if it would have other side effects.
Is there any way to do something like write a gbean to instantiate
the appender and register it with log4j? Then perhaps your appender
doesn't need to be in the same classloader as the rest of log4j.
In case that doesn't work...
One trick to be aware of (for g 2.0 and I think 1.2 but probably not
earlier versions) is that you can use artifact_aliases.properties to
replace dependencies on one configuration with another. So you could
build your own replacement server.jar (which is a renamed j2ee-
system.car) and by a line like this in artifact_aliases.car run the
rest of the g. modules unmodified on top of your replacement system
configuration:
org.apache.geronimo.configs/j2ee-system//car=org.toby/cabot-system/
1.0/car
hope this helps
david jencks
For example, could I add something to config.xml so that my jars would
get added to the j2ee-system classpath? I tried adding the following
to var/config/config.xml (based on some other :
<module name="org.apache.geronimo.configs/j2ee-system/2.0-
SNAPSHOT/car">
<gbean name="org.apache.geronimo.configs/j2ee-system/2.0-
SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/j2ee-system/
2.0-SNAPSHOT/car,j2eeType=SystemLog,name=Logger">
<attribute name="configFileName">/path/to/my/log4j.xml</
attribute>
<attribute name="defaultEnvironment">
<environment xmlns="http://geronimo.apache.org/xml/
ns/deployment-1.2">
<dependencies>
<dependency>
<groupId>westhawk</groupId>
<artifactId>snmp</artifactId>
<type>jar</type>
<version>5.1</version>
</dependency>
<dependency>
<groupId>mycode</groupId>
<artifactId>log</artifactId>
<type>jar</type>
<version>1.0</version>
</dependency>
</dependencies>
</environment>
</attribute>
</gbean>
</module>
This partially worked - Geronimo used my log4j.xml file. It didn't
add the jars to the classpath, though. The jars are in the repository
and they're added to the classpath when I declare them in the pom.xml
and rebuild.
Thanks,
Toby