I am trying to deploy HAJDBC as a JDBC Driver in JBoss 7.1.3 as a module.
I am struggling to get JBoss to recognise the HAJDBC as a module - and I am trying to work out if this is a JBoss issue, or something I am not understanding about using HAJDBC.
Has anyone tried this combination before - and share their experience.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The net/sf/ha-jdbc/main/module.xml should look something like this:
<?xml version="1.0" encoding="UTF-8"?><modulexmlns="urn:jboss:module:1.1"name="net.sf.ha-jdbc"><resources><resource-rootpath="ha-jdbc-2.1.0-beta-3.jar"/><resource-rootpath="."/></resources><dependencies><modulename="javax.api"/><modulename="javax.transaction.api"/><modulename="javax.xml.bind.api"/><modulename="org.jgroups"/><modulename="org.jboss.logging"/><modulename="org.apache.commons.pool"/><!-- module dependency for state manager --><!-- module dependency for JDBC driver --></dependencies></module>
Let me know what specific issue you have.
Last edit: Paul Ferraro 2013-02-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the info - I was wondering how to scope the ha-jdbc-mycluster.xml into the driver.
I manager to get JBoss now loading up the hajdbc driver (JBoss modules TRACE showed the classes being found and loaded), but I have now hit a strange one.
I am getting this error message:
JBAS010402: Unable to instantiate driver class "net.sf.hajdbc.sql.Driver": java.lang.NumberFormatException: For input string: "2.1.0-beta-4-SNAPSHOT"
I have traced it to the Versions.class - which uses Version.properties file - to get a version string - pulled from the Maven POM file - currenltly 2.1.0-beta-4-SNAPSHOT
Debugging it seems:
private static int getVersionPart(int index)
{
return Integer.parseInt(getVersion().split(Pattern.quote(Strings.DASH), 1)[0].split(Pattern.quote(Strings.DOT), index + 1)[index]);
}
is not parsing the string 2.1.0-beta-4-SNAPSHOT correctly.
But the code looks OK to me (not sure about the Pattern.quote use - but removing it makes the same error).
I haveb't get been able to trace where the Version class is being called from - in case I have configured something wrong
Has this been reported ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your module files should only include the module.xml, ha-jdbc jar and ha-jdbc configuration. The resources should list both the jar and the xml configuration file.
What path on the filesystem (relative to the module root directory) are you using for the ha-jdbc module?
Seem to be hitting a dead end. Let me try and explain.
I have added resource-root path="ha-jdbc-mycluster.xml" to the JBoss module.xml.
The first impact is now that I do not end up wiuth a JNDI bind datasource. JBoss reports that for that datasource there is an un-met depenency:
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.hajdbc (missing) dependents: [service jboss.data-source.java:jboss/datasources/TestHAJDBC]
Just to check I commented out the added resource-root - and all starts up well.
So I added the resource-root back in - and again, the failure.
So, I enabled Trace level debug on org.jboss.modules - and searched the log file for any reference to ha-jdbc-mycluster.xml
And strangely enough there is not mention of ha-jdbc-mycluser at all !!! Pulled the JBoss module source code - and would have expected to see : 'Failed to add resource root' message for a errant resource path error.
Again, searched the log file - nothing.
Reading into JBoss-Modules it does seem to suggest that we can add both JAR files and resources to a module. And loading the ha-jdbc module seems to not succeed because it knows there is another resouruce-ref to load - but it does not seem to try and do it.
Or at least it is failing very silently.
Doing a check on the code in ha-jdbc (XMLDatabaseClusterConfigurationFactory) to see how the module.xml is found - it it using the standard classloader.getResource approach - so I really do need to find a way to get JBoss Modules to accept the additonal resource-ref, to ensure the same classLoader is used - and visibility is maintained between the JAR and the XML file.
So, a wall at this point.
And without the JBoss Module code acceting the resource-ref - a solid wall.
Any advice ?
Thoughts ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ironically, as both the creator of HA-JDBC and an JBoss AS developer - I haven't actually tried to use the two together since AS6.
Looking at your datasource config above, the url "jdbc:ha-jdbc:my-cluster" will try to locate a file called "ha-jdbc-my-cluster.xml", so try renaming that file accordingly. Alternatively, you can also define the config file location via system property, e.g. -Dha-jdbc.my-cluster.configuration=file://path/to/config.xml
Let me try this locally and see what I can figure out.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have not able to connect to the underlying database (postgres) that I have deployed -as the datasource class is not able to be found:
Caused by: java.lang.IllegalArgumentException: No registered driver will accept url org.postgresql.ds.PGSimpleDataSource
at net.sf.hajdbc.sql.DriverDatabase.getDriver(DriverDatabase.java:110)
at net.sf.hajdbc.sql.DriverDatabase.createConnectionSource(DriverDatabase.java:93)
at net.sf.hajdbc.sql.DriverDatabase.createConnectionSource(DriverDatabase.java:39)
at net.sf.hajdbc.sql.DatabaseClusterImpl.isAlive(DatabaseClusterImpl.java:818)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:696)
I added my postgres driver into JBoss 7 configuration - to make sure the driver was known to the classloader:
And I can see that it is being loaded (just after hajdbc is loaded):
INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class net.sf.hajdbc.sql.Driver (version 2.1)
INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.1)
But I thinking I am missing something - as the the HAJDBC DriverDatabase knows nothing about the Postgres driver.
(My Application causing this error is a simple WAR file with a JSP page containing :
Also, if you reference HA-JDBC as a jdbc url (to be loaded via HA-JDBC's Driver), then your ha-jdbc configuration should reference PostgreSQL via a jdbc url (via its Driver). Only if you defined HA-JDBC via <datasource-class> in your AS7 config, would you reference a PostgreSQL database via PGSimpleDataSource.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Paul - I did have the PostGres driver in the module.xml - so OK there. But did not have the jdbc URl for the Postgres Driver in the ha-jdbc-mycluster.xml.
I then had to do some more fix up:
the module.xml must include:
<module name="org.apache.commons.codec"/>
I then had an odd one - where the ibm.jdk module was being looked for. After reading a few posts in JBoss AS 7 groups I elected to copy the sun.jdk module - and renaming it to ibm.jdk.
I now have : Caused by: java.sql.SQLException: No active databases in cluster net.sf.hajdbc.sql.DatabaseClusterImpl
18:07:58,627 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.module.service."deployment.TestWAR.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.TestWAR.war".main: JBAS018759: Failed to load module: deployment.TestWAR.war:main
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:92) [jboss-as-server-7.1.3.Final.jar:7.1.3.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: org.jboss.modules.ModuleNotFoundException: Module ibm.jdk:main is not found in local module loader @74d22e (roots: D:\jboss-as-7.1.3.Final\modules)
at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222)
at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)
at org.jboss.modules.Module.addPaths(Module.java:851)
at org.jboss.modules.Module.link(Module.java:1206)
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1235)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208)
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:71) [jboss-as-server-7.1.3.Final.jar:7.1.3.Final]
... 5 more
The stack trace only appears after I have aded in the common-codec module to the module.xml for ha-jdbc.
The TestWAR.war is contains single jsp file:
<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="java.util.*,javax.naming.*,javax.sql.DataSource,java.sql.*"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body><%DataSourceds=null;Connectioncon=null;PreparedStatementpr=null;InitialContextic;try{ic=newInitialContext();ds=(DataSource)ic.lookup("java:jboss/datasources/TestHAJDBC");con=ds.getConnection();pr=con.prepareStatement("SELECT datname FROM pg_database WHERE datistemplate = false");ResultSetrs=pr.executeQuery();while(rs.next()){out.println("<br> "+rs.getString("USERID")+" | "+rs.getString("PASSWD"));}rs.close();pr.close();}catch(Exceptione){out.println("Exception thrown "+e);}finally{if(con!=null){con.close();}}%></body></html>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any other <property/>s are used as connection properties for the Driver.connect(String, Properties) method.
Note that the authentication information listed in your HA-JDBC config should be a superuser - with sufficient privileges to perform any sync strategies that you've defined (although I see you're only using the passive strategy for now).
The authentication information declared in AS7's datasource subsystem is used to obtain connections for your application.
Last edit: Paul Ferraro 2013-02-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've looked in the postgreql log file and cannot see a connection being attempted. (using telnet to port 5432 I can see a connecton being made)
But in JBoss I still get:
20:43:16,901 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (http-/127.0.0.1:8080-2) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: java.sql.SQLException: No active databases in cluster net.sf.hajdbc.sql.DatabaseClusterImpl@15525e8
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:52)
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:36)
at net.sf.hajdbc.invocation.InvokeOnOneInvocationStrategy.invoke(InvokeOnOneInvocationStrategy.java:61)
at net.sf.hajdbc.invocation.InvocationStrategyEnum.invoke(InvocationStrategyEnum.java:46)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invokeOnProxy(AbstractInvocationHandler.java:110)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:99)
at net.sf.hajdbc.sql.AbstractChildInvocationHandler.invoke(AbstractChildInvocationHandler.java:61)
at $Proxy33.getTransactionIsolation(Unknown Source) at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.<init>(BaseWrapperManagedConnection.java:189)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnection.<init>(LocalManagedConnection.java:61)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:267)
... 29 more
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Running up JBoss and invoking my JSP the (augmented) trace I get is this:
14:20:46,468 INFO [net.sf.hajdbc.xml.XMLDatabaseClusterConfigurationFactory] (http-/127.0.0.1:8080-2) Initializing HA-JDBC 2.1.0-beta-4-SNAPSHOT from D:\jboss-as-7.1.3.Final\modules\net\sf\hajdbc\main.\ha-jdbc-mycluster.xml
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Trying to locate net/sf/hajdbc/sql/jaxb.properties
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) not found
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Checking system property javax.xml.bind.JAXBContext
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) not found
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Checking META-INF/services
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Reading jar:file:/D:/jboss-as-7.1.3.Final/modules/com/sun/xml/bind/main/jaxb-impl-2.2.5.jboss-1.jar!/META-INF/services/javax.xml.bind.JAXBContext
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Trying to load com.sun.xml.bind.v2.ContextFactory
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) loaded com.sun.xml.bind.v2.ContextFactory from jar:file:/D:/jboss-as-7.1.3.Final/modules/com/sun/xml/bind/main/jaxb-impl-2.2.5.jboss-1.jar!/com/sun/xml/bind/v2/ContextFactory.class
14:20:46,593 FINE [com.sun.xml.bind.v2.ContextFactory] (http-/127.0.0.1:8080-2) Property com.sun.xml.bind.XmlAccessorFactoryis not active. Using JAXB's implementation
14:20:46,999 INFO [stdout] (http-/127.0.0.1:8080-2) ID mycluster configuration net.sf.hajdbc.sql.DriverDatabaseClusterConfiguration@920ce9
14:20:46,999 INFO [stdout] (http-/127.0.0.1:8080-2) start
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive db2
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive:connect org.postgresql.Driver@dec008
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:requiresAuthentication true
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:user postgres
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:password password
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect jdbc:postgresql:postgres
14:20:47,108 DEBUG [net.sf.hajdbc.sql.DatabaseClusterImpl] (http-/127.0.0.1:8080-2) Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:753)
at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:120)
at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
at net.sf.hajdbc.dialect.StandardDialect.isValid(StandardDialect.java:937)
at net.sf.hajdbc.sql.DatabaseClusterImpl.isAlive(DatabaseClusterImpl.java:849)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:719)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:76)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:34)
at net.sf.hajdbc.sql.Driver.connect(Driver.java:141)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive db1
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive:connect org.postgresql.Driver@dec008
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:requiresAuthentication true
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:user postgres
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:password password
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect jdbc:postgresql:postgres
14:20:47,186 DEBUG [net.sf.hajdbc.sql.DatabaseClusterImpl] (http-/127.0.0.1:8080-2) Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:753)
at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:120)
at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
at net.sf.hajdbc.dialect.StandardDialect.isValid(StandardDialect.java:937)
at net.sf.hajdbc.sql.DatabaseClusterImpl.isAlive(DatabaseClusterImpl.java:849)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:719)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:76)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:34)
at net.sf.hajdbc.sql.Driver.connect(Driver.java:141)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
14:20:47,202 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,202 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,217 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,233 INFO [stdout] (http-/127.0.0.1:8080-2) isActive true
14:20:47,233 INFO [stdout] (http-/127.0.0.1:8080-2) InvocationHandlerFactory:getInvocationStrategy public abstract int java.sql.Connection.getTransactionIsolation() throws java.sql.SQLException
14:20:47,248 TRACE [net.sf.hajdbc.sql.ConnectionInvocationHandler] (http-/127.0.0.1:8080-2) Invoking public abstract int java.sql.Connection.getTransactionIsolation() throws java.sql.SQLException using net.sf.hajdbc.invocation.InvocationStrategyEnum
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnOneInvocationStrategy:invoke:cluster mycluster
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnOneInvocationStrategy:invoke:balancer []
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnOneInvocationStrategy:invoke:dialect jdbc:postgresql://(^\:+):(\d+)/(^\?+)(?:\?.*)?
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnPrimaryInvocationStrategy:next null
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) isActive true
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvocationHandlerFactory:getInvocationStrategy public abstract void java.sql.Connection.close() throws java.sql.SQLException
14:20:47,248 TRACE [net.sf.hajdbc.sql.ConnectionInvocationHandler] (http-/127.0.0.1:8080-2) Invoking public abstract void java.sql.Connection.close() throws java.sql.SQLException using net.sf.hajdbc.invocation.InvocationStrategyEnum
14:20:47,248 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (http-/127.0.0.1:8080-2) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: java.sql.SQLException: No active databases in cluster net.sf.hajdbc.sql.DatabaseClusterImpl@2472d2
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:52)
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:36)
at net.sf.hajdbc.invocation.InvokeOnOneInvocationStrategy.invoke(InvokeOnOneInvocationStrategy.java:64)
at net.sf.hajdbc.invocation.InvocationStrategyEnum.invoke(InvocationStrategyEnum.java:46)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invokeOnProxy(AbstractInvocationHandler.java:110)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:99)
at net.sf.hajdbc.sql.AbstractChildInvocationHandler.invoke(AbstractChildInvocationHandler.java:61)
at $Proxy33.getTransactionIsolation(Unknown Source) at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.<init>(BaseWrapperManagedConnection.java:189)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnection.<init>(LocalManagedConnection.java:61)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:267)
... 29 more
So - what I think is happening is that the standard postgres driver is reporting the
Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
This means the cluster is then saying - that that database instance is dead (db2) - move onto the next one (db1).
DB1 connection reports the same error - so cluster things DB1 is now dead.
Now I have no databases in my cluster - and this is reported:
Which version of the PostgreSQL driver are you using? I know this is implemented in the most recent driver version (9.2 Build 1002).
I added an isValid(Connection) method to the Dialect interface a few weeks ago to workaround the same issue with the jTDS driver (for SQL Server).
Using the latest code in master, you can override this using a custom dialect implementation (by overriding PostgresSQLDialectFactory). See the docs for specific instructions: http://ha-jdbc.github.com/doc.html#Customizing_HA-JDBC
To use the custom dialect in AS7, you'll need to add both the Dialect and DialectFactory classes, and the service loader definition to HA-JDBC's module.xml.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to deploy HAJDBC as a JDBC Driver in JBoss 7.1.3 as a module.
I am struggling to get JBoss to recognise the HAJDBC as a module - and I am trying to work out if this is a JBoss issue, or something I am not understanding about using HAJDBC.
Has anyone tried this combination before - and share their experience.
The net/sf/ha-jdbc/main/module.xml should look something like this:
Let me know what specific issue you have.
Last edit: Paul Ferraro 2013-02-09
Paul,
Thanks for the info - I was wondering how to scope the ha-jdbc-mycluster.xml into the driver.
I manager to get JBoss now loading up the hajdbc driver (JBoss modules TRACE showed the classes being found and loaded), but I have now hit a strange one.
I am getting this error message:
JBAS010402: Unable to instantiate driver class "net.sf.hajdbc.sql.Driver": java.lang.NumberFormatException: For input string: "2.1.0-beta-4-SNAPSHOT"
I have traced it to the Versions.class - which uses Version.properties file - to get a version string - pulled from the Maven POM file - currenltly 2.1.0-beta-4-SNAPSHOT
Debugging it seems:
is not parsing the string 2.1.0-beta-4-SNAPSHOT correctly.
But the code looks OK to me (not sure about the Pattern.quote use - but removing it makes the same error).
I haveb't get been able to trace where the Version class is being called from - in case I have configured something wrong
Has this been reported ?
I try to add ha-jdbc as a module to WildFly 8.1, and I've got error
]) - failure description: "JBAS010441: Failed to load module for driver [net.sf.hajdbc]"
module.xml
List of files
A couple of issues:
The good news :
JBAS010404: Deploying non-JDBC-compliant driver class net.sf.hajdbc.sql.Driver (version 2.1)
The bad news :
To get this I had to change Version.java's getVersionPart to read :
private static int getVersionPart(int index)
{
return Integer.parseInt(getVersion().split(Pattern.quote(Strings.DASH))[0].split(Pattern.quote(Strings.DOT))[index]);
}
I dont know if this change is JBoss specific or has a wider imapct
I just pushed a fix including a unit test for version parsing. Until now, I guess nobody has tried to call Driver.getMajorVersion()...
https://github.com/ha-jdbc/ha-jdbc/commit/978628ac79b5aa27f2ce523c30b0911bfadafa09
Great. Thanks Paul.
I'll push on with the adding in of
Once quick question - normally we would declare the datasource conneciton URL in JBoss's standalone.xml file - including, critically the JNDI binding.
Also the connectionURL, but all this richness in the ha-jdbc-mycluster.xml.
I have discovered that JBoss requires a connectionURL to be specified. Its mandatory.
Given we are trying to tie the JNDI reference to the HA-JDBC proxy would you expect a connection URL of:
to be good enough ? I dare say I will find out in a few hours, just trying to shave some time off! :)
The connection-url should be: "jdbc:ha-jdbc:my-cluster".
Otherwise, it looks good.
Let me know how it goes...
Seem to be hitting a dead end. Let me try and explain.
I have added resource-root path="ha-jdbc-mycluster.xml" to the JBoss module.xml.
The first impact is now that I do not end up wiuth a JNDI bind datasource. JBoss reports that for that datasource there is an un-met depenency:
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.hajdbc (missing) dependents: [service jboss.data-source.java:jboss/datasources/TestHAJDBC]
Just to check I commented out the added resource-root - and all starts up well.
So I added the resource-root back in - and again, the failure.
So, I enabled Trace level debug on org.jboss.modules - and searched the log file for any reference to ha-jdbc-mycluster.xml
And strangely enough there is not mention of ha-jdbc-mycluser at all !!! Pulled the JBoss module source code - and would have expected to see : 'Failed to add resource root' message for a errant resource path error.
Again, searched the log file - nothing.
Reading into JBoss-Modules it does seem to suggest that we can add both JAR files and resources to a module. And loading the ha-jdbc module seems to not succeed because it knows there is another resouruce-ref to load - but it does not seem to try and do it.
Or at least it is failing very silently.
Doing a check on the code in ha-jdbc (XMLDatabaseClusterConfigurationFactory) to see how the module.xml is found - it it using the standard classloader.getResource approach - so I really do need to find a way to get JBoss Modules to accept the additonal resource-ref, to ensure the same classLoader is used - and visibility is maintained between the JAR and the XML file.
So, a wall at this point.
And without the JBoss Module code acceting the resource-ref - a solid wall.
Any advice ?
Thoughts ?
Ironically, as both the creator of HA-JDBC and an JBoss AS developer - I haven't actually tried to use the two together since AS6.
Looking at your datasource config above, the url "jdbc:ha-jdbc:my-cluster" will try to locate a file called "ha-jdbc-my-cluster.xml", so try renaming that file accordingly. Alternatively, you can also define the config file location via system property, e.g. -Dha-jdbc.my-cluster.configuration=file://path/to/config.xml
Let me try this locally and see what I can figure out.
OK - the <resource-root path="..."/> defines a path, so you don't specify a specific file, but rather a directory. So, try this:
Yup - That did it.
[net.sf.hajdbc.logging.LoggerFactory] Using JBoss logging
[org.jboss.as.connector.subsystems.datasources] JBAS010404: Deploying non-JDBC-compliant driver class net.sf.hajdbc.sql.Driver (version 2.1)
[org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$AS7DataSourceDeployer] (MSC service thread 1-1) Adding management datasource: DataSource@11c0451 xa=false jndiName=java:jboss/datasources/TestHAJDBC pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5f7a00 poolconfiguration=PoolConfiguration@42c353[minSize=0 maxSize=20 blockingTimeout=30000 idleTimeoutMinutes=30 backgroundValidation=false backgroundValidationMillis=0 prefill=false strictMin=false useFastFail=false] statistics=org.jboss.jca.adapters.jdbc.statistics.JdbcStatisticsPlugin@125b191]
[org.jboss.as.connector.deployer.dsdeployer] Adding datasource: java:jboss/datasources/TestHAJDBC
Time to knock up a small Java app to use the JNDi reference - which should kick off the HA-JDBC ..... !!!!!
Thanks
Paul
I have not able to connect to the underlying database (postgres) that I have deployed -as the datasource class is not able to be found:
I added my postgres driver into JBoss 7 configuration - to make sure the driver was known to the classloader:
And I can see that it is being loaded (just after hajdbc is loaded):
INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class net.sf.hajdbc.sql.Driver (version 2.1)
INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.1)
But I thinking I am missing something - as the the HAJDBC DriverDatabase knows nothing about the Postgres driver.
(My Application causing this error is a simple WAR file with a JSP page containing :
I've reread through the documentation and cant see anything particuarly that I have done wrong.
Any thoughts or hints ?
Thanks
Missed this off previous post
Last edit: Linz 2013-02-11
Did you define a dependency on the "org.postgresql" module in your module.xml for ha-jdbc?
Also, if you reference HA-JDBC as a jdbc url (to be loaded via HA-JDBC's Driver), then your ha-jdbc configuration should reference PostgreSQL via a jdbc url (via its Driver). Only if you defined HA-JDBC via <datasource-class> in your AS7 config, would you reference a PostgreSQL database via PGSimpleDataSource.
Thanks Paul - I did have the PostGres driver in the module.xml - so OK there. But did not have the jdbc URl for the Postgres Driver in the ha-jdbc-mycluster.xml.
I then had to do some more fix up:
the module.xml must include:
I then had an odd one - where the ibm.jdk module was being looked for. After reading a few posts in JBoss AS 7 groups I elected to copy the sun.jdk module - and renaming it to ibm.jdk.
I now have : Caused by: java.sql.SQLException: No active databases in cluster net.sf.hajdbc.sql.DatabaseClusterImpl
So I quess my confiuguration is still not right:
tantilising close to having a connection !!
Can you post the stack trace mentioning the missing "ibm.jdk" module? That is curious. There shouldn't be any specific dependency on the jdk itself.
Here is the stack trace :
18:07:58,627 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.module.service."deployment.TestWAR.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.TestWAR.war".main: JBAS018759: Failed to load module: deployment.TestWAR.war:main
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:92) [jboss-as-server-7.1.3.Final.jar:7.1.3.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: org.jboss.modules.ModuleNotFoundException: Module ibm.jdk:main is not found in local module loader @74d22e (roots: D:\jboss-as-7.1.3.Final\modules)
at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222)
at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)
at org.jboss.modules.Module.addPaths(Module.java:851)
at org.jboss.modules.Module.link(Module.java:1206)
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1235)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208)
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:71) [jboss-as-server-7.1.3.Final.jar:7.1.3.Final]
... 5 more
The stack trace only appears after I have aded in the common-codec module to the module.xml for ha-jdbc.
The TestWAR.war is contains single jsp file:
I don't think "jdbc:postgresql" is a valid jdbc url.
Rather, your HA-JDBC database configuration should look like:
Any other <property/>s are used as connection properties for the Driver.connect(String, Properties) method.
Note that the authentication information listed in your HA-JDBC config should be a superuser - with sufficient privileges to perform any sync strategies that you've defined (although I see you're only using the passive strategy for now).
The authentication information declared in AS7's datasource subsystem is used to obtain connections for your application.
Last edit: Paul Ferraro 2013-02-11
Paul
I simplified the ha-jdbc-mycluster.xml to the basics:
The User credentials (postgres/password) are for the SuperUser account on the Postgres instance:
I've looked in the postgreql log file and cannot see a connection being attempted. (using telnet to port 5432 I can see a connecton being made)
But in JBoss I still get:
20:43:16,901 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (http-/127.0.0.1:8080-2) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: java.sql.SQLException: No active databases in cluster net.sf.hajdbc.sql.DatabaseClusterImpl@15525e8
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:52)
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:36)
at net.sf.hajdbc.invocation.InvokeOnOneInvocationStrategy.invoke(InvokeOnOneInvocationStrategy.java:61)
at net.sf.hajdbc.invocation.InvocationStrategyEnum.invoke(InvocationStrategyEnum.java:46)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invokeOnProxy(AbstractInvocationHandler.java:110)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:99)
at net.sf.hajdbc.sql.AbstractChildInvocationHandler.invoke(AbstractChildInvocationHandler.java:61)
at $Proxy33.getTransactionIsolation(Unknown Source) at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.<init>(BaseWrapperManagedConnection.java:189)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnection.<init>(LocalManagedConnection.java:61)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:267)
... 29 more
Small update - using logging and debugger - I think I know what may be happening:
Firstly I expanded my cluster definition to have two node (just to make sure I was not encountering an issue by declaring a one node cluster):
Running up JBoss and invoking my JSP the (augmented) trace I get is this:
14:20:46,468 INFO [net.sf.hajdbc.xml.XMLDatabaseClusterConfigurationFactory] (http-/127.0.0.1:8080-2) Initializing HA-JDBC 2.1.0-beta-4-SNAPSHOT from D:\jboss-as-7.1.3.Final\modules\net\sf\hajdbc\main.\ha-jdbc-mycluster.xml
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Trying to locate net/sf/hajdbc/sql/jaxb.properties
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) not found
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Checking system property javax.xml.bind.JAXBContext
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) not found
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Checking META-INF/services
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Reading jar:file:/D:/jboss-as-7.1.3.Final/modules/com/sun/xml/bind/main/jaxb-impl-2.2.5.jboss-1.jar!/META-INF/services/javax.xml.bind.JAXBContext
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) Trying to load com.sun.xml.bind.v2.ContextFactory
14:20:46,578 FINE [javax.xml.bind] (http-/127.0.0.1:8080-2) loaded com.sun.xml.bind.v2.ContextFactory from jar:file:/D:/jboss-as-7.1.3.Final/modules/com/sun/xml/bind/main/jaxb-impl-2.2.5.jboss-1.jar!/com/sun/xml/bind/v2/ContextFactory.class
14:20:46,593 FINE [com.sun.xml.bind.v2.ContextFactory] (http-/127.0.0.1:8080-2) Property com.sun.xml.bind.XmlAccessorFactoryis not active. Using JAXB's implementation
14:20:46,999 INFO [stdout] (http-/127.0.0.1:8080-2) ID mycluster configuration net.sf.hajdbc.sql.DriverDatabaseClusterConfiguration@920ce9
14:20:46,999 INFO [stdout] (http-/127.0.0.1:8080-2) start
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive db2
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive:connect org.postgresql.Driver@dec008
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:requiresAuthentication true
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:user postgres
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:password password
14:20:47,014 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect jdbc:postgresql:postgres
14:20:47,108 DEBUG [net.sf.hajdbc.sql.DatabaseClusterImpl] (http-/127.0.0.1:8080-2) Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:753)
at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:120)
at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
at net.sf.hajdbc.dialect.StandardDialect.isValid(StandardDialect.java:937)
at net.sf.hajdbc.sql.DatabaseClusterImpl.isAlive(DatabaseClusterImpl.java:849)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:719)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:76)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:34)
at net.sf.hajdbc.sql.Driver.connect(Driver.java:141)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive db1
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DatabaseClusterImpl:isAlive:connect org.postgresql.Driver@dec008
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:getDriver jdbc:postgresql:postgres
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:requiresAuthentication true
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:user postgres
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect:password password
14:20:47,124 INFO [stdout] (http-/127.0.0.1:8080-2) DriverDatabase:connect jdbc:postgresql:postgres
14:20:47,186 DEBUG [net.sf.hajdbc.sql.DatabaseClusterImpl] (http-/127.0.0.1:8080-2) Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
at org.postgresql.Driver.notImplemented(Driver.java:753)
at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:120)
at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
at net.sf.hajdbc.dialect.StandardDialect.isValid(StandardDialect.java:937)
at net.sf.hajdbc.sql.DatabaseClusterImpl.isAlive(DatabaseClusterImpl.java:849)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:719)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:76)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:34)
at net.sf.hajdbc.sql.Driver.connect(Driver.java:141)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
14:20:47,202 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,202 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,217 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,233 INFO [stdout] (http-/127.0.0.1:8080-2) isActive true
14:20:47,233 INFO [stdout] (http-/127.0.0.1:8080-2) InvocationHandlerFactory:getInvocationStrategy public abstract int java.sql.Connection.getTransactionIsolation() throws java.sql.SQLException
14:20:47,248 TRACE [net.sf.hajdbc.sql.ConnectionInvocationHandler] (http-/127.0.0.1:8080-2) Invoking public abstract int java.sql.Connection.getTransactionIsolation() throws java.sql.SQLException using net.sf.hajdbc.invocation.InvocationStrategyEnum
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) getId mycluster
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnOneInvocationStrategy:invoke:cluster mycluster
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnOneInvocationStrategy:invoke:balancer []
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnOneInvocationStrategy:invoke:dialect jdbc:postgresql://(^\:+):(\d+)/(^\?+)(?:\?.*)?
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvokeOnPrimaryInvocationStrategy:next null
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) isActive true
14:20:47,248 INFO [stdout] (http-/127.0.0.1:8080-2) InvocationHandlerFactory:getInvocationStrategy public abstract void java.sql.Connection.close() throws java.sql.SQLException
14:20:47,248 TRACE [net.sf.hajdbc.sql.ConnectionInvocationHandler] (http-/127.0.0.1:8080-2) Invoking public abstract void java.sql.Connection.close() throws java.sql.SQLException using net.sf.hajdbc.invocation.InvocationStrategyEnum
14:20:47,248 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (http-/127.0.0.1:8080-2) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:770)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at org.apache.jsp.NewFile_jsp._jspService(NewFile_jsp.java:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.17.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.17.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
Caused by: java.sql.SQLException: No active databases in cluster net.sf.hajdbc.sql.DatabaseClusterImpl@2472d2
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:52)
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:36)
at net.sf.hajdbc.invocation.InvokeOnOneInvocationStrategy.invoke(InvokeOnOneInvocationStrategy.java:64)
at net.sf.hajdbc.invocation.InvocationStrategyEnum.invoke(InvocationStrategyEnum.java:46)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invokeOnProxy(AbstractInvocationHandler.java:110)
at net.sf.hajdbc.sql.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:99)
at net.sf.hajdbc.sql.AbstractChildInvocationHandler.invoke(AbstractChildInvocationHandler.java:61)
at $Proxy33.getTransactionIsolation(Unknown Source) at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.<init>(BaseWrapperManagedConnection.java:189)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnection.<init>(LocalManagedConnection.java:61)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:267)
... 29 more
So - what I think is happening is that the standard postgres driver is reporting the
This means the cluster is then saying - that that database instance is dead (db2) - move onto the next one (db1).
DB1 connection reports the same error - so cluster things DB1 is now dead.
Now I have no databases in my cluster - and this is reported:
Which version of the PostgreSQL driver are you using? I know this is implemented in the most recent driver version (9.2 Build 1002).
I added an isValid(Connection) method to the Dialect interface a few weeks ago to workaround the same issue with the jTDS driver (for SQL Server).
Using the latest code in master, you can override this using a custom dialect implementation (by overriding PostgresSQLDialectFactory). See the docs for specific instructions:
http://ha-jdbc.github.com/doc.html#Customizing_HA-JDBC
To use the custom dialect in AS7, you'll need to add both the Dialect and DialectFactory classes, and the service loader definition to HA-JDBC's module.xml.
Just checked - and I am using 9.2 Build 1000.
Pulling Build 1002 now...
Thanks.