tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Gallimore <jonathan.gallim...@gmail.com>
Subject Re: datasource duplication in tomee
Date Fri, 11 Aug 2017 11:56:07 GMT
Thanks! I'll take a look at that - ideally, using context.xml wouldn't
cause this, so it'll be interesting to see what it going on there. I would
normally define datasource in conf/tomee.xml. There is a mechanism built in
for ciphering password - take a look at the "Password and ciphering"
section on http://tomee.apache.org/admin/configuration/resources.html.

Hope that helps.

Jon

On Fri, Aug 11, 2017 at 12:48 PM, dmcletchie <dmcletchie@gmail.com> wrote:

> Thank you both for replying - Much appreciated!
>
> Here's the war file, build with source (all 3 or 4 lines!).  It's only a
> few
> KB, so hopefully it'll let me attach it.
>
> helloWorld.war
> <http://tomee-openejb.979440.n4.nabble.com/file/n4682435/helloWorld.war>
>
> I don't have a great reason for picking context.xml.  I want to do this in
> a
> more standard / common / tested way, so I'll try to look into that & change
> it.
>
> The only "gotcha" is that I was trying to obfuscate the database password,
> by encrypting it. The code to decrypt it is in each war file.  To decrypt,
> I
> was defining a factory in the resource in context.xml.  That factory points
> to a class that extends org.apache.tomcat.dbcp.dbcp2.
> BasicDataSourceFactory.
> So, I could not define the resource in a global way, since the global class
> loader does not know how to get to the factory in the war file.
>
> I'd rather not define the resource in the war file, since we might want to
> change some of the parameters like the URL, username, pool size, etc. per
> server that we install on.  I don't want to have to edit war file, I'd
> rather have the configuration live outside of the war file.  (especially
> for
> upgrades, I want to make it easy to deploy new war files)
>
> I do have options though - I guess that I could use a globally defined
> resource, and I could put the decrypt code in a jar in the libs directory.
> Given that I want to obfuscate the password (I know that it's not super
> secure), what's my best bet for setting up a data source?
>
> I don't know if it's the same instance or not.  I'm poking around the
> mbeans
> with jvisialvm ... i'm a bit over my head.
> I have 2 entries in
> Rouserce->Context -> localhost -> /helloWorld ->
> org.apache.tomee.catalina.TomcatResourceFactory
> They are:
> "openejb/Resource/helloWorld/jdbc/foobar" and
> "openejb/Resource/jdbc/foobar"
> there is e endtry in
> Rouserce->Context -> localhost -> /helloWorld -> javax.sql.DataSource
> it is
> "jdbc/foobar"
>
> I think that there are 2 instances.  If I set the min/max/initial size of
> the pool to 11 connections, I end up with 22 sessions in my database.  If I
> cut & paste the resource definition into server.xml (and leave context.xml
> empty), then I end up with 11 connections (which I expect)
>
> Let me know what you think the path of least resistance is for me to
> obfuscate a password like this... I'll try to set it up that way.
>
> Thanks again!
>
> Doug
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/datasource-duplication-in-tomee-tp4682413p4682435.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message