I've just started using ha-jdbc 2.1.0-beta-1 driver so as to create mysql cluster. After reading documentation I prepared xml configuration file just like this:
2012-10-25 00:10:47 net.sf.hajdbc.logging.commons.CommonsLogger log
INFO: Initializing HA-JDBC 2.1.0-beta-1 from C:\Program Files\Java\jdk1.6.0_27\jre\classes\ha-jdbc-cluster1.xml
java.sql.SQLException: No urlPattern property defined and no embedded database driver was detected on the classpath.
Cannot connect to database server: No urlPattern property defined and no embedded database driver was detected on the classpath.
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:52)
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:36)
at net.sf.hajdbc.sql.AbstractExceptionFactory.createException(AbstractExceptionFactory.java:49)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:94)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:33)
at net.sf.hajdbc.sql.Driver.connect(Driver.java:124)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at org.test.TesterHAJDBC.connectToMySQL(TesterHAJDBC.java:52)
at org.test.TesterHAJDBC.main(TesterHAJDBC.java:21)
Caused by: java.lang.IllegalArgumentException: No urlPattern property defined and no embedded database driver was detected on the classpath.
at net.sf.hajdbc.state.sql.SQLStateManagerFactory.createStateManager(SQLStateManagerFactory.java:108)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:631)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:75)
... 6 more
MySQL driver is already in classpath. What am I missing?
Thanks in advance for help.
Last edit: misiek 2012-10-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By default, HA-JDBC uses an embedded database to persist its cluster state. This implementation will attempt to use an H2, HSQLDB, or Apache Derby database. If neither of these drivers can be found, it will throw the exception seen above.
So, you have a few options:
Add one these jars to your classpath
Use some other JDBC driver, and specify the jdbc url accordingly.
e.g.
Hi,
I've just started using ha-jdbc 2.1.0-beta-1 driver so as to create mysql cluster. After reading documentation I prepared xml configuration file just like this:
<ha-jdbc xmlns="urn:ha-jdbc:cluster:2.1">
<sync id="diff">
<property name="fetchSize">1000</property>
<property name="maxBatchSize">100</property>
</sync>
</ha-jdbc>
I got the exception:
2012-10-25 00:10:47 net.sf.hajdbc.logging.commons.CommonsLogger log
INFO: Initializing HA-JDBC 2.1.0-beta-1 from C:\Program Files\Java\jdk1.6.0_27\jre\classes\ha-jdbc-cluster1.xml
java.sql.SQLException: No urlPattern property defined and no embedded database driver was detected on the classpath.
Cannot connect to database server: No urlPattern property defined and no embedded database driver was detected on the classpath.
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:52)
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:36)
at net.sf.hajdbc.sql.AbstractExceptionFactory.createException(AbstractExceptionFactory.java:49)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:94)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:33)
at net.sf.hajdbc.sql.Driver.connect(Driver.java:124)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at org.test.TesterHAJDBC.connectToMySQL(TesterHAJDBC.java:52)
at org.test.TesterHAJDBC.main(TesterHAJDBC.java:21)
Caused by: java.lang.IllegalArgumentException: No urlPattern property defined and no embedded database driver was detected on the classpath.
at net.sf.hajdbc.state.sql.SQLStateManagerFactory.createStateManager(SQLStateManagerFactory.java:108)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:631)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:75)
... 6 more
MySQL driver is already in classpath. What am I missing?
Thanks in advance for help.
Last edit: misiek 2012-10-24
By default, HA-JDBC uses an embedded database to persist its cluster state. This implementation will attempt to use an H2, HSQLDB, or Apache Derby database. If neither of these drivers can be found, it will throw the exception seen above.
So, you have a few options:
Use some other JDBC driver, and specify the jdbc url accordingly.
e.g.
Or use some other state manager implementation.
e.g.
Last edit: Paul Ferraro 2012-10-25