Solved

500 Servlet Exception java.lang.NullPointerException

Posted on 2004-03-30
43
1,942 Views
Last Modified: 2013-11-24
The following error is received when trying to go to ANY page on my website that requires access to the database.  Can anyone help me with this?  I just moved the site from one hosting company to another and cannot get my site back up and running!  HELP!

The site is www.roundrockonline.biz.....


500 Servlet Exception

java.lang.NullPointerException
      at _java._roundrockonline._listing__jsp._jspService(/java/roundrockonline/listing.jsp:19)
      at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
      at com.caucho.jsp.Page.subservice(Page.java:506)
      at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
      at com.caucho.server.http.Invocation.service(Invocation.java:315)
      at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
      at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
      at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
      at java.lang.Thread.run(Thread.java:536)
0
Comment
Question by:junkyforjc
  • 15
  • 13
  • 12
  • +2
43 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10721041
your trying to reference a variable that is null.
perhaps it is failing to get a db connection.

can you post your code
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721063
check  your servlet filter settings and list the listing.jsp and the servlet that dispatches the listing.jsp
0
 

Author Comment

by:junkyforjc
ID: 10721193
I am fairly certain that it is failing the connection.  However, I do not know how to test this.  It is all on the servers and I am not knowledgable enough to tell what is wrong.  I know that the "path" for all the files is probably not the same as it was previously but as I said, I do not know how to tell where the db is located.  I don't know where to find the servlet filter settings....


Here is the code to listing.jsp


<%@ page language="Java" contentType="text/html" %>
<%@ page import="java.util.*,java.sql.*" %>

<%roundrockonline.connect.ConnectionPool pool = roundrockonline.connect.ConnectionPool.getInstance();
Connection conn;
Statement stmt;
ResultSet rs;
Statement stmt1;

Statement stmt2,stmt3;
ResultSet rs2=null;
ResultSet rs3=null;
String sub_cat_index="1";
String msg="Please enter Business details here.";
if(request.getParameter("msg")!=null){
    msg=request.getParameter("msg");
}

conn=pool.getConnection();
//conn=DriverManager.getConnection("jdbc:mysql://www.roundrockonline.biz/roundrockonline","roundrockonline","password is here");
stmt=conn.createStatement();
stmt1=conn.createStatement();
stmt2=conn.createStatement();
stmt3=conn.createStatement();
rs=stmt.executeQuery("SELECT * from category WHERE parent_category_code=0 order by description");
//rs1=stmt1.executeQuery("SELECT description from category WHERE parent_category_code!=0");

if(rs.next()){
      sub_cat_index=rs.getString("category_code");
      rs2=stmt2.executeQuery("SELECT * from category WHERE parent_category_code="+sub_cat_index+" order by description");

}
rs.absolute(-1);
int category_count=rs.getRow();
rs.beforeFirst();

String referredBy = "";
String temp=request.getHeader("referer");
/*

if(temp.indexOf("RoundRock")>-1)
      referredBy="RoundRock";

if(temp.indexOf("Dallas")>-1)
      referredBy="Dallas";

if(temp.indexOf("Austin")>-1)
      referredBy="Austin";

if(temp.indexOf("Houston")>-1)
      referredBy="Houston";

if(temp.indexOf("Lubbock")>-1)
      referredBy="Lubbock";


*/
String register_city =referredBy;
%>

<html>
<head>
<title>Round Rock online</title>
<meta name="rating" content="General">
<meta name="resource-type" content="text/html">
<meta name="CreatedBy" content="Synapse Communications (P) Limited - 2002">
<meta name="copyright" content="RoundRockOnline.biz">
<meta name="robots" content="index, follow">
<meta name="robots" content="ALL">
<meta name="Distribution" Content="Global">
<meta name="revisit" Content="14 days">
<meta name="Language" Content="English">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" Content="text/html;Charset=iso-8859-1">
<link rel="stylesheet" href="template/index_style.css" type="text/css">
</head>

<script language="javascript">
<!--
var uploaded=false;
//var groups=document.form1.category.options.length;
var group=new Array(<%=category_count%>);
for (i=0; i<<%=category_count%>; i++)
group[i]=new Array();
var j=0;
<% rs.next();
for (int i=0; i<category_count; i++){
int j=0;
rs3=stmt3.executeQuery("SELECT * from category WHERE parent_category_code="+sub_cat_index+" order by description");
while(rs3.next()){
    if(j==0){%>
       group[<%=i%>][<%=j%>]=new Option("--Select Sub-Category--","none");

    <%rs3.beforeFirst();
    }
    else{%>
group[<%=i%>][<%=j%>]=new Option("<%=rs3.getString(2)%>","<%=rs3.getString(1)%>");
<%  }
j=j+1;
 }
if(rs.next()) sub_cat_index=rs.getString("category_code");
}%>


