This content has been marked as final.
Show 2 replies
-
1. Re: Dependancy injection with datasources within a webservice
jensmander Apr 30, 2010 2:29 AM (in response to jensmander)No ideas? Still struggling at this point
The postgres-ds.xml looks like that:
<datasources> <local-tx-datasource> <jndi-name>PostgreDS</jndi-name> <connection-url>jdbc:postgresql://x.x.x.x/mydb</connection-url> <driver-class>org.postgresql.Driver</driver-class> <user-name>myuser</user-name> <password>mypass</password> <!-- sql to call when connection is created. Can be anything, select 1 is valid for PostgreSQL <new-connection-sql>select 1</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool. Can be anything, select 1 is valid for PostgreSQL <check-valid-connection-sql>select 1</check-valid-connection-sql> --> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>PostgreSQL 8.4</type-mapping> </metadata> </local-tx-datasource> </datasources>
Do I have to set up any other configuration files?
The output during the deployment looks like that:
08:26:59,359 WARN [JBossWSResourceResolver] Cannot resolve resource: java:/PostgreDS
08:26:59,359 INFO [ResourceInjector] failed to resolve resource java:/PostgreDSAnd the Jboss JNDIView shows:
java: Namespace
+- PostgreDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)....
-
2. Re: Dependancy injection with datasources within a webservice
xmedeko Mar 24, 2011 6:12 AM (in response to jensmander)Hi,
@Resource(mappedName="java:/AdpartnerDS", name="java:/comp/env/AdpartnerDS")
is working for me on JBoss 5.1.0GA. Note: mappedName is the global JNDI name. The name is the local and you can write anything you like, just it must start by "java:/comp/env/". (I think this is a bug.)