5 Replies Latest reply on Apr 27, 2012 11:37 AM by wdfink

    I cannot create connection to Oracle DB 10g

    aleks-prog

      Hello. I am a newbie

       

      I have ojdbc14.jar in my server/default/lib folder, also I use jdk6

       

      Function TotalEJB.getStudentTotal:

       

      I try to connect to Oracle DB 10g:
      public Vector getStudentTotal()
                  throws RemoteException {
              Vector studentTotal = null;
              // Select rows from DB
              Connection conn = null;
              try {
                  conn = ConnectionDB.getDBConnection();
                  studentTotal = TotalDAO.selectRows(conn);
              } catch (SQLException se) {
                  throw new EJBException("SQL Exception in getTotal: " + se.getMessage());
              } finally {
                  try {
                      if(conn!=null) conn.close();
                  } catch (SQLException se) {
                      throw new EJBException("SQL Exception in getTotal " +
                                             "triing close connection: " + se.getMessage());
                  }
              }
              return studentTotal;
          }
      

      AND:

      public static Connection getDBConnection() throws SQLException {
             Connection conn = null;
             try {
                 InitialContext ic = new InitialContext();
                 System.out.println("в getDBConnection(): пытается найти " +
                                     PathNames.DS_NAME + " ...");
                 DataSource ds = (DataSource)ic.lookup("java:" + PathNames.DS_NAME);
                 System.out.println("  DataSource lookup ok");
                 conn = ds.getConnection();
                 System.out.println("  ds.getConnection() ok");
             } catch (NamingException ne) {
                 System.out.println("getDBConnection(): Naming Exception: " + ne);
                 throw new EJBException(ne);
             } catch (SQLException se) {
                 System.out.println("getDBConnection(): SQL Exception: " + se);
                 throw new EJBException(se);
             }
             return conn;
         }
      

      oracle-ds.xml:

      <?xml version="1.0" encoding="UTF-8"?><datasources> <local-tx-datasource> <jndi-name>OracleDS</jndi-name>  <connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class><user-name>system</user-name> <password>student</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>Oracle9i</type-mapping> </metadata> </local-tx-datasource> </datasources>
      

       

       

      Can anyone help me with the exception below?

       

      09:19:38,993 WARN  [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException)
                at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:565)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:250)
                at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:529)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
                at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
                at myclasses.ConnectionDB.getDBConnection(ConnectionDB.java:25)
                at total.TotalEJB.getStudentTotal(TotalEJB.java:61)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
                at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
                at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
                at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
                at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
                at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
                at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
                at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
                at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
                at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
                at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
                at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
                at org.jboss.ejb.Container.invoke(Container.java:954)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
                at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
                at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
                at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
                at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
                at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
                at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
                at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
                at $Proxy59.getStudentTotal(Unknown Source)
                at servlet.StudentServlet.doGet(StudentServlet.java:80)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.NullPointerException
                at java.lang.String.<init>(String.java:177)
                at oracle.sql.CharacterSet.AL32UTF8ToString(CharacterSet.java:1517)
                at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:589)
                at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:542)
                at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:816)
                at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362)
                at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
                at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
                at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
                at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
                at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
                ... 67 more
      09:19:38,999 INFO  [STDOUT] getDBConnection(): SQL Exception: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.lang.NullPointerException); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException))
      09:19:39,001 ERROR [LogInterceptor] EJBException in method: public abstract java.util.Vector total.Total.getStudentTotal() throws java.rmi.RemoteException, causedBy:
      org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.lang.NullPointerException); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException))
                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
                at myclasses.ConnectionDB.getDBConnection(ConnectionDB.java:25)
                at total.TotalEJB.getStudentTotal(TotalEJB.java:61)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
                at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
                at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
                at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
                at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
                at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
                at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
                at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
                at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
                at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
                at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
                at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
                at org.jboss.ejb.Container.invoke(Container.java:954)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
                at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
                at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
                at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
                at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
                at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
                at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
                at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
                at $Proxy59.getStudentTotal(Unknown Source)
                at servlet.StudentServlet.doGet(StudentServlet.java:80)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                at java.lang.Thread.run(Thread.java:662)
      Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException)
                at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:565)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:250)
                at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:529)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
                at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
                ... 59 more
      Caused by: java.lang.NullPointerException
                at java.lang.String.<init>(String.java:177)
                at oracle.sql.CharacterSet.AL32UTF8ToString(CharacterSet.java:1517)
                at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:589)
                at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:542)
                at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:816)
                at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362)
                at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
                at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
                at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
                at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
                at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
                ... 67 more
      09:19:39,015 WARN  [[StudentServlet]] Servlet.service() for servlet StudentServlet threw exception
      java.rmi.ServerException: EJBException:; nested exception is: 
                javax.ejb.EJBException: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.lang.NullPointerException); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException))
                at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
                at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
                at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
                at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
                at org.jboss.ejb.Container.invoke(Container.java:954)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
                at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
                at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
                at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
                at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
                at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
                at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
                at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
                at $Proxy59.getStudentTotal(Unknown Source)
                at servlet.StudentServlet.doGet(StudentServlet.java:80)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                at java.lang.Thread.run(Thread.java:662)
      Caused by: javax.ejb.EJBException: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.lang.NullPointerException); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException))
                at myclasses.ConnectionDB.getDBConnection(ConnectionDB.java:32)
                at total.TotalEJB.getStudentTotal(TotalEJB.java:61)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
                at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
                at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
                at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
                at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
                at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
                at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
                at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
                at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
                at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
                ... 43 more
      Caused by: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.lang.NullPointerException); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException))
                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
                at myclasses.ConnectionDB.getDBConnection(ConnectionDB.java:25)
                ... 58 more
      Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException)
                at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:565)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:250)
                at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:529)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
                at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
                at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
                ... 59 more
      Caused by: java.lang.NullPointerException
                at java.lang.String.<init>(String.java:177)
                at oracle.sql.CharacterSet.AL32UTF8ToString(CharacterSet.java:1517)
                at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:589)
                at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:542)
                at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:816)
                at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362)
                at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
                at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
                at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
                at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
                at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
                ... 67 more
      
        • 1. Re: I cannot create connection to Oracle DB 10g
          aleks-prog

          In this line

          DataSource ds = (DataSource)ic.lookup("java:" + PathNames.DS_NAME);

           

          PathNames.DS_NAME = "/OracleDS"

          • 2. Re: I cannot create connection to Oracle DB 10g
            aleks-prog

            Help please

            UP

            • 3. Re: I cannot create connection to Oracle DB 10g
              aleks-prog

              heeeeeeeeeeeelp

              • 4. Re: I cannot create connection to Oracle DB 10g
                sfcoy

                What's your environment details? JBoss version, OS, etc.

                 

                This:

                Aleks ALEKS wrote:

                 

                ...

                Caused by: java.lang.NullPointerException
                          at java.lang.String.<init>(String.java:177)
                          at oracle.sql.CharacterSet.AL32UTF8ToString(CharacterSet.java:1517)
                          at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:589)
                          at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:542)
                          at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:816)
                          at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362)
                          at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
                          at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
                          at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
                          at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
                          at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
                          ... 67 more
                

                 

                suggests that the driver is having some character set translation issues.

                 

                Make sure that you edit all text files (including java source) in UTF-8. Check existing ones to make sure. Eclipse annoyingly defaults to the platform encoding, which you almost never want.

                • 5. Re: I cannot create connection to Oracle DB 10g
                  wdfink

                  I would also recommend to use ojdbc6.jar if you have a Java6.

                   

                  What EJB version do you use?

                  If EJB3 you should use injection to get the datasource. In case of EJB2 you should avoid creating InitialContext, use sessionContext for this.

                   

                  And, as you are a newbie

                  All people here are willing to help, there is no need to need to trigger it in such short period.

                  Quite the converse, people might not answer if you do that.

                   

                  If a SLA is needed there is a professional support here