function redirect(x){
if(x>0)x=x-1;
else
x=0;
for (m=document.form1.sub_category.options.length-1;m>0;m--)
document.form1.sub_category.options[m]=null
for (i=0;i<group[x].length;i++){
document.form1.sub_category.options[i]=new Option(group[x][i].text,group[x][i].value)
}
document.form1.sub_category.options[0].selected=true
}


function checkAll()
{
     if ((document.form1.category.options.selectedIndex == 0)&& (document.form1.search_for.value=="")){
            alert("Please specify either a business category or a business name to search. ");
            document.form1.category.focus();
      }

      else {

         document.form1.submit();
      }
}

//-->
</script>


<body bgcolor="003366" text="#000000" vlink="0" alink="0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="redirect(document.form1.category.options.selectedIndex)">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>

    <td>&nbsp;</td>
        </tr>
        <tr>

    <td background="images/top-bg.gif" valign="top">
      <table width="770" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr>
                <td valign="top">

            <div align="center"><a href="index.jsp"><img src="/images/title.jpg" width="520" height="87" alt="RoundRockOnline.biz" border="0"></a></div>
                </td>
              </tr>
            </table>

    </td>
        </tr>
        <tr>

    <td height="20">
      <div align="center" class="linksmain"><a href="corpinfo.html" class="linksmain">Corporate Info</a> | <a href="contactus.html" class="linksmain">Contact Us</a></div>
    </td>
        </tr>
        <tr>

    <td bgcolor="#FFFFFF" valign="top">
      <table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
          <td height="15">&nbsp;</td>
        </tr>
        <tr>
          <td><img src="/images/search_top.jpg" width="700" height="46" alt="Search Area"></td>
        </tr>
        <tr>
          <td height="15">
            <div align="right" ><a href="business_register.jsp" class="white_link">&laquo;
              Click here to list your business &raquo;</a></div>
          </td>
        </tr>
        <tr>
          <td valign="top">
            <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr>
                <td class="text_head" height="30">Looking for a product or business
                  near you?</td>
              </tr>
              <tr>
                <td class="text_main" valign="top" height="20"><b>Please enter
                  details here.<br>
                  </b> </td>
              </tr>
              <tr>
                <td valign="top">
                  <form name="form1" method="post" action="search.jsp">
                    <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center">
                      <tr>
                        <td colspan="7" bgcolor="#003366" height="20">
                          <div align="center" class="linksmain">ROUNDROCK BUSINESS
                            DIRECTORY</div>
                        </td>
                      </tr>
                      <tr>
                        <td rowspan="8" valign="top" width="2"><img src="/images/search-side.gif" width="2" height="167"></td>
                        <td width="22" height="10">&nbsp;</td>
                        <td width="247">&nbsp;</td>
                        <td width="41">&nbsp;</td>
                        <td width="250">&nbsp;</td>
                        <td width="80">&nbsp;</td>
                        <td rowspan="8" valign="top" width="3">
                          <div align="right"><img src="/images/search-side.gif" width="2" height="167"></div>
                        </td>
                      </tr>
                      <tr>
                        <td width="22">&nbsp;</td>
                        <td class="white_link" width="247"><font size="2">1.</font>
                          Search by Category:</td>
                        <td width="41">&nbsp;</td>
                        <td class="white_link" width="250"><font size="2">2. </font>Search
                          by Sub-Category</td>
                        <td width="80">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="22">&nbsp;</td>
                        <td height="24" valign="bottom" width="247">
                          <select name="category" onChange="redirect(this.options.selectedIndex)" size="1" >
                          <option value="none">--Select category--</option>
                            <%rs.beforeFirst();
                              while(rs.next()){ %>
                            <option value="<%=rs.getString(1)%>"><%=rs.getString("description")%>
                            </option>
                            <% } %>
                          </select>
                        </td>
                        <td width="41">&nbsp;</td>
                        <td valign="bottom" width="250">
                          <select name="sub_category" size="1" >
                           <option value="none">--Select sub-category--</option>
                            <% while(rs2.next()){ %>
                            <option value="<%=rs2.getString(1)%>"><%=rs2.getString("description")%>
                            </option>
                            <% } %>
                          </select>
                        </td>
                        <td width="80">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="22" height="10">&nbsp;</td>
                        <td width="247">&nbsp; </td>
                        <td width="41">&nbsp;</td>
                        <td width="250">&nbsp;</td>
                        <td width="80">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="22">&nbsp;</td>
                        <td class="white_link" width="247"><font size="2">3.</font>Search
                          For(Name):</td>
                        <td width="41">&nbsp;</td>
                        <td class="white_link" width="250"><font size="2">4.</font>
                          Zip:</td>
                        <td width="80">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="22">&nbsp;</td>
                        <td height="24" valign="bottom" width="247">
                          <input type="text" name="search_for">
                        </td>
                        <td width="41">&nbsp;</td>
                        <td valign="bottom" width="250">
                          <input type="text" name="zip">
                        </td>
                        <td width="80">
                          <div align="center"><a href="javascript:checkAll()"><img src="/images/go.jpg" width="32" height="22" border="0"></a></div>
                        </td>
                      </tr>
                      <tr>
                        <td width="22">&nbsp;</td>
                        <td width="247" class="white_link" >
                          <input type="radio" name="match" value="exact" checked>
                          Exact Match
                          <input type="radio" name="match" value="like">
                          Similar to</td>
                        <td width="41">&nbsp;</td>
                        <td width="250" class="white_link">
                          <input type="radio" name="list" value="all" checked>
                          List All
                          <input type="radio" name="list" value="discount">
                          List Discount offers</td>
                        <td width="80">&nbsp;</td>
                      </tr>
                      <tr>
                        <td width="22" height="10">&nbsp;</td>
                        <td width="247" class="white_link" >&nbsp; </td>
                        <td width="41">&nbsp;</td>
                        <td width="250">&nbsp; </td>
                        <td width="80">&nbsp;</td>
                      </tr>
                      <tr>
                        <td colspan="7" valign="top"><img src="/images/search-bottom.gif" width="645" height="2"></td>
                      </tr>
                    </table>
                  </form>
                </td>                                                                                                        
              </tr>
              <tr><td height="10">&nbsp;</td></tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
      <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="6699CC" height="20">
      <div align="center" class="linksmain"><a href="corpinfo.html" class="linksmain">Corporate Info</a> | <a href="contactus.html" class="linksmain">Contact Us</a> | <a href="help.html" class="linksmain">Help</a> | <a href="terms.html" class="linksmain">Terms of Use</a> | <a href="terms.html" class="linksmain">Privacy Notice</a></div>
    </td>
        </tr>
        <tr>

    <td height="20">
      <div align="center"><span class="non-link">All rights reserved &copy;2002
        roundrockonline.biz</span></div>
    </td>
        </tr>
