You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by RICHARD LUONG <rl...@gmail.com> on 2011/08/02 03:03:16 UTC

Slice and connection pools

Hi,

Does Slice support using a connection pool?  I was able to get the
connection pool working when not using Slice with the following
persistence-unit:

    <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
        <provider>
            org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>

        <properties>
<property name="openjpa.ConnectionProperties"
                value="DriverClassName=com.mysql.jdbc.Driver,
                  Url=jdbc:mysql://url:3306/test,
                  MaxActive=300,
                  TestOnBorrow=true,
                  Username=user,
                  Password=password"/>
            <property name="openjpa.ConnectionDriverName"
                value="org.apache.commons.dbcp.BasicDataSource"/>
        </properties>
     </persistence-unit>

However, I got an error when attempting to use it in Slice, with the
following:

    <persistence-unit name="test2" transaction-type="RESOURCE_LOCAL">
        <provider>
            org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>

<properties>
 <property name="openjpa.Log" value="Runtime=TRACE, SQL=TRACE,
DefaultLevel=TRACE, Tool=TRACE"/>
<property name="openjpa.BrokerFactory" value="slice"/>
 <property name="openjpa.slice.Names"   value="slice1"/>
<property name="openjpa.slice.Master"  value="slice1"/>
 <!-- Lenient: Allows DB to continue, even when one slice is unavailable.
-->
<property name="openjpa.slice.Lenient" value="true"/>

<property name="openjpa.ConnectionDriverName"
          value="org.apache.commons.dbcp.BasicDataSource"/>

<property name="openjpa.slice.slice1.ConnectionProperties"
                value="DriverClassName=com.mysql.jdbc.Driver,
                  Url=jdbc:mysql://url:3306/test,
                  MaxActive=300,
                  TestOnBorrow=true,
                  Username=user,
                  Password=password"/>
 <property name="openjpa.slice.DistributionPolicy"

value="com.....service.openjpa.DistributeByInstitutionPolicy"/>
<property name="openjpa.slice.FinderTargetPolicy"
                   value="com.....service.openjpa.ShardFinderTargetPolicy"/>
<property name="openjpa.slice.ReplicatedTypes"
                   value="com...."/>

. <property name="openjpa.QueryCache" value="false"/>
 <property name="openjpa.DataCache" value="false"/>
. <property name="openjpa.QueryCompilationCache" value="false"/>
 <property name="openjpa.jdbc.QuerySQLCache" value="false"/>
<property name="openjpa.jdbc.FinderCache" value="false"/>
 <property name="openjpa.DetachState"
value="loaded(DetachedStateField=false)"/>
 </properties>
    </persistence-unit>


Am I missing something in my configuration or is this just something that is
not supported by Slice?  If it's not supported, are there any recommended
alternatives?

Thanks,
Richard.

Re: Slice and connection pools

Posted by Pinaki Poddar <pp...@apache.org>.
Mike,
> I don't think we've done much (any) experimentation with slice + Tomcat's
> connection pool. 
If a normal single-unit JPA can use Tomcat's connection pool, then a slice
should as well (at least in theory:). 

Slice does not make any special arrangements for connection, it merely uses
JDBCConfiguration for each slice and somehow stitches up all the
configurations into a single DistributedConfiguration so that the client
(i.e. EntityManager or Broker) continue to function as if it is connected to
a single (albeit virtual) database. 

So in case theory does not work in practice (which theories seldom do), the
cost of repair is not high. 

Thanks for updating the manual. 

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: http://openjpa.208410.n2.nabble.com/Slice-and-connection-pools-tp6643295p6649891.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Slice and connection pools

Posted by Michael Dick <mi...@gmail.com>.
Let us know what you find. I don't think we've done much (any)
experimentation with slice + Tomcat's connection pool.

FWIW I did put in a quick update to the manual for the DBDictionary setting.
It should show up in tonight's build.

-mike

On Wed, Aug 3, 2011 at 1:29 PM, RICHARD LUONG <rl...@gmail.com> wrote:

