Hi,

I'am a student from Brazil, i'am making a work for the university about
distributed database, and i found the "Slice" Project in the web, so i try
to implement the Slices on my work. (My english isn't good, i'am sorry about
this).

With only the OpenJPA it works, but when i try configure Slices it doesn't
work. 
(the persistence.xml it's
Man, i think that are two problems:

1) if i don't put this property "openjpa.ConnectionURL" it doesn't work, i
think that is not necessary if i configure slices, am i correct? 
2) I put the property "<property name="openjpa.slice.Names"
value="SQLSERVER,MYSQL"/>" but i catch this error

The first Info speak that slices are detected but happens this error

And i tested the databases separately without "Slices" and it works!!

can anybody help me please?

thank you!

Thiago Ananias.

ERROR
-------------------------------------------------------------------------------------------------
16  PersistenceUnit  INFO   [main] openjpa.Runtime - Detected slices
"[SQLSERVER, MYSQL]" in configuration.
94  PersistenceUnit  INFO   [main] openjpa.Runtime - Starting OpenJPA Slice
1.2.0
219  PersistenceUnit  INFO   [main] openjpa.jdbc.JDBC - Using dictionary
class "org.apache.openjpa.jdbc.sql.SQLServerDictionary".
281  PersistenceUnit.SQLSERVER  INFO   [main] openjpa.Runtime - Connecting
to slice "SQLSERVER" at URL
"jdbc:sqlserver://TANANIAS-D\SQLEXPRESS;database=cadastro;create=true"
406  PersistenceUnit.SQLSERVER  INFO   [main] openjpa.jdbc.JDBC - Using
dictionary class "org.apache.openjpa.jdbc.sql.SQLServerDictionary".
922  PersistenceUnit.MYSQL  INFO   [main] openjpa.Runtime - Connecting to
slice "MYSQL" at URL "jdbc:mysql://localhost:3306/cadastro"
922  PersistenceUnit.MYSQL  INFO   [main] openjpa.jdbc.JDBC - Using
dictionary class "org.apache.openjpa.jdbc.sql.MySQLDictionary".
Exception in thread "main" <openjpa-1.2.0-r422266:683325 nonfatal general
error> org.apache.openjpa.persistence.PersistenceException: There were
errors initializing your configuration: <openjpa-1.2.0-r422266:683325
nonfatal user error> org.apache.openjpa.util.UserException: No slices are
configured or available
        at
org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.createDistributedDataStore(DistributedJDBCConfigurationImpl.java:230)
        at
org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl.getConnectionFactory(DistributedJDBCConfigurationImpl.java:193)
        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.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:288)
        at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1432)
        at
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:646)
        at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:183)
        at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
        at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
        at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
        at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
        at br.unicsul.teste.Main.main(Main.java:37)
-------------------------------------------------------------------------------------------------
My "persistence.xml":

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0">
    <persistence-unit name="PersistenceUnit"
transaction-type="RESOURCE_LOCAL">
       
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <class>br.unicsul.teste.Message</class>

        <properties>

            <property name="openjpa.BrokerFactory" value="slice"/>
            <property name="openjpa.slice.DistributionPolicy"
value="br.unicsul.teste.DistributionRules"/>
            <property name="openjpa.slice.Names" value="SQLSERVER,MYSQL"/>
            <property name="openjpa.slice.Master" value="SQLSERVER"/>

            <property name="openjpa.ConnectionURL"
value="jdbc:sqlserver://TANANIAS-D\SQLEXPRESS;database=cadastro;create=true"/>
            <property name="openjpa.ConnectionDriverName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
            <property name="openjpa.ConnectionUserName" value="sa"/>
            <property name="openjpa.ConnectionPassword"
value="testando123"/>

            <property name="openjpa.slice.SQLSERVER.ConnectionURL"
value="jdbc:sqlserver://TANANIAS-D\SQLEXPRESS;database=cadastro;create=true"/>
            <property name="openjpa.slice.SQLSERVER.ConnectionDriverName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
            <property name="openjpa.slice.SQLSERVER.ConnectionUserName"
value="sa"/>
            <property name="openjpa.slice.SQLSERVER.ConnectionPassword"
value="testando123"/>

            <property name="openjpa.slice.MYSQL.ConnectionURL"
value="jdbc:mysql://localhost:3306/cadastro"/>            
            <property name="openjpa.slice.MYSQL.ConnectionDriverName"
value="com.mysql.jdbc.Driver"/>
            <property name="openjpa.slice.MYSQL.ConnectionUserName"
value="root"/>
            <property name="openjpa.slice.MYSQL.ConnectionPassword"
value="sa"/>

        </properties>
    </persistence-unit>
</persistence>


-- 
View this message in context: 
http://n2.nabble.com/Problems-with-configuring-OpenJPA-%22Slices%22-tp759642p759642.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to