I'm deploying a simple stateless EJB under jboss 4.0.5 GA
it's throws this following trace :
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.solutions.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) (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
I get this Exception when trying to get java.sql.Connection from my datasource provided by an EJB :
System.setProperty("java.security.policy", "client.policy"); if (System.getSecurityManager() == null) System.setSecurityManager(new RMISecurityManager()); Properties env = new Properties(); env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); env.setProperty("java.naming.provider.url", "180.162.10.10:1099"); env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
Context ctx = new InitialContext(env); if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); }
<!-- Include a login module configuration named OracleDbRealm. Update your login-conf.xml, here is an example for a ConfiguredIdentityLoginModule:
<application-policy name = "OracleDbRealm"> <authentication> <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required"> <module-option name = "principal">yourprincipal</module-option> <module-option name = "userName">yourusername</module-option> <module-option name = "password">yourpassword</module-option> <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option> </login-module> </authentication> </application-policy>
NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the module-option name = "managedConnectionFactoryName" must match the object name of the ConnectionManager you are configuring here. --> <!--uncomment out this line if you are using the OracleDbRealm above <attribute name="SecurityDomainJndiName">OracleDbRealm</attribute> -->
<attribute name="MinSize">0</attribute> <attribute name="MaxSize">50</attribute> <attribute name="BlockingTimeoutMillis">5000</attribute> <attribute name="IdleTimeoutMinutes">15</attribute> <!--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)--> <attribute name="Criteria">ByContainer</attribute> </mbean>
<!--make the rar deploy! hack till better deployment--> <depends>jboss.jca:service=RARDeployer</depends>
</mbean>
</server>
it gives an error telling that they don't find the file : org.jboss.resource.connectionmanager.LocalTxConnectionManager ! I have the 4.0.5.GA version Thank you for help
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
<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>
See my question is why you needed to do the following, to deploy a datasource, you wouldn't have had to do any changes to the jboss-service.xml.
"I had to configure jboss-service.xml beacause it makes the following trace"
Can you get the default jboss-service.xml back to the way it was when you first installed JBoss, and then we can go from there to deploy your datasource?
Thanks
Mark
BERDAI Adil
Greenhorn
Joined: Mar 08, 2007
Posts: 20
posted
0
Thank you for your reply What I 'm doing is to try to retrieve a datasource from a stateless EJB 2.0 in Jboss 4.0.5.GA.
public class MyDatasourceBean implements SessionBean {
If I let the default jboss-service.xml, I get this trace ..
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.solutions.auto.persistence.connection.DBManager.getConnection(DBManager.java:133) at com.solutions.autol.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!
I may not be much of a help, but why are you retrieving the datasource to the client from the EJBs. Why not do the database operations through the EJB itself?
yes ! it's a good idea but I have to respect an architecture proposed to me..where DAO layer call the datasource in order to perfom some CallabaleStatements..