3 Replies Latest reply on Nov 18, 2008 10:51 AM by Peter Johnson

    JBOSS and MSSQL

    Yuriy Sherst Newbie

      hi all.

      I am developing simple web application .I am using sqlserver2000 and jboss 4.0.5GA app server.I copied all the three jar (sqlserver) into
      jboss-4.0.5.GA\server\default\lib
      But i am getting following error,can anybody tell what mistake i did?

      An error occured in the bean. Error Message is: Could not create connection; - nested throwable: (java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.))
      Stack Trace is :
      
      org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.))
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
       at com.avalbank.callstat.DBWork.getConnection(DBWork.java:87)
       at com.avalbank.callstat.DBWork.getCallList(DBWork.java:139)
       at org.apache.jsp.callstat2_jsp._jspService(callstat2_jsp.java:111)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.)
       at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:190)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:619)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:264)
       at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:575)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:347)
       at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:330)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
       ... 27 more
      Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
       at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
       at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
       at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
       at com.microsoft.jdbc.sqlserver.tds.TDSConnection.(Unknown Source)
       at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
       at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
       at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
       at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
       at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:172)
       ... 35 more




      mssql-ds.xml

      <datasources>
       <local-tx-datasource>
       <jndi-name>jdbc/avalHDS-ds</jndi-name>
       <connection-url>jdbc:microsoft:sqlserver://ipcc-dawsl.opc.aval:1433;DatabaseName=aval_hds</connection-url>
       <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
       <user-name>user</user-name>
       <password>pass</password>
      
       <metadata>
       <type-mapping>MS SQLSERVER2000</type-mapping>
       </metadata>
       </local-tx-datasource>
      
      </datasources>





        • 1. Re: JBOSS and MSSQL
          jaikiran pai Master

           

          Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket


          Are you sure the database server ipcc-dawsl.opc.aval on port 1433 is accessible from the system where JBoss is running? What does

          telnet ipcc-dawsl.opc.aval 1433


          return from the JBoss system?

          • 2. Re: JBOSS and MSSQL
            Yuriy Sherst Newbie

             

            Quote:
            Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket


            Are you sure the database server ipcc-dawsl.opc.aval on port 1433 is accessible from the system where JBoss is running? What does

            Code:

            telnet ipcc-dawsl.opc.aval 1433



            return from the JBoss system?



            Hmm when I use direct connection to database (not data source pool) all workes fine:
             public Connection getConnection() throws SQLException, ClassNotFoundException, javax.naming.NamingException {
             Connection con = null;
             Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
             String url_base = "jdbc:microsoft:sqlserver://ipcc-daws1.opc.aval:1433;DatabaseName=aval_hds;";
             con = DriverManager.getConnection(url_base, "user", "pass");
             con.setAutoCommit(false);
             /*if (ic == null) {
             ic = new javax.naming.InitialContext();
             }
             pool = (DataSource)ic.lookup("java:jdbc/avalHDS-ds");
             con = pool.getConnection();
             con.setAutoCommit(false);*/
            
             return con;
             }


            • 3. Re: JBOSS and MSSQL
              Peter Johnson Master

               

              when I use direct connection to database (not data source pool) all workes fine:


              I would be more convinced if you used that connection to actually make a database call - some drivers delay obtaining the actual connection until a call is made.