[Beginner's Corner] - h2console.war and postgreSQL
by vijay harikrishna
vijay harikrishna [https://community.jboss.org/people/harikris] created the discussion
"h2console.war and postgreSQL"
To view the discussion, visit: https://community.jboss.org/message/777032#777032
--------------------------------------------------------------
Hi All,
Installed AS 7.1.1.Final on my MacBook Pro.
Downloaded the Quickstart examples. Was able to successfully deploy and test helloworld, jboss-as-greeter wars.
Then i set up the postgresql database engine to try jboss-as-cmt example. I was able to compile and deploy it.
Everything works great except for one thing - i am unable to connect to the postgresql database from the h2console web-app that is shipped with the application server.
The jboss-as-cmt war works perfectly i.e i am able to add customers to the invoice. I can psql into the db engine and i can see all the records. My only problem is that i can't use h2console webapp to get into my jboss-as-cmt postgres database i created.
I am using:
"org.postgresql.Driver" for the Driver Class field.
"jdbc:postgresql://127.0.0.1:5432/jboss-as-cmt" for the JDBC URL. This is the same as my connection-url value set in the standalone-full.xml config file.
"sa" for username and password.
When i press the "Test Connection" button on the h2console app, unfortunately i see -
http://localhost:8080/h2console/console/test.do?jsessionid=12813e0be3e4ba... Class "org.postgresql.Driver" not found [90086-161]
org.h2.message.DbException: Class "org.postgresql.Driver" not found [90086-161]
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.util.Utils.loadUserClass(Utils.java:429)
at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:146)
at org.h2.server.web.WebServer.getConnection(WebServer.java:653)
at org.h2.server.web.WebApp.test(WebApp.java:839)
at org.h2.server.web.WebApp.process(WebApp.java:215)
at org.h2.server.web.WebApp.processRequest(WebApp.java:164)
at org.h2.server.web.WebServlet.doGet(WebServlet.java:118)
at org.h2.server.web.WebServlet.doPost(WebServlet.java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.h2.jdbc.JdbcSQLException: Class "org.postgresql.Driver" not found [90086-161]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
... 24 more
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver from [Module "com.h2database.h2:main" from local module loader @b4e29b (roots: /Users/avyayatek/Downloads/jboss-as-7.1.1.Final/modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.h2.util.Utils.loadUserClass(Utils.java:424)
... 22 more
I am able to establish a successful connection from the jboss admin management console ( http://localhost:9990/console http://localhost:9990/console) to the datasource. On the datasources profile panel, i have the name of the datasource set to "postgresDS", jndi set to "java:jboss/postgresDS". Connection URL is same as what i am use on the h2console - "jdbc:postgresql://127.0.0.1:5432/jboss-as-cmt"
I don't know why h2console is not connecting to the postgresql db engine. It makes a successful connection to the h2 in-memory database that is used in the jboss-as-greeter example.
I have placed the JDBC driver in the $JBOSS_HOME/modules/org/postgresql/main folder. Created the module.xml there. There is a Driver.class file inside the jar in ~/org/postgresql/ folder. I have modified the $JBOSS_HOME/standalone/configuration/standalone-full.xml to add the postgresql related datasource and driver sections.
As i said, i can build jboss-as-cmt and deploy and it works as expected. If i could make the h2console connect to this postgresql database, it will give me some peace.
I am a newbie to JBoss and server side stuff in general.
I have attached some pics for reference.
Thanks for your time.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/777032#777032]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years
[Datasource Configuration] - XADatasource and Oracle RAC - Load Balancing
by Marco Sarti
Marco Sarti [https://community.jboss.org/people/msarti66] created the discussion
"XADatasource and Oracle RAC - Load Balancing"
To view the discussion, visit: https://community.jboss.org/message/777458#777458
--------------------------------------------------------------
JBoss 4.2.3 GA - Oracle 11g RAC
We have configured a XADatasource pointing to an Oracle RAC. When we get the connection from this datasource we do not obtain any load balancing, in other words every time we ask for a connection we obtain a connection to the same RAC node.
How can we configure the DS in order to have a load balancing on the RAC nodes?
Following the datasource configuration:
<jndi-name>jdbc/xxxxxxxx</jndi-name>
<track-connection-by-tx/>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(protocol=tcp)(host=rac-scan)(port=xxx))(LOAD_BALANCE=YES)(CONNECT_DATA=(SERVE
R=DEDICATED)(SERVICE_NAME=dbname.domain)))</xa-datasource-property>
<xa-datasource-property name="User">XXXXXX</xa-datasource-property>
<xa-datasource-property name="Password">YYYYYY</xa-datasource-property>
<min-pool-size>0</min-pool-size>
<max-pool-size>60</max-pool-size>
<idle-timeout-minutes>2</idle-timeout-minutes>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<!--sql to call when connection is created-->
<new-connection-sql>select 1 from dual</new-connection-sql>
<!--sql to call on an existing pooled connection when it is obtained from pool-->
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->
<no-tx-separate-pools/>
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/777458#777458]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years