</table>
</body>
<%
if(rs!=null)rs.close();
if(stmt!=null)stmt.close();

if(stmt1!=null)stmt1.close();
if(rs2!=null)rs2.close();
if(stmt2!=null)stmt2.close();
if(rs3!=null)rs3.close();
if(stmt3!=null)stmt3.close();
pool.returnConnection(conn);%>
</html>

0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721205
You don't need to create

stmt=conn.createStatement();
stmt1=conn.createStatement();
stmt2=conn.createStatement();
stmt3=conn.createStatement();


Four statements.  Do your work only with one statement.  I am suspecting, creating more than one statement with a single connection is causing the problem.

Use one statement and comment the other statements.  It should work.
0
 
LVL 92

Expert Comment

by:objects
ID: 10721211
easiest wAy to determine what the cause is would be to look at line 19 of the generated java file
0
 
LVL 92

Expert Comment

by:objects
ID: 10721218
if (pool==null) throw new SQLException("COuld not get pool");
conn=pool.getConnection();
if (conn==null) throw new SQLException("COuld not get connection");
0
 

Author Comment

by:junkyforjc
ID: 10721286
Objects,

I added the error statements and I get a Could not get pool error.

0
 
LVL 92

Expert Comment

by:objects
ID: 10721302
check your connection pool code to determine the reason getInstance() is returning null.
0
 
LVL 1

Expert Comment

by:kiwi_alien
ID: 10721314
Its actually line 19 of the .jsp file - compilers have come somewhere in the last few years at least...

