JSP java.lang.NullPointerException When Moving Server
<p>I am aware there a lot of threads about this error, but my situation is</p>

<ul>
<li>Site worked on one server (the old host)</li>
<li>Site no longer works on new server (with TomCat installed and working)</li>
</ul>

<p>We have a database up and running and I created a <strong>conntest.do</strong> file to make sure that we could connect to the database. However when we run the home page (i.e. no form data etc being posted) the following errors are created:</p>

<pre><code>    exception

javax.servlet.ServletException: java.lang.NullPointerException
    org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    com.ntech.realjosh.util.GenericFilter.doFilter(GenericFilter.java:86)
root cause

java.lang.NullPointerException
    com.ntech.realjosh.util.DbUtil.dbStConClose(DbUtil.java:46)
    com.ntech.realjosh.util.RealjoshUtil.chkUserLock(RealjoshUtil.java:1378)
    com.ntech.realjosh.action.IndexAction.execute(IndexAction.java:25)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    com.ntech.realjosh.util.GenericFilter.doFilter(GenericFilter.java:86)
</code></pre>

<p>The 'RealJosh' util is inherited and worked on the old server. The referenced <strong>DBUtil</strong> is the same except that the mysql access details have been updated.</p>

<p>The problem is as a hosting company we don't have a JSP Programmer in house but the client cannot get their site working on our server.</p>

<p>Any help you can be/give would be really gratefully received. If I need to post the content of any .java files let me know.
Thanks,</p>

<p>Martin</p>

<p>[edit] 
Here's the full DBUtil.java File:</p>

<pre><code>public class DbUtil {

    private Connection con;
    private Statement st;
    private ResultSet rs;

    public void dbConnection() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/youngrob_database", "youngrob_user", "password");
            st = con.createStatement();
            Logger.getLogger(DbUtil.class.getName()).log(Level.INFO, "Db Connected..........");
        } catch (Exception ex) {
            Logger.getLogger(DbUtil.class.getName()).log(Level.SEVERE, null, ex);
            st = '';
            con = '';
        }
    }

    public void dbClose() {
        try {
            if(getRs()!=null){
                getRs().close();
            }
            getSt().close();
            getCon().close();
            setRs(null);
            setSt(null);
            setCon(null);
        } catch (SQLException ex) {
            Logger.getLogger(DbUtil.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void dbStConClose() {
        try {
         if(con!=null){
            getSt().close();
            getCon().close();
            //setSt(null);
            //setCon(null);
            }
        } catch (SQLException ex) {
            Logger.getLogger(DbUtil.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public Connection getCon() {
        return con;
    }

    public void setCon(Connection con) {
        this.con = con;
    }

    public ResultSet getRs() {
        return rs;
    }

    public void setRs(ResultSet rs) {
        this.rs = rs;
    }

    public Statement getSt() {
        return st;
    }

    public void setSt(Statement st) {
        this.st = st;
    }
}
</code></pre>

<p>[edit 2] This is my conntest script which does work</p>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;%@ page import="java.sql.*" %&gt;
&lt;%@ page import="java.io.*" %&gt;

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Connection with mysql database&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Connection status &lt;/h1&gt;
&lt;%
try {
/* Create string of connection url within specified format with machine name,
port number and database name. Here machine name id localhost and
database name is usermaster. */
String connectionURL = "jdbc:mysql://localhost:3306/youngrob_database";

// declare a connection by using Connection interface
Connection connection = null;

// Load JBBC driver "com.mysql.jdbc.Driver"
Class.forName("com.mysql.jdbc.Driver").newInstance();

/* Create a connection by using getConnection() method that takes parameters of
string type connection url, user name and password to connect to database. */
connection = DriverManager.getConnection(connectionURL, "youngrob_user", "password");

// check weather connection is established or not by isClosed() method
if(!connection.isClosed())
%&gt;
&lt;font size="+3" color="green"&gt;&lt;/b&gt;
&lt;%
out.println("Successfully connected to " + "MySQL server using TCP/IP...");
connection.close();
}
catch(Exception ex){
%&gt;
&lt;/font&gt;
&lt;font size="+3" color="red"&gt;&lt;/b&gt;
&lt;%
out.println("Unable to connect to database.");
}
%&gt;
&lt;/font&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>My issue seems to be that my conntest creates a valid mysql connection, but my DBUtil.java does not?</p>