I have to go into production with my web application. The application server is JBoss 7.1.1.
So I was looking for moving the datasources from the spring application context to the container.
I configured the datasource in jboss:
Well, when jboss starts it confirms that my datasource it's bound to java:jboss/datasources/sampleDS.Code:<datasource jta="false" jndi-name="java:jboss/datasources/sampleDS" pool-name="sampleDSPool" enabled="true" use-java-context="true" use-ccm="false"> <connection-url>jdbc:postgresql://localhost:5432/sampleDB</connection-url> <driver-class>org.postgresql.Driver</driver-class> <driver>postgresql</driver> <pool> <min-pool-size>2</min-pool-size> <max-pool-size>20</max-pool-size> </pool> <security> <user-name>*****</user-name> <password>*****</password> </security> <validation> <validate-on-match>false</validate-on-match> <background-validation>false</background-validation> <background-validation-millis>1</background-validation-millis> </validation> <statement> <prepared-statement-cache-size>0</prepared-statement-cache-size> <share-prepared-statements>false</share-prepared-statements> </statement> </datasource>
Now I wanted to move the configuration:
toCode:<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${db.driver.prod}" /> <property name="url" value="${db.url.prod}" /> <property name="username" value="${db.username.prod}" /> <property name="password" value="${db.password.prod}" /> </bean>
orCode:<jee:jndi-lookup id="dataSource" jndi-name="java:jboss/datasources/sampleDS"/>
There is no way of getting the datasource from jboss, I always end with name not found ( I tried almost every combination ).Code:<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>java:jboss/datasources/sampleDS</value> </property> </bean>
Is there someone that is able to use the datasource fomr joss through jndi?Code:Caused by: javax.naming.NameNotFoundException: jboss/datasources/sampleDS -- service jboss.naming.context.java.jboss.exported.jboss.datasources.sampleDS
Thank you for your help.
Daniele


Reply With Quote
