first things first this is not a duplicate as i have seen everey similar question i found so what im doing is im conning to a data base in a maven project  i have 2 concerns -  the build gives the following error SEVERE: Servlet.service() for servlet [webapp.login.loginServlet] in context with path [] threw exception java.lang.NullPointerException: Cannot invoke &quot;java.sql.Connection.createStatement()&quot; because &quot;con&quot; is null     at webapp.login.loginServlet.doGet(loginServlet.java:46)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)     at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)     at java.base/java.lang.Thread.run(Thread.java:832)  i made my connection null and later intilized it ...in a try catch request.getRequestDispatcher(&quot;/WEB-INF/veiws/login.jsp&quot;).forward(request, response);             // connect                                  Connection con = null;                     try {                         con = DriverManager.getConnection(&quot;jdbc:mysql://localhost:3306/to_be_done&quot;,&quot;root&quot;,&quot;&quot;);                     } catch (SQLException e) {                         // TODO Auto-generated catch block                         e.printStackTrace();                     }  if i remove null compile error here   try {                         st = con.createStatement();                     } catch (SQLException e) {                         e.printStackTrace();                     } }      &quot;con&quot; is not initialized  and if i leave it null and ignore the error i get  HTTP Status 500 - Cannot invoke &quot;java.sql.Connection.createStatement()&quot; because &quot;con&quot; is null
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
How to make clickable links and cross-references in pdfs produced by LaTeX? How can I make things link url references, my index, table of contents, and cross references clickable links in documents produced by LaTeX? I generally use pdflatex to produce my documents. So  i have a scene with a few objects, and a water simulation in the scene. However I want to animate the camera turning around in the scene, while the water simulation is frozen in time. So something like a time freeze effect. But when ever I try to render an animation it renders the water simulation too. I just need one frame of the water simulation. Is there a way to do this? Left alignment in TikZ How can I add a "C" wire to my thermostat? For $n \geq 2$, show that $n \nmid 2^{n}-1$ Here is a problem which i have not been able to do for quite sometime.   For $n \geq 2$, show that $n \nmid 2^{n}-1$.   I have thought of proving this in two ways: One by using induction which didn't actually work. Next by Fermat's little theorem we have $2^{p-1} \equiv 1 \ (\text{mod} \ p)$, which actually says that for $p \mid 2^{p}-2$. But i couldn't proceed more than this. Any ideas by which i can actually solve the problem? Print to standard printer from Python? String replace method is not replacing characters WiFi repeatedly asks for password (Ubuntu 12.10 fresh) I'm sure the passphrase is correct 100% but Wifi keeps asking for authentication and never connects. What can I do? I've tried removing the networks, resetting the router, changing the password, rebooting Ubuntu, disabling IPv6.  Also, it worked until earlier today and then stopped. All my other devices log in fine. Removing the first line of CSV file Create an item in sharepoint calender when infopath form is submitted in sharepoint 2010 through workflow Doubt related to a theorem in congruences of Chapter 5 of Apostol Introduction to analytic number theory I am self studying number theory from Introduction to Analytic number theory by Apostol.   I have a doubt in one argument of proof of Theorem 5.14 and I am posting its image.      My doubt is in 2nd line of 2 nd paragraph how Apostol writes - If y is a solution of (5) then ay $\equiv $ at ( mod m) . How does y being a solution of (5) implies that?       Can someone please help Marketing Cloud contact builder shows 9 times more contacts wilcox.test usage in R I would like to know if there is a difference in the values taken from measurements of a given characteristic sampled at primary forest (Point=1) and secondary forest (Point=0)  I'm using two vectors, one with the data itself (DATA$Measurements), and the other one with the category of sampling point (DATA$Point).  How should I perform the wilcox.test fucntion?  I'm doing this way:  wilcox.test(DATA$Measurements~DATA$Point) But I notice that are other forms of performing this test:  wilcox.test(DATA$Measurements,DATA$Point) wilcox.test(DATA$Measurements,DATA$Point,paired=TRUE) Which one is more suited for testing my question of interest (Is there a difference between points for this given characteristic), and what is the difference between these options?? Algorithm to return all combinations of k elements from n I want to write a function that takes an array of letters as an argument and a number of those letters to select.   Say you provide an array of 8 letters and want to select 3 letters from that. Then you should get:  8! / ((8 - 3)! * 3!) = 56   Arrays (or words) in return consisting of 3 letters each. Superman has been exploited by Poison Ivy in Hush, and he's definitely mad in Injustice. What about Batman? Has Batman ever had to be brought to justice/stopped/killed by his fellow superheroes? (That one time when Superman dreams of Batman snapping Joker's neck doesn't count)  Edit: The Dark Knight Returns doesn't count: Batman wasn't really mad, and he wasn't wrong either. Why is an orthogonal matrix called orthogonal? I am on SharePoint 2013 and do not have access to Designer, as a preface.  I am trying to create a list view that filters items by whether or not they were added in the last hour.  I had done this earlier, only with items that were added in the current week, by creating two columns, 'Week Start' and 'Week End', and filtering by Created falling between those two.  Simple enough.  However, filtering list views does not allow for complex functions, nor does the [Today] function recognize time, causing an issue.  Is there any workaround for this?  Thanks. When do you use “learnt” and when “learned”? Is learnt UK English and learned US? Is it that simple?  I’m used to using learnt, but my US spellchecker says it is wrong. Repeat copies of array elements: Run-length decoding in MATLAB Difference between "per" and "a"