tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Easterling <stuart.easterl...@gmail.com>
Subject Re: Tomee + custom DataSource resource factory
Date Tue, 22 Apr 2014 22:11:42 GMT
Hi, many thanks for the suggestion. : ) So I've reviewed everything I can
find on Resource declarations in tomee.xml and resources.xml (and tried
various tests), and what's not entirely clear (to me) is: is creating a
DataSource using a custom javax.naming.spi.ObjectFactory supported...? I am
trying to do the following (this is the Tomcat impl):

http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Adding%20Custom%20Resource%20Factories

I've reviewed the following:

http://tomee.apache.org/containers-and-resources.html
http://tomee.apache.org/configuring-datasources.html
http://tomee.apache.org/examples-trunk/resources-declared-in-webapp/README.html
http://rmannibucau.wordpress.com/2013/11/05/openejbtomee-resources-how-does-it-work/

But it's not clear that a Resource declaration in tomee.xml has an
attribute that takes a subclass of javax.naming.spi.ObjectFactory?

(Also is some of the above documentation out-of-date as far as the latest
attributes, etc....? Is there something more up-to-date I'm
overlooking....?)

(And in the interim I am just instantiating / configuring my custom
DataSource in application code, but still curious how this might be doable.
: )

Best,
Stuart




On Tue, Apr 22, 2014 at 1:20 PM, Romain Manni-Bucau
<rmannibucau@gmail.com>wrote:

> Hi
>
> Did you try using resources.xml or tomee.xml? Basically context.xml
> datasources are converted to tomee datasources to get pooling etc by
> default. Using resources.xml you can define whatever you want so it
> should match your need.
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-04-22 21:49 GMT+02:00 Stuart Easterling <stuart.easterling@gmail.com
> >:
> > Greetings all, this may be a straightforward question, but I'm unable to
> > find a solution. Basically I need to define a DataSource with a custom
> > resource factory.
> >
> > According to this thread:
> >
> >
> http://openejb.979440.n4.nabble.com/Getting-Started-TomEE-Plus-and-Custom-Resources-td4662031.html
> >
> > in Tomee:
> >
> >>ObjectFactory have to be defined in context.xml. tomee.xml
> >>doesnt define jndi factories but directly objects
> >
> > But when I add the Resource in META-INF/context.xml or in
> conf/context.xml
> > I get the following warning:
> >
> > WARNING: Property "factory" not supported by
> "0-myAppName/my/resource/name"
> >
> > The Resource declaration looks like this:
> >
> > <Resource name="my/resource/name" auth="Container"
> >               type="javax.sql.DataSource"
> >                factory="the.factory.class"
> >                customParam="customParamValue"
> >           />
> >
> > I imagine the answer is an obvious one, but I've done a google search,
> > searched the mail archive, and reviewed the documentation and haven't
> found
> > a clear answer on how to proceed. I am running Tomee 1.6.0.
> >
> > Many thanks in advance to anyone who can help ! : )
> >
> > Best,
> > Stuart
>

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