tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <>
Subject [jira] [Commented] (TOMEE-2189) Allow for custom properties in application context.xml
Date Mon, 30 Apr 2018 14:29:00 GMT


Romain Manni-Bucau commented on TOMEE-2189:


it sounds more like a tomcat issue.

In tomee we already have some integration with dynamic properties using placeholders from
system props (like tomcat) or the environment. We even have preconfigured templates for resources
for openshift).


> Allow for custom properties in application context.xml
> ------------------------------------------------------
>                 Key: TOMEE-2189
>                 URL:
>             Project: TomEE
>          Issue Type: New Feature
>          Components: TomEE Core Server
>    Affects Versions: 7.0.4
>         Environment: Docker, OpenShift instance.
>            Reporter: Clinton A Lester
>            Priority: Major
>              Labels: easyfix
> Apologies in advance if this is a Tomcat vs TomEE issue. Please direct this appropriately
if that is the case.
> Issue: Currently we are unable to easily extend the DataSourceFactory class to allow
for additional custom properties in the context.xml. The reasoning is mostly that the ALL_PROPERTIES
is final. Currently to achieve this we have override the 
> getObjectInstance() method and essentially copied and pasted most of the method, only
to add a small code snippet at the end to add addtional values to the properties object that
is passed in to createDataSource().
> Java class:
> org.apache.tomcat.jdbc.pool.DataSourceFactory
> Use Case:
> Background: Our builds and deployments run in OpenShift on a docker instance. We have
sourced the base image of TomEE which at build time is complied and a image spun up and then
our code is deployed. This base image is the same for every service. In an effort to keep
uniformity, we have need to specify multiple data sources in context.xml as well as securely
provide the username, password, and database urls.
> Current approach: Rather than list the username, password, and url in the context.xml
which is insecure, we provide them in the form of OpenShift "secrets" which are only accessible
through the environment variable in OpenShift at deploy time. To do so we have extended DataSourceFactory
to read them from files that we create and add them to the poolProperties. To take this further,
for multiple datasources, we need multiple files. This requires us to pass in the file names
at startup. To accomplish this we override getObjectInstace() as mentioned before.
> The request is to mitigate the need to copy/paste code by making the properties configurable
or extend friendly.
> I have placed the priority as major, as we are vulnerable to constant patch updates with
new releases, since we have copy/pasted the method within our extended class.
> Let me know if I can be more informative on our use case and why this feature would be
a benefit to others seeking a configurable and secure way to provide credentials to the resources
in TomEE server.
> Additionally I believe this change is small and simple enough, so I will apply the corresponding
tags if available.

This message was sent by Atlassian JIRA

View raw message