> That's correct Mike.
>
> Also, thus far, I could only get OpenJPA slice working with DBCP.  There
> seems to be an issue with using Tomcat Connection Pool.  Once I have more
> time to trace/debug what's going on, I'll post it on a new thread.
>
> Richard.
>
> On Wed, Aug 3, 2011 at 11:01 AM, Michael Dick <michael.d.dick@gmail.com
> >wrote:
>
> > I think Richard's configuration is correct. The only catch, which he
> > pointed
> > out,  is that you do have to specify the DBDictionary to use. Maybe I
> > missed
> > something though?
> >
> > I'm not sure whether having to specify the DBDictionary is the result of
> > the
> > automagic connection pool support, but for the time being we should
> update
> > the documentation to reflect this requirement.
> >
> > In case I missed something, here's the persistence unit from the
> > openjpa-slice module that I used to reproduce the problem :
> > http://pastebin.com/W47zy9ms
> >
> > -mike
> >
> > On Wed, Aug 3, 2011 at 10:05 AM, Pinaki Poddar <pp...@apache.org>
> wrote:
> >
> > > The connection pooling can be configured for each slice as you would do
> > > normally [1] for a single database. The property names however will
> > change.
> > >
> > > <property name="openjpa.slice.One.ConnectionProperties" value=..../>
> > >
> > > However, we have introduced some new mechanics that can configure a
> > > connection pool automagically when commons dbcp in classpath. I do not
> > > think
> > > that this new mechanics have taken Slice connection establishment into
> > > account.
> > >
> > >
> > > [1]
> > >
> > >
> >
> http://openjpa.apache.org/faq.html#FAQ-HowdoIenableconnectionpoolinginOpenJPA%253F
> > >
> > > -----
> > > Pinaki Poddar
> > > Chair, Apache OpenJPA Project
> > > --
> > > View this message in context:
> > >
> >
> http://openjpa.208410.n2.nabble.com/Slice-and-connection-pools-tp6643295p6649074.html
> > > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > >
> >
>

Re: Slice and connection pools

Posted by RICHARD LUONG <rl...@gmail.com>.
That's correct Mike.

Also, thus far, I could only get OpenJPA slice working with DBCP.  There
seems to be an issue with using Tomcat Connection Pool.  Once I have more
time to trace/debug what's going on, I'll post it on a new thread.

Richard.

On Wed, Aug 3, 2011 at 11:01 AM, Michael Dick <mi...@gmail.com>wrote:

> I think Richard's configuration is correct. The only catch, which he
> pointed
> out,  is that you do have to specify the DBDictionary to use. Maybe I
> missed
> something though?
>
> I'm not sure whether having to specify the DBDictionary is the result of
> the
> automagic connection pool support, but for the time being we should update
> the documentation to reflect this requirement.
>
> In case I missed something, here's the persistence unit from the
> openjpa-slice module that I used to reproduce the problem :
> http://pastebin.com/W47zy9ms
>
> -mike
>
> On Wed, Aug 3, 2011 at 10:05 AM, Pinaki Poddar <pp...@apache.org> wrote:
>
> > The connection pooling can be configured for each slice as you would do
> > normally [1] for a single database. The property names however will
> change.
> >
> > <property name="openjpa.slice.One.ConnectionProperties" value=..../>
> >
> > However, we have introduced some new mechanics that can configure a
> > connection pool automagically when commons dbcp in classpath. I do not
> > think
> > that this new mechanics have taken Slice connection establishment into
> > account.
> >
> >
> > [1]
> >
> >
> http://openjpa.apache.org/faq.html#FAQ-HowdoIenableconnectionpoolinginOpenJPA%253F
> >
> > -----
> > Pinaki Poddar
> > Chair, Apache OpenJPA Project
> > --
> > View this message in context:
> >
> http://openjpa.208410.n2.nabble.com/Slice-and-connection-pools-tp6643295p6649074.html
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >
>

Re: Slice and connection pools

Posted by Michael Dick <mi...@gmail.com>.
I think Richard's configuration is correct. The only catch, which he pointed
out,  is that you do have to specify the DBDictionary to use. Maybe I missed
something though?

