<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    h2console.war and postgreSQL
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/harikris">vijay harikrishna</a> in <i>Beginner's Corner</i> - <a href="https://community.jboss.org/message/777032#777032">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi All,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Installed AS 7.1.1.Final on my MacBook Pro.</p><p>Downloaded the Quickstart examples. Was able to successfully deploy and test helloworld, jboss-as-greeter wars.</p><p>Then i set up the postgresql database engine to try jboss-as-cmt example. I was able to compile and deploy it.</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am using:</p><p>"org.postgresql.Driver" for the Driver Class field.</p><p>"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.</p><p>"sa" for username and password.</p><p>When i press the "Test Connection" button on the h2console app, unfortunately i see -</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a class="jive-link-external-small" href="http://localhost:8080/h2console/console/test.do?jsessionid=12813e0be3e4ba68413708fd1d6d521d#">Class "org.postgresql.Driver" not found [90086-161]</a><span id="st0" style="color: #ff0000; font-family: Arial, sans-serif; font-size: 12px;"><br/>org.h2.message.DbException: Class "org.postgresql.Driver" not found [90086-161]<br/>&#160;&#160;&#160; at org.h2.message.DbException.get(DbException.java:158)<br/>&#160;&#160;&#160; at org.h2.util.Utils.loadUserClass(Utils.java:429)<br/>&#160;&#160;&#160; at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:146)<br/>&#160;&#160;&#160; at org.h2.server.web.WebServer.getConnection(WebServer.java:653)<br/>&#160;&#160;&#160; at org.h2.server.web.WebApp.test(WebApp.java:839)<br/>&#160;&#160;&#160; at org.h2.server.web.WebApp.process(WebApp.java:215)<br/>&#160;&#160;&#160; at org.h2.server.web.WebApp.processRequest(WebApp.java:164)<br/>&#160;&#160;&#160; at org.h2.server.web.WebServlet.doGet(WebServlet.java:118)<br/>&#160;&#160;&#160; at org.h2.server.web.WebServlet.doPost(WebServlet.java:153)<br/>&#160;&#160;&#160; at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)<br/>&#160;&#160;&#160; at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)<br/>&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)<br/>&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)<br/>&#160;&#160;&#160; at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)<br/>&#160;&#160;&#160; at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br/>&#160;&#160;&#160; at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br/>&#160;&#160;&#160; at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)<br/>&#160;&#160;&#160; at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)<br/>&#160;&#160;&#160; at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)<br/>&#160;&#160;&#160; at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)<br/>&#160;&#160;&#160; at java.lang.Thread.run(Thread.java:680)<br/>Caused by: org.h2.jdbc.JdbcSQLException: Class "org.postgresql.Driver" not found [90086-161]<br/>&#160;&#160;&#160; at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)<br/>&#160;&#160;&#160; ... 24 more<br/>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)]<br/>&#160;&#160;&#160; at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)<br/>&#160;&#160;&#160; at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)<br/>&#160;&#160;&#160; at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)<br/>&#160;&#160;&#160; at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)<br/>&#160;&#160;&#160; at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)<br/>&#160;&#160;&#160; at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)<br/>&#160;&#160;&#160; at java.lang.Class.forName0(Native Method)<br/>&#160;&#160;&#160; at java.lang.Class.forName(Class.java:169)<br/>&#160;&#160;&#160; at org.h2.util.Utils.loadUserClass(Utils.java:424)<br/>&#160;&#160;&#160; ... 22 more</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>I am able to establish a successful connection from the jboss admin management console (</span><a class="jive-link-external-small" href="http://localhost:9990/console" target="_blank">http://localhost:9990/console</a><span>) 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"</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am a newbie to JBoss and server side stuff in general.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have attached some pics for reference.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks for your time.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/777032#777032">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>