Looks like its just your pool that is null (if you've given us every line of that file...) when you first use it.

Feel free to throw 'objects' code in to show that but why it IS null is weird when it *looks* like you instantiate it...??
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721316
That is right!  Your pool is returning null.
0
 

Author Comment

by:junkyforjc
ID: 10721370
Well gentlemen,

I think that it is to do with the location of the db...???

Here is the code for the ConnectionPool.java
package roundrockonline.connect;

import java.sql.*;
import java.util.*;
import java.io.*;

public class ConnectionPool
{
      static ConnectionPool pool;
      private Hashtable connections;
      private static String dbURL, user, password,driverClassName;
      private static int initialConnections,increment,maxIdle,idle=0;

      public static ConnectionPool getInstance(){
      if(pool == null)
            try
            {
                  pool = new ConnectionPool();
                  //System.out.println(" New instance created ");
            }
            catch(Exception e)
            {
                  //System.out.println(" Cannot connect to " + dbURL +" ,Check your parameters");
            }
            return pool;
      }

      public ConnectionPool() throws SQLException, ClassNotFoundException
      {
            init();
            //this.initialConnections = initialConnection;
            //this.driverClassName = driverClassName ;
            Class.forName(this.driverClassName);
            //this.dbURL = dbURL;
            //this.user = user;
            //this.password = password;
            //this.increment= increment;
            connections= new Hashtable();
            for(int i = 0; i < initialConnections; i++)
            {
                  Connection c = DriverManager.getConnection(this.dbURL, this.user, this.password);
                  connections.put(c, Boolean.FALSE);
                  //System.out.println(" made connection no ." + i+" "+c);

            }
            //idle=initialConnections;
      }


      public Connection getConnection() throws SQLException
      {
            Connection con = null;
            Enumeration cons = connections.keys();
            synchronized (connections)
            {
            while(cons.hasMoreElements())
            {
                  con = (Connection)cons.nextElement();
                  Boolean b = (Boolean)connections.get(con);
                  if ( b.equals(Boolean.FALSE))
                  {
                        try
                        {
                              con.setAutoCommit(true);
                        }
                        catch(SQLException e)
                        {
                              con = DriverManager.getConnection(dbURL, user, password);
                              //System.out.println(" got connection in catch() "+con);
                        }
                        connections.put(con, Boolean.TRUE);
                        //idle--;
                        return con;
                  }
            }
            for(int i = 0; i < increment; i++)
            {
                  Connection c = DriverManager.getConnection(this.dbURL, this.user, this.password);
                  connections.put(c, Boolean.FALSE);
                  //System.out.println(" made connection no ." + i+" "+c);
                  //idle++;
            }
            //idle--;
            return getConnection();
            }
      }

      public synchronized void returnConnection(Connection returned)
      {
            try
            {
                  Connection con;
                  Enumeration cons = connections.keys();
                  while (cons.hasMoreElements())
                  {
                        con = (Connection)cons.nextElement();
                        if (con == returned)
                        {
                              idle++;
                              if(idle == connections.size()) idle=0;
                              if(idle > maxIdle){
                                    con.close();
                                    connections.remove(con);
                                    //System.out.println(" Removed from pool "+ con);
                                    idle--;

                              }
                              else {
                                    connections.put(con, Boolean.FALSE);
                                    //System.out.println(" Returned to pool "+ con);
                              }
                              break;
                        }
                  }
            }
            catch(Exception e)
            {
                  //System.out.println("error in return connection method .. "+e);
            }

      }
//

      private void init()
      {
//System.out.println("in init method .. ");
            Properties dbProps = loadPropertyFile("/home/round/public_html/WEB-INF/classes/roundrockonline/connect/roundrockonlinedb.properties");
//System.out.println("Properties .. "+ dbProps);
            loadDrivers(dbProps);
      }


   private Properties loadPropertyFile(String propertyFileName)
   {
     Properties dbProps = new Properties();
      //System.out.println("Properties loadPropertyFile().. "+dbProps);
     InputStream is=null;
     try {
       is = new FileInputStream(propertyFileName);
       dbProps.load(is);
     }catch (Exception e) {
        //System.err.println("FATAL Error: error in Connection Pool creation");
        //System.err.println("             can't read the property file " + propertyFileName);
     }finally {
        try {
          if (is != null)
            is.close();
        }catch (IOException e) {
        }
     }
      //System.out.println("Properties return loadPropertyFile().. "+dbProps);
     return dbProps;
   }

      private void loadDrivers(Properties props)
      {
            dbURL = props.getProperty("url");
            driverClassName = props.getProperty("drivers");
              user = props.getProperty("user");
              password = props.getProperty("password");
              initialConnections=Integer.parseInt(props.getProperty("initialConnections"));
              increment=Integer.parseInt(props.getProperty("increment"));
              maxIdle=Integer.parseInt(props.getProperty("maxIdle"));
            //System.out.println("dbURL .. "+ dbURL);
            //System.out.println("driverClassName .. "+ driverClassName);
            //System.out.println("user .. "+ user);
            //System.out.println("password .. "+ password);


      }
}
 
0
 
LVL 92

Expert Comment

by:objects
ID: 10721387
>                //System.out.println(" Cannot connect to " + dbURL +" ,Check your parameters");

that shouldn't be commented out
i'd suggest printing out that exception to give you some clues
0
 
LVL 92

Expert Comment

by:objects
ID: 10721391
perhaps your driver class is not available
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721399
Check this file

/home/round/public_html/WEB-INF/classes/roundrockonline/connect/roundrockonlinedb.properties

0
 

Author Comment

by:junkyforjc
ID: 10721468
I don't know how to check the driver class availability.

Here is the contents of the properties file:


#mySQL settings
drivers=org.gjt.mm.mysql.Driver
url=jdbc:mysql://www.roundrockonline.biz/roundrockonline
user=roundrockonline
password=Ay6Q62V1aeR
initialConnections=3
increment=2
maxIdle=1
0
 
LVL 92

Expert Comment

by:objects
ID: 10721479
printing out that exception that is ignored above will tell u the cause.
0
 

Author Comment

by:junkyforjc
ID: 10721483
I tried to uncomment that and I got nothing when I went to the page.  How do I make it include that in the output to the screen?
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721500
  public ConnectionPool() throws SQLException, ClassNotFoundException
     {
          init();
          //this.initialConnections = initialConnection;
          //this.driverClassName = driverClassName ;
          Class.forName(this.driverClassName);


>> Class.forName(this.driverClassName); your driver class is getting loaded in this part.  If it is not there, it could have thrown ClassNotFoundException.


         try
          {
               pool = new ConnectionPool();
               //System.out.println(" New instance created ");
          }
          catch(Exception e)
          {
               System.out.println(" Cannot connect to " + dbURL +" ,Check your parameters");
               e.printStackTrace();
          }

would help us guide you more.
0
 
LVL 92

Expert Comment

by:objects
ID: 10721506
    public static ConnectionPool getInstance() throws Exception {
     if(pool == null)
     {
          pool = new ConnectionPool();
      }
      return pool;
     }
0
 

Author Comment

by:junkyforjc
ID: 10721548
I have added the code and I get no additional error output.  Here is the page that I get:


500 Servlet Exception
java.sql.SQLException: COuld not get pool
      at _java._roundrockonline._listing__jsp._jspService(/java/roundrockonline/listing.jsp:18)
      at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
      at com.caucho.jsp.Page.subservice(Page.java:506)
      at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
      at com.caucho.server.http.Invocation.service(Invocation.java:315)
      at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
      at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
      at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
      at java.lang.Thread.run(Thread.java:536)

0
 
LVL 92

Expert Comment

by:objects
ID: 10721563
what code did u add?
if you are prionting out the exception then stdout goes to your logs so check there.
the change i posted above should cause the error to be displayed to the page.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:junkyforjc
ID: 10721609
I have added both.  The error.log shows the following:

[2004/03/31 01:30:11] com.caucho.jsp.JspServlet: init
[2004/03/31 01:30:11] _java._roundrockonline._listing__jsp: init
[2004/03/31 01:30:12] COuld not get pool
java.sql.SQLException: COuld not get pool
      at _java._roundrockonline._listing__jsp._jspService(_listing__jsp.java:44)
      at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
      at com.caucho.jsp.Page.subservice(Page.java:506)
      at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
      at com.caucho.server.http.Invocation.service(Invocation.java:315)
      at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
      at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
      at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
      at java.lang.Thread.run(Thread.java:536)


The stderr.log shows the following:

Cannot connect to jdbc:mysql://www.roundrockonline.biz/roundrockonline ,Check your parameters


0
 
LVL 92

Expert Comment

by:objects
ID: 10721619
> Cannot connect to jdbc:mysql://www.roundrockonline.biz/roundrockonline ,Check your parameters

its failing, but you're still not printing out the exception. That'll tell you the cause of the failure.

0
 

Author Comment

by:junkyforjc
ID: 10721632
how do i get the exception?
0
 

Author Comment

by:junkyforjc
ID: 10721688
Sorry for the delay.  I never said I was great at this.  Here is the exception:


500 Servlet Exception
java.sql.SQLException: Invalid authorization specification: Access denied
for user: 'roundrockonline@sn2.cwihosting.com' (Using password: YES)
      at org.gjt.mm.mysql.MysqlIO.init(Unknown Source)
      at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source)
      at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Unknown Source)
      at org.gjt.mm.mysql.Driver.connect(Unknown Source)
      at java.sql.DriverManager.getConnection(DriverManager.java:512)
      at java.sql.DriverManager.getConnection(DriverManager.java:171)
      at roundrockonline.connect.ConnectionPool.<init>(ConnectionPool.java:42)
      at roundrockonline.connect.ConnectionPool.getInstance(ConnectionPool.java:18)
      at _java._roundrockonline._listing__jsp._jspService(/java/roundrockonline/listing.jsp:4)
      at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
      at com.caucho.jsp.Page.subservice(Page.java:506)
      at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
      at com.caucho.server.http.Invocation.service(Invocation.java:315)
      at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
      at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
      at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
      at java.lang.Thread.run(Thread.java:536)