I'm not sure whether having to specify the DBDictionary is the result of the
automagic connection pool support, but for the time being we should update
the documentation to reflect this requirement.

In case I missed something, here's the persistence unit from the
openjpa-slice module that I used to reproduce the problem :
http://pastebin.com/W47zy9ms

-mike

On Wed, Aug 3, 2011 at 10:05 AM, Pinaki Poddar <pp...@apache.org> wrote:

> The connection pooling can be configured for each slice as you would do
> normally [1] for a single database. The property names however will change.
>
> <property name="openjpa.slice.One.ConnectionProperties" value=..../>
>
> However, we have introduced some new mechanics that can configure a
> connection pool automagically when commons dbcp in classpath. I do not
> think
> that this new mechanics have taken Slice connection establishment into
> account.
>
>
> [1]
>
> http://openjpa.apache.org/faq.html#FAQ-HowdoIenableconnectionpoolinginOpenJPA%253F
>
> -----
> Pinaki Poddar
> Chair, Apache OpenJPA Project
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Slice-and-connection-pools-tp6643295p6649074.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: Slice and connection pools

Posted by Pinaki Poddar <pp...@apache.org>.
The connection pooling can be configured for each slice as you would do
normally [1] for a single database. The property names however will change.

<property name="openjpa.slice.One.ConnectionProperties" value=..../>

However, we have introduced some new mechanics that can configure a
connection pool automagically when commons dbcp in classpath. I do not think
that this new mechanics have taken Slice connection establishment into
account. 


[1]
http://openjpa.apache.org/faq.html#FAQ-HowdoIenableconnectionpoolinginOpenJPA%253F

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: http://openjpa.208410.n2.nabble.com/Slice-and-connection-pools-tp6643295p6649074.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Slice and connection pools

Posted by RICHARD LUONG <rl...@gmail.com>.
Ok, I've found a workaround.  The code seems to be failing because it cannot
determine the DBDictionary to use.  It uses the ConnectionURL (null) and the
ConnectionDriverName (which points to the pool) to determine the
DBDictionary.  Once that fails, it attempts to connect to the database to
try and determine the dictionary.  It tries to grab a slice, but the
collection of slices is empty, since this is all happening during the
process of adding the first slice.  With no slice, it cannot connect and
throws no slices configured exception.

The workaround that I'm doing is explicitly setting the DBDictionary with
the following in my persistence-unit properties:
<property name="openjpa.jdbc.DBDictionary" value="mysql"/>

Hope that helps anyone else that runs into the same issue.

Richard.

On Tue, Aug 2, 2011 at 8:51 AM, RICHARD LUONG <rl...@gmail.com> wrote:

