title: Initialize Exception Error in Apache Shiro
body: <p>I am getting the following error when running the test. I dont understand this as i am new  to the shiro.Please Help me</p>
  
  <pre><code>enter code herejava.lang.ExceptionInInitializerError
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:534)
  at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:195)
  at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:244)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:241)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  Caused by: org.apache.shiro.config.ConfigurationException: Unable to instantiate class [javax.sql.DataSource] for object named 'ds'.  Please ensure you've specified the fully qualified class name correctly.
  at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:151)
  at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:119)
  at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:161)
  at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:124)
  at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:102)
  at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:88)
  at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:46)
  at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
  at com.advi.test.shiro.TestShiro.&lt;clinit&gt;(TestShiro.java:23)
  ... 22 more
  Caused by: org.apache.shiro.util.InstantiationException: Unable to instantiate class [javax.sql.DataSource]
  at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:179)
  at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:164)
  at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:144)
  ... 30 more
  Caused by: java.lang.InstantiationException: javax.sql.DataSource
  at java.lang.Class.newInstance(Class.java:359)
  at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:177)
  ... 32 more
  </code></pre>
  
  <p>and this is shiro.ini file .Please let me know what mistake i have done</p>
  
  <pre><code>#myRealm = MyRealm
  #myRealm.credentialsMatcher = $myRealmCredentialsMatcher
  
  
  ps = org.apache.shiro.authc.credential.DefaultPasswordService
  pm = org.apache.shiro.authc.credential.PasswordMatcher
  pm.passwordService = $ps
  
  aa = org.apache.shiro.authc.credential.AllowAllCredentialsMatcher
  sm = org.apache.shiro.authc.credential.SimpleCredentialsMatcher
  
  #jof = org.apache.shiro.jndi.JndiObjectFactory
  #jof.resourceName = jdbc/UserDB
  #jof.requiredType = javax.sql.DataSource
  #jof.resourceRef = true
  #; Note factories are automatically invoked via getInstance(),
  #;   see org.apache.shiro.authc.config.ReflectionBuilder::resolveReference
  #jdbcRealm.dataSource = $jof
  
  ds = javax.sql.DataSource
  ds.url = jdbc:mysql://192.168.1.111:3306/Test
  ds.user = dbuser
  ds.password = dbuser
  
  jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
  #realm.permissionsLookupEnabled = true
  jdbcRealm.credentialsMatcher = $pm
  jdbcRealm.dataSource = $ds
  
  securityManager.realms = $jdbcRealm
  
  
  jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
  
  #ds = javax.sql.DataSource
  #ds.url = jdbc:mysql://192.168.1.111:3306/Test
  #ds.user = dbuser
  #ds.password = dbuser
  #jdbcRealm.dataSource = $ds
  
  # Configure JDBC realm SQL queries.
  jdbcRealm.authenticationQuery = select pass from users where name = ?;
  sha256Matcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher
  sha256Matcher.hashAlgorithmName=SHA-256
  # enable matcher in iniRealm (object responsible for authentication)
  iniRealm.credentialsMatcher = $sha256Matcher
  </code></pre>
  
  <p>It says the its unable initiate java.sql.datasource..what should i do to initiate that</p>