Difficulty accessing Postgres.
oberiko Jun 1, 2005 8:10 AMHowdy.
I'm currently working on a Struts project using EJBs and I'm trying to connect my Entity Beans to my Postgres database.
Currently however, this the code I get when I deploy:
[CODE]
16:45:10,939 INFO [MainDeployer] Starting deployment of package: file:/D:/x/sys/jboss-3/server/default/deploy/cpb.ear
16:45:10,949 INFO [EARDeployer] Init J2EE application: file:/D:/x/sys/jboss-3/server/default/deploy/cpb.ear
16:45:11,710 INFO [EjbModule] Creating
16:45:11,720 INFO [EjbModule] Deploying BaseItem
16:45:11,730 INFO [EjbModule] Deploying TestSession
16:45:11,750 INFO [EjbModule] Deploying ASecond
16:45:11,760 INFO [EntityContainer] Creating
16:45:11,770 INFO [EntityInstancePool] Creating
16:45:11,770 INFO [EntityInstancePool] Created
16:45:11,770 INFO [EntityContainer] Created
16:45:11,780 INFO [StatelessSessionContainer] Creating
16:45:11,790 INFO [StatelessSessionInstancePool] Creating
16:45:11,790 INFO [StatelessSessionInstancePool] Created
16:45:11,800 INFO [StatelessSessionContainer] Created
16:45:11,800 INFO [StatelessSessionContainer] Creating
16:45:11,810 INFO [StatelessSessionInstancePool] Creating
16:45:11,810 INFO [StatelessSessionInstancePool] Created
16:45:11,810 INFO [StatelessSessionContainer] Created
16:45:11,810 INFO [EjbModule] Created
16:45:11,820 INFO [EjbModule] Starting
16:45:11,820 INFO [EntityContainer] Starting
16:45:33,071 ERROR [EntityContainer] Starting failed
org.jboss.deployment.DeploymentException: Connection timed out: connect; - nested throwable: (java.net.ConnectException: Connection timed out: connect)
.
.
.
[/CODE]
I'm pretty sure it's because I haven't configured my connection properly, but I'm not sure where I've gone wrong.
The following are my configuration files. A = Address, P = Port, D = Database. I know that the A, P, and D are correct as I can connect to the database through pgAdmin.
property-ds.xml
[CODE]
<?xml version="1.0" encoding="UTF-8"?>
<local-tx-datasource>
<jndi-name>PostgresDS</jndi-name>
<connection-url>jdbc:postgresql://A:P/D</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>myName</user-name>
myPass
<min-pool-size>5</min-pool-size>
</local-tx-datasource>
[/CODE]
jbosscmp-jdbc.xml
[CODE]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">
<jbosscmp-jdbc>
java:/PostgresDS
<datasource-mapping>PostgreSQL</datasource-mapping>
<create-table>true</create-table>
<remove-table>false</remove-table>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
that contains the markup for those beans.
-->
<ejb-name>BaseItem</ejb-name>
<table-name>bse_item</table-name>
<cmp-field>
<field-name>item_num</field-name>
</cmp-field>
<!-- jboss 3.2 features -->
<!-- optimistic locking does not express the exclusions needed -->
</enterprise-beans>
</jbosscmp-jdbc>
[/CODE]
Does anyone have any ideas of what the problem might be?