> I'm getting the following error:
>
> Caused by: <openjpa-2.1.0-r422266:1071316 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: No slices are configured
> or available
>  at
> org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.createDistributedDataStore(DistributedJDBCConfigurationImpl.java:363)
> at
> org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.createConnectionFactory(DistributedJDBCConfigurationImpl.java:626)
>  at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:602)
> at
> org.apache.openjpa.jdbc.meta.MappingDefaultsImpl.setConfiguration(MappingDefaultsImpl.java:878)
>  at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:486)
> at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
>  at
> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
> at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
>  at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getMappingDefaultsInstance(JDBCConfigurationImpl.java:706)
> at
> org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.newSlice(DistributedJDBCConfigurationImpl.java:467)
>  at
> org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.fromProperties(DistributedJDBCConfigurationImpl.java:618)
> at
> org.apache.openjpa.lib.conf.MapConfigurationProvider.setInto(MapConfigurationProvider.java:85)
>  at
> org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationProviderImpl.setInto(PersistenceProductDerivation.java:698)
> at
> org.apache.openjpa.slice.jdbc.DistributedJDBCBrokerFactory.newInstance(DistributedJDBCBrokerFactory.java:56)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
>  at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:131)
> at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:65)
>  at
> org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(PersistenceProviderImpl.java:151)
> at
> org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:191)
>  at
> org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:66)
> at
> org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
>  at
> org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
>  at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
> ... 130 more
>
> On Tue, Aug 2, 2011 at 6:29 AM, Rick Curtis <cu...@gmail.com> wrote:
>
>> What is the error that you are seeing?
>>
>> On Mon, Aug 1, 2011 at 8:03 PM, RICHARD LUONG <rl...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > Does Slice support using a connection pool?  I was able to get the
>> > connection pool working when not using Slice with the following
>> > persistence-unit:
>> >
>> >    <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
>> >        <provider>
>> >            org.apache.openjpa.persistence.PersistenceProviderImpl
>> >        </provider>
>> >
>> >        <properties>
>> > <property name="openjpa.ConnectionProperties"
>> >                value="DriverClassName=com.mysql.jdbc.Driver,
>> >                  Url=jdbc:mysql://url:3306/test,
>> >                  MaxActive=300,
>> >                  TestOnBorrow=true,
>> >                  Username=user,
>> >                  Password=password"/>
>> >            <property name="openjpa.ConnectionDriverName"
>> >                value="org.apache.commons.dbcp.BasicDataSource"/>
>> >        </properties>
>> >     </persistence-unit>
>> >
>> > However, I got an error when attempting to use it in Slice, with the
>> > following:
>> >
>> >    <persistence-unit name="test2" transaction-type="RESOURCE_LOCAL">
>> >        <provider>
>> >            org.apache.openjpa.persistence.PersistenceProviderImpl
>> >        </provider>
>> >
>> > <properties>
>> >  <property name="openjpa.Log" value="Runtime=TRACE, SQL=TRACE,
>> > DefaultLevel=TRACE, Tool=TRACE"/>
>> > <property name="openjpa.BrokerFactory" value="slice"/>
>> >  <property name="openjpa.slice.Names"   value="slice1"/>
>> > <property name="openjpa.slice.Master"  value="slice1"/>
>> >  <!-- Lenient: Allows DB to continue, even when one slice is
>> unavailable.
>> > -->
>> > <property name="openjpa.slice.Lenient" value="true"/>
>> >
>> > <property name="openjpa.ConnectionDriverName"
>> >          value="org.apache.commons.dbcp.BasicDataSource"/>
>> >
>> > <property name="openjpa.slice.slice1.ConnectionProperties"
>> >                value="DriverClassName=com.mysql.jdbc.Driver,
>> >                  Url=jdbc:mysql://url:3306/test,
>> >                  MaxActive=300,
>> >                  TestOnBorrow=true,
>> >                  Username=user,
>> >                  Password=password"/>
>> >  <property name="openjpa.slice.DistributionPolicy"
>> >
>> > value="com.....service.openjpa.DistributeByInstitutionPolicy"/>
>> > <property name="openjpa.slice.FinderTargetPolicy"
>> >
>> value="com.....service.openjpa.ShardFinderTargetPolicy"/>
>> > <property name="openjpa.slice.ReplicatedTypes"
>> >                   value="com...."/>
>> >
>> > . <property name="openjpa.QueryCache" value="false"/>
>> >  <property name="openjpa.DataCache" value="false"/>
>> > . <property name="openjpa.QueryCompilationCache" value="false"/>
>> >  <property name="openjpa.jdbc.QuerySQLCache" value="false"/>
>> > <property name="openjpa.jdbc.FinderCache" value="false"/>
>> >  <property name="openjpa.DetachState"
>> > value="loaded(DetachedStateField=false)"/>
>> >  </properties>
>> >    </persistence-unit>
>> >
>> >
>> > Am I missing something in my configuration or is this just something
>> that
>> > is
>> > not supported by Slice?  If it's not supported, are there any
>> recommended
>> > alternatives?
>> >
>> > Thanks,
>> > Richard.
>> >
>>
>>
>>
>> --
>> *Rick Curtis*
>>
>
>

Re: Slice and connection pools

Posted by RICHARD LUONG <rl...@gmail.com>.
I'm getting the following error:

Caused by: <openjpa-2.1.0-r422266:1071316 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: No slices are configured
or available
 at
