Postgres Datasouce not bound
jlmartinez Jul 15, 2002 6:39 PMWhen I try to establish connection to my Postgres DB, appear the next exception:
"NameNotFoundException: PostgresDS not bound".
This is the source:
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:/PostgresDS");
con = ds.getConnection();
} catch (Exception ex) { . . .
The file postgres-service.xml is deployed without errors.
***********************************
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================================== -->
<!-- New ConnectionManager setup for default PostgreSQL dbs -->
<!-- Build jmx-api (build/build.sh all) and view for config documentation -->
<!-- To avoid class not found headaches, copy your postgres driver to the jboss lib directory -->
<!-- ======================================================================================== -->
<depends optional-attribute-name="ManagedConnectionFactoryName">
<!--embedded mbean-->
<!-- ========== Set the JndiName ======================= -->
PostgresDS
<config-property name="ConnectionURL" type="java.lang.String">jdbc:postgresql://192.168.1.184/dbprueba</config-property>
<config-property name="DriverClass" type="java.lang.String">org.postgresql.Driver</config-property>
<!--set these only if you want only default logins, not through JAAS -->
<config-property name="UserName" type="java.lang.String">postgres</config-property>
<config-property name="Password" type="java.lang.String">postgres</config-property>
<!--Below here are advanced properties -->
<!--hack-->
<depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper
jboss:service=Postgres
<!--real attributes-->
<depends optional-attribute-name="ManagedConnectionPool">
<!--embedded mbean-->
0
50
5000
15
<!--criteria indicates if Subject (from security domain) or app supplied
parameters (such as from getConnection(user, pw)) are used to distinguish
connections in the pool. Choices are
ByContainerAndApplication (use both),
ByContainer (use Subject),
ByApplication (use app supplied params only),
ByNothing (all connections are equivalent, usually if adapter supports
reauthentication)-->
ByContainer
<depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
<depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager
java:/TransactionManager
<!--make the rar deploy! hack till better deployment-->
jboss.jca:service=RARDeployer
***************************************************
Thank you for help.
Jose Luis Martinez