0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721691
your password is wrong.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721698
check your password in the properties file.

There are chances that your user might be also wrong.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721704
Seems like your password is encrypted in your properties file.

Decrypt and use.
0
 

Author Comment

by:junkyforjc
ID: 10721723
The user is wrong because of the @sn2.cwihosting.com.......how do I change that portion???  I don't know how you tell that the db is correct?
0
 

Author Comment

by:junkyforjc
ID: 10721739
the password was the one that i used when the site was hosted on the other servers.???
0
 
LVL 9

Accepted Solution

by:
mmuruganandam earned 250 total points
ID: 10721745
   public ConnectionPool() throws SQLException, ClassNotFoundException
     {
          init();
          //this.initialConnections = initialConnection;
          //this.driverClassName = driverClassName ;
          Class.forName(this.driverClassName);
          //this.dbURL = dbURL;
          //this.user = user;
          //this.password = password;
          //this.increment= increment;
          connections= new Hashtable();
          for(int i = 0; i < initialConnections; i++)
          {
               System.out.println(this.user); // ADD THIS LINE HERE
               Connection c = DriverManager.getConnection(this.dbURL, this.user, this.password);



Check this out and let me know.

In the stack trace it use to give some other information on users.

I think, the user is going correct.
0
 

Author Comment

by:junkyforjc
ID: 10721754
i can get into the database from the hosting company tools, however, i have no way of knowing that it is where my program is trying to access...is there a way for me to check the path of the db??
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721757
i am suspecting on your password.

is that encrypted in the properties file.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721765
the stack trace clearly says that "Invalid authorization specification"

In that case, it is able to talk to the DB.  But the credentials are wrong.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 10721793
> is there a way for me to check the path of the db??

yes from the connection string:

jdbc:mysql://www.roundrockonline.biz/roundrockonline

0
 

Author Comment

by:junkyforjc
ID: 10721803
You are correct.  The user is correct...However, this still goes back to my having to create the db and not knowing how to check and make sure that I have the correct user and password in.  Is there any way to check..  I know that when I go to it in the tools, it does not ask for pw or anything.???
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721842
contact your system administrator for the verification of your password.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10721844
check your tool for authentication mechnism.  There are host authentication and password authentication.  If that option is there, select the password authentication and try
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10721870
>> how to check and make sure that I have the correct user and password in.  Is there any way to check..  

Do you have a DBA?
0
 

Author Comment

by:junkyforjc
ID: 10721889
I will have to submit a ticket for them to check for me.  It will be at least tomorrow....??

I am so very thankful for you all.  I feel certain that it is the login or pw that is wrong.

Blessings on you all!
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10721912
>>  I feel certain that it is the login or pw that is wrong

It is, perhaps, the password.
0
 
LVL 92

Expert Comment

by:objects
ID: 10721916
0
 

Author Comment

by:junkyforjc
ID: 10721929
Gentlemen,

Again, I humbly thank you!  You are an amazing resource!

Junkyforjc
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now