Hi, I had the similar problem and later when I debugged the code I found out that class org.apache.openjpa.slice.jdbc.DistributedJDBCConfigurationImpl uses method verifyDataSource(slice, ds) and this method internally throws the the SQLException when it is trying to get the connection from the DataSource i.e. ds.getConnection() and the exact error that is provided by this SQLException in my case is:
java.sql.SQLException: Access denied for user ''@'mvodint1jbap01.mvodint1' (using password: NO) To fix this issue you have to download the openJPA (1.2.0) source code and modify it for single class org.apache.openjpa.jdbc.schema.SimpleDriverDataSource on line 60 which is return getConnection(null); to return getConnection(null,null); and recompile and then use the new jar file openjpa-1.2.0.jar :) ..... Regards, Ahson Imtiaz. thiago ananias wrote: > > 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-tp759642p1095443.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