org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.createDistributedDataStore(DistributedJDBCConfigurationImpl.java:363)
at
org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.createConnectionFactory(DistributedJDBCConfigurationImpl.java:626)
 at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:602)
at
org.apache.openjpa.jdbc.meta.MappingDefaultsImpl.setConfiguration(MappingDefaultsImpl.java:878)
 at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:486)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
 at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
 at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getMappingDefaultsInstance(JDBCConfigurationImpl.java:706)
at
org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.newSlice(DistributedJDBCConfigurationImpl.java:467)
 at
org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.fromProperties(DistributedJDBCConfigurationImpl.java:618)
at
org.apache.openjpa.lib.conf.MapConfigurationProvider.setInto(MapConfigurationProvider.java:85)
 at
org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationProviderImpl.setInto(PersistenceProductDerivation.java:698)
at
org.apache.openjpa.slice.jdbc.DistributedJDBCBrokerFactory.newInstance(DistributedJDBCBrokerFactory.java:56)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:131)
at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:65)
 at
org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(PersistenceProviderImpl.java:151)
at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:191)
 at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:66)
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
 at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
 at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 130 more

On Tue, Aug 2, 2011 at 6:29 AM, Rick Curtis <cu...@gmail.com> wrote:

> What is the error that you are seeing?
>
> On Mon, Aug 1, 2011 at 8:03 PM, RICHARD LUONG <rl...@gmail.com> wrote:
>
> > Hi,
> >
> > Does Slice support using a connection pool?  I was able to get the
> > connection pool working when not using Slice with the following
> > persistence-unit:
> >
> >    <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
> >        <provider>
> >            org.apache.openjpa.persistence.PersistenceProviderImpl
> >        </provider>
> >
> >        <properties>
> > <property name="openjpa.ConnectionProperties"
> >                value="DriverClassName=com.mysql.jdbc.Driver,
> >                  Url=jdbc:mysql://url:3306/test,
> >                  MaxActive=300,
> >                  TestOnBorrow=true,
> >                  Username=user,
> >                  Password=password"/>
> >            <property name="openjpa.ConnectionDriverName"
> >                value="org.apache.commons.dbcp.BasicDataSource"/>
> >        </properties>
> >     </persistence-unit>
> >
> > However, I got an error when attempting to use it in Slice, with the
> > following:
> >
> >    <persistence-unit name="test2" transaction-type="RESOURCE_LOCAL">
> >        <provider>
> >            org.apache.openjpa.persistence.PersistenceProviderImpl
> >        </provider>
> >
> > <properties>
> >  <property name="openjpa.Log" value="Runtime=TRACE, SQL=TRACE,
> > DefaultLevel=TRACE, Tool=TRACE"/>
> > <property name="openjpa.BrokerFactory" value="slice"/>
> >  <property name="openjpa.slice.Names"   value="slice1"/>
> > <property name="openjpa.slice.Master"  value="slice1"/>
> >  <!-- Lenient: Allows DB to continue, even when one slice is unavailable.
> > -->
> > <property name="openjpa.slice.Lenient" value="true"/>
> >
> > <property name="openjpa.ConnectionDriverName"
> >          value="org.apache.commons.dbcp.BasicDataSource"/>
> >
> > <property name="openjpa.slice.slice1.ConnectionProperties"
> >                value="DriverClassName=com.mysql.jdbc.Driver,
> >                  Url=jdbc:mysql://url:3306/test,
> >                  MaxActive=300,
> >                  TestOnBorrow=true,
> >                  Username=user,
> >                  Password=password"/>
> >  <property name="openjpa.slice.DistributionPolicy"
> >
> > value="com.....service.openjpa.DistributeByInstitutionPolicy"/>
> > <property name="openjpa.slice.FinderTargetPolicy"
> >
> value="com.....service.openjpa.ShardFinderTargetPolicy"/>
> > <property name="openjpa.slice.ReplicatedTypes"
> >                   value="com...."/>
> >
> > . <property name="openjpa.QueryCache" value="false"/>
> >  <property name="openjpa.DataCache" value="false"/>
> > . <property name="openjpa.QueryCompilationCache" value="false"/>
> >  <property name="openjpa.jdbc.QuerySQLCache" value="false"/>
> > <property name="openjpa.jdbc.FinderCache" value="false"/>
> >  <property name="openjpa.DetachState"
> > value="loaded(DetachedStateField=false)"/>
> >  </properties>
> >    </persistence-unit>
> >
> >
> > Am I missing something in my configuration or is this just something that
> > is
> > not supported by Slice?  If it's not supported, are there any recommended
> > alternatives?
> >
> > Thanks,
> > Richard.
> >
>
>
>
> --
> *Rick Curtis*
>

