I said something
LIKE that..of course by changing the name of Datasource and IP, login and paswword..
I had to configure jboss-service.xml beacause it makes the following trace :
[13/mars/2007 09:20:17:187] DEBUG: com.solutions.auto.persistence.connection.DBManager.<init> : Begin DBManager()
[13/mars/2007 09:20:17:906] DEBUG: org.jboss.security.SecurityAssociation.<clinit> : Using ThreadLocal: false
[13/mars/2007 09:20:18:234] DEBUG: com.solutions.auto.persistence.connection.DBManager.<init> : End DBManager()
[13/mars/2007 09:20:18:234] DEBUG: com.solutions.auto.persistence.connection.DBManager.getConnection : Begin getConnection()
[13/mars/2007 09:20:18:265] DEBUG: org.jboss.util.NestedThrowable.getBoolean : org.jboss.util.NestedThrowable.parentTraceEnabled=true
[13/mars/2007 09:20:18:265] DEBUG: org.jboss.util.NestedThrowable.getBoolean : org.jboss.util.NestedThrowable.nestedTraceEnabled=false
[13/mars/2007 09:20:18:265] DEBUG: org.jboss.util.NestedThrowable.getBoolean : org.jboss.util.NestedThrowable.detectDuplicateNesting=true
org.jboss.util.NestedSQLException: Problem locating real ConnectionManager: jboss.jca:service=LocalTxCM,name=MyDS; - nested throwable: (java.lang.IllegalStateException: No 'jboss' MBeanServer found!); - nested throwable: (Problem locating real ConnectionManager: jboss.jca:service=LocalTxCM,name=MyDS; - nested throwable: (java.lang.IllegalStateException: No 'jboss' MBeanServer found!))
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
at com.solution.auto.persistence.connection.DBManager.getConnection(DBManager.java:129)
at com.solutions.auto.persistence.dao.DaoFactory.createConnection(DaoFactory.java:57)
at com.solutions.auto.persistence.indicator.IndicatorDaoImpl.selectIndicators(IndicatorDaoImpl.java:66)
at com.solutions.auto.persistence.indicator.TestIndicatorDaoImpl.testSelectIndicators(TestIndicatorDaoImpl.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: Problem locating real ConnectionManager: jboss.jca:service=LocalTxCM,name=MyDS; - nested throwable: (java.lang.IllegalStateException: No 'jboss' MBeanServer found!)
at org.jboss.resource.JBossResourceException.rethrowAsResourceException(JBossResourceException.java:61)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.getCM(BaseConnectionManager2.java:881)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
... 19 more
Caused by: java.lang.IllegalStateException: No 'jboss' MBeanServer found!
at org.jboss.mx.util.MBeanServerLocator.locateJBoss(MBeanServerLocator.java:122)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.getCM(BaseConnectionManager2.java:875)
... 21 more
[13/mars/2007 09:20:18:281] ERROR: com.solutions.auto.persistence.connection.DBManager.getConnection : Fail to create connecxion Problem locating real ConnectionManager: jboss.jca:service=LocalTxCM,name=MyDS; - nested throwable: (java.lang.IllegalStateException: No 'jboss' MBeanServer found!); - nested throwable: (Problem locating real ConnectionManager: jboss.jca:service=LocalTxCM,name=MyDS; - nested throwable: (java.lang.IllegalStateException: No 'jboss' MBeanServer found!))
java.lang.NullPointerException
at com.solutions.auto.persistence.connection.DBManager.getConnection(DBManager.java:154)
at com.solutions.auto.persistence.dao.DaoFactory.createConnection(DaoFactory.java:57)
at com.solutions.autol.persistence.indicator.IndicatorDaoImpl.selectIndicators(IndicatorDaoImpl.java:66)
at com.solutions.auto.persistence.indicator.TestIndicatorDaoImpl.testSelectIndicators(TestIndicatorDaoImpl.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
[13/mars/2007 09:20:18:281] ERROR: com.solutions.auto.persistence.indicator.IndicatorDaoImpl.selectIndicators : Application exception : null Indicator Management General Exception
com.solutions.auto.persistence.exceptions.AppliPersistenceException: Application exeption
at com.solutions.autol.persistence.indicator.IndicatorDaoImpl.selectIndicators(IndicatorDaoImpl.java:116)
at com.solutions.auto.persistence.indicator.TestIndicatorDaoImpl.testSelectIndicators(TestIndicatorDaoImpl.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
[13/mars/2007 09:20:18:281] ERROR: com.solutions.auto.persistence.indicator.TestIndicatorDaoImpl.testSelectIndicators : Application Error : message : null Indicator Management General Exception
My xxx-ds.xml is configured as follows :
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->
<datasources>
<local-tx-datasource>
<jndi-name>MyDS</jndi-name>
<!-- Using global namespace. In this case, JNDI name of Oracle DS is OracleDS -->
<use-java-context>false</use-java-context>
<connection-url>jdbc
racle:thin:@180.162.10.10:1521
rcl</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>mylogin</user-name>
<password>mypassword</password>
<connection-property name="char.encoding">UTF-8</connection-property>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle10g</type-mapping>
</metadata>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
</local-tx-datasource>
</datasources>
and the jboss-service.xml that I want to use :
<server>
<mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=MyDS">
<depends optional-attribute-name="ManagedConnectionFactoryName">
<!--embedded mbean-->
<mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=MyDS">
<attribute name="JndiName">MyDS</attribute>
<attribute name="ManagedConnectionFactoryProperties">
<properties>
<config-property name="ConnectionURL" type="java.lang.String">jdbc
racle:thin:@180.162.10.10:1521
rcl</config-property>
<config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
<config-property name="UserName" type="java.lang.String">mylogin</config-property>
<config-property name="Password" type="java.lang.String">mypassword</config-property>
</properties>
</attribute>
<!--Below here are advanced properties -->
<!--hack-->
<depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends>
</mbean>
</depends>
<depends optional-attribute-name="ManagedConnectionPool">
<!--embedded mbean-->
<mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=LocalTxPool,name=MyDS">
<attribute name="MinSize">0</attribute>
<attribute name="MaxSize">50</attribute>
<attribute name="BlockingTimeoutMillis">5000</attribute>
<attribute name="IdleTimeoutMinutes">15</attribute>
<attribute name="Criteria">ByContainer</attribute>
</mbean>
</depends>
<depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
<depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager</depends>
<attribute name="TransactionManager">java:/TransactionManager</attribute>
<depends>jboss.jca:service=RARDeployer</depends>
</mbean>
</server>
I'm using Oracle 10g
Have you any idea about retreiving a Datasource from my getConnection() method ?
Thank you in advance
Adil
[ March 13, 2007: Message edited by: BERDAI Adil ]