Re: Slice and connection pools

Posted by Rick Curtis <cu...@gmail.com>.
What is the error that you are seeing?

On Mon, Aug 1, 2011 at 8:03 PM, RICHARD LUONG <rl...@gmail.com> wrote:

> Hi,
>
> Does Slice support using a connection pool?  I was able to get the
> connection pool working when not using Slice with the following
> persistence-unit:
>
>    <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
>        <provider>
>            org.apache.openjpa.persistence.PersistenceProviderImpl
>        </provider>
>
>        <properties>
> <property name="openjpa.ConnectionProperties"
>                value="DriverClassName=com.mysql.jdbc.Driver,
>                  Url=jdbc:mysql://url:3306/test,
>                  MaxActive=300,
>                  TestOnBorrow=true,
>                  Username=user,
>                  Password=password"/>
>            <property name="openjpa.ConnectionDriverName"
>                value="org.apache.commons.dbcp.BasicDataSource"/>
>        </properties>
>     </persistence-unit>
>
> However, I got an error when attempting to use it in Slice, with the
> following:
>
>    <persistence-unit name="test2" transaction-type="RESOURCE_LOCAL">
>        <provider>
>            org.apache.openjpa.persistence.PersistenceProviderImpl
>        </provider>
>
> <properties>
>  <property name="openjpa.Log" value="Runtime=TRACE, SQL=TRACE,
> DefaultLevel=TRACE, Tool=TRACE"/>
> <property name="openjpa.BrokerFactory" value="slice"/>
>  <property name="openjpa.slice.Names"   value="slice1"/>
> <property name="openjpa.slice.Master"  value="slice1"/>
>  <!-- Lenient: Allows DB to continue, even when one slice is unavailable.
> -->
> <property name="openjpa.slice.Lenient" value="true"/>
>
> <property name="openjpa.ConnectionDriverName"
>          value="org.apache.commons.dbcp.BasicDataSource"/>
>
> <property name="openjpa.slice.slice1.ConnectionProperties"
>                value="DriverClassName=com.mysql.jdbc.Driver,
>                  Url=jdbc:mysql://url:3306/test,
>                  MaxActive=300,
>                  TestOnBorrow=true,
>                  Username=user,
>                  Password=password"/>
>  <property name="openjpa.slice.DistributionPolicy"
>
> value="com.....service.openjpa.DistributeByInstitutionPolicy"/>
> <property name="openjpa.slice.FinderTargetPolicy"
>                   value="com.....service.openjpa.ShardFinderTargetPolicy"/>
> <property name="openjpa.slice.ReplicatedTypes"
>                   value="com...."/>
>
> . <property name="openjpa.QueryCache" value="false"/>
>  <property name="openjpa.DataCache" value="false"/>
> . <property name="openjpa.QueryCompilationCache" value="false"/>
>  <property name="openjpa.jdbc.QuerySQLCache" value="false"/>
> <property name="openjpa.jdbc.FinderCache" value="false"/>
>  <property name="openjpa.DetachState"
> value="loaded(DetachedStateField=false)"/>
>  </properties>
>    </persistence-unit>
>
>
> Am I missing something in my configuration or is this just something that
> is
> not supported by Slice?  If it's not supported, are there any recommended
> alternatives?
>
> Thanks,
> Richard.
>



-- 
*Rick Curtis*