I am running hive jdbc code which is hosted in tomcat. I am getting the following exception.   com.sun.jersey.spi.container.ContainerResponse.mapMappableContainerException The RuntimeException could not be mapped to a response, re-throwing to the HTTP container   java.lang.NullPointerException  at AthenaTec.Hive_ORC.RESTservice.getMsg(RESTservice.java:254) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   My code.  public class RESTservice { final private static String driverName = "org.apache.hive.jdbc.HiveDriver"; @POST @Path("/data") public Response getMsg(@FormParam("data") String JSONString) Connection con = null; Statement prepstmt = null; ResultSet rs = null; JSONObject obj = new JSONObject(JSONString); try { String city = (String) obj.getJSONObject("page_1").get("city"); String locality = (String) obj.getJSONObject("page_1").get("locality"); String result = "'" + city + "'" + "," + locality + "'" ; Class.forName(driverName); con = DriverManager.getConnection("jdbc:hive2://192.168.2.40:10000/default", "ec2-user", "Abc123!@#"); prepstmt = con.createStatement(); String stmt = "INSERT INTO TABLE real_estate.addressinformation_orc VALUES(" + result + ")"; rs = prepstmt.executeQuery(stmt); System.out.println("Query executed successfully"); return Response.status(200).entity("query executed successfully").build(); catch (ClassNotFoundException e) {         // TODO Auto-generated catch block         e.printStackTrace();         System.exit(1);     }   When i test with the postman i am getting the following exception.  java.lang.NullPointerException AthenaTec.Hive_ORC.RESTservice.getMsg(RESTservice.java:254) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
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?
HSA - Continue to Invest? How do I remove "Ubuntu" in the bios boot menu? (UEFI) Story where the hero ends up having his eyelids removed and being hooked up to some kind of virtual reality machine Trying to identify a short science fiction story where the protagonist is some kind of policeman or investigator, and at the end he chooses to live his life out hooked up to some kind of virtual reality machine. The ending describes him having his eyelids removed as he is attached to the machine, and then as the machine starts working he "becomes" a cowboy or some other western figure riding his horse downhill in a desert scene. Is there a name for when the same word is used at the beginning and end of different phrases/sentences? Is there a name for when one phrase ends with a word that starts the next phrase. For instance:     life is a peach and cream   Or     sunscreen in the eye for detail   Or (from Dave Eggers' Heartbreaking Work of Staggering Genius)     JFKFC MongoDB could not connect local server Using "the" instead of "a" for something that isn't a specific object I've been curious about this for a while.  Generally, one uses "the" if they mean a specific object ("The copy of Lord of the Rings I bought yesterday") instead of any object that fits a description ("I have a copy of Lord of the Rings").  However I've seen "the" used in some cases where the phrase doesn't refer to a specific object. I've noticed it mostly being about technology, such as "This game requires the Classic Controller" (seen on some Wii Virtual Console games). While saying "This game requires a Classic Controller" seems to be correct as well, using "the" doesn't feel wrong either.  The controller's page on Wikipedia also uses "the":   What is the rule that allows the use of "the" in this context?  I presume it has something to do with "Classic Controller" being a proper noun. How to find solutions of linear Diophantine ax + by = c? If you go to  and are a 4k+ user on Anime.SE, you will see the following:        There is one reopen vote on this question, but the reopen vote count is displayed on a different line than the word "reopen". This is slightly silly, and would perhaps benefit from converting reopen (1) to reopen&amp;nbsp;(1), and likewise for close and delete votes. (Or any other way of preventing a line break between the vote type and the vote count.)  A repro (the close link) from here on Meta: limit of integral $n\int_{0}^{1} x^n f(x) \text{d}x$ as $n\rightarrow \infty$ If a function maps every connected set onto a connected set, is it necessarily continuous? I know the converse is true. How can I make a time delay in Python? What happened to the ia32-libs package? The ia32-libs package is no longer present in Ubuntu 12.04 repositories for a 64bit system. Are there any available replacement packages available for download? How can I reduce screen brightness below the minimum without an app? I have an Optimus Elite, and it has a minimum brightness setting. In certain apps, I can reduce the brightness below the safe minimum, but when I leave the app, the brightness is increased to the system-wide minimum.  Using , I can permanently set the brightness below the safe amount, and it will stay even after going to other apps. Or using , I can accomplish almost the same thing even without needing root (it displays a translucent 'filter' over the whole screen, reducing brightness/contrast but not actually changing the backlighting power amount).  What I want to know is where the minimum screen brightness is stored. I have a rooted phone with CyanogenMod 9, so I have permissions to edit anything and could change a config or sqlite entry, but I don't know where this value is stored. What I would like to do is use the status bar brightness slider to be able to slide to the actual minimum of the screen, rather than the OS-controlled minimum. Having an app is useful, but having the functionality without the app seems to be within reach, if only I knew where the OS is getting it's safe minimum setting.  Where is this "safe minimum brightness" setting stored? If I can change it, I can remove my apps and use native controls. Suppose I sold an option on stock X, with strike price Y, and expiry date Z. Suppose I later buy an option on the same stock, with the same strike price, and the same expiry date. Do these two positions cancel out each other (i.e. both contracts cease to exist anywhere), or will I end up with two separate contracts?  Is it the same with the reverse situation? e.g. I bought an option on stock A, with strike price B, and expiry date C. If I later sell an option on the same stock, with the same strike price and expiry date, will I end up with two contracts (one long position, one short position)? Why should the "H" option not be used in floats? Iterating over Java collections in Scala I'm writing some Scala code which uses the  API. I would like to iterate over the rows contained in the java.util.Iterator that I get from the Sheet class. I would like to use the iterator in a for each style loop, so I have been trying to convert it to a native Scala collection but will no luck.  I have looked at the Scala wrapper classes/traits, but I can not see how to use them correctly. How do I iterate over a Java collection in Scala without using the verbose while(hasNext()) getNext() style of loop?  Here's the code I wrote based on the correct answer:  class IteratorWrapper[A](iter:java.util.Iterator[A]) {     def foreach(f: A =&gt; Unit): Unit = {         while(iter.hasNext){           f(iter.next)         }     } }  object SpreadsheetParser extends Application {     implicit def iteratorToWrapper[T](iter:java.util.Iterator[T]):IteratorWrapper[T] = new IteratorWrapper[T](iter)      override def main(args:Array[String]):Unit =     {         val ios = new FileInputStream("assets/data.xls")         val workbook = new HSSFWorkbook(ios)         var sheet = workbook.getSheetAt(0)         var rows = sheet.rowIterator()          for (val row &lt;- rows){             println(row)         }     } } Is infinite scrolling justifiable? Recently I've noticed a new trend in user interfaces. Facebook and Twitter do this, and I've come across it on other random, less famous sites. However, to keep things simple, I'll just use Facebook as an example.  When you first log into Facebook, you are presented with a "News Feed" that has a certain amount of posts from your friends. The feed extends down past the bottom of the viewport.  Then, when you scroll down, to see the feeds "below the fold", at some point as you move downward, it loads in more items. Apparently, this is called "infinite scrolling".  On my computer, this often causes my position in the feed to jump while I'm in the action of scrolling, which is really annoying.  What's particularly egregious about this UI concept is that there is footer information at the bottom of the page. I advertise on Facebook, and use the link at the bottom of the page to get to the advertisement management interface.  Because of this incremental load feature I'm describing, I often scroll down to the bottom to get to the link I want, when I reach the bottom of the page, it will suddenly load in new data, pushing the footer down again, and I have to scroll down again.  This whole thing seems completely pointless to me. What's the upside? A Facebook page is near a megabyte of data, so saving the few extra kilobytes of feed data for when the user scrolls down is just not worth it.  What's wrong with a link that just says "show more"?  Since this additional data retrieval thing seems to happen as soon as I start scrolling even a little anyway, why not just load that data in the first place?  To me this minor annoyance reeks of some engineers concept of a "neat trick" that does not have any actual appreciable upside.  Or am I wrong about that? Is there an advantage that I'm not seeing? Am I the only one who thinks it's stupid? Do some people like it? Prove that every isometry on $\mathbb{R}^2$ is bijective For which $a \in \mathbb{C} -\ \{0,1\}$ does the equation $f(z) = f(az) $ has a non constant solution $f$ with $f$ being analytical in a neighborhood of $0$.  My attempt:  First, we can see that any such solution must satisfy:  $f(z)=f(a^kz)$ for all $k \in \mathbb{N} $.  If $|a|&lt;1$:  The series $z_{k} = a^k$ converges to 0 which is an accumulation point, and $f(z_i)=f(z_j)$ for all $i, j\in \mathbb{N} $. Thus $f$ must be constant.  If $|a|=1$:  For all $a \neq 1$ , $f$ must be constant on any circle around $0$, so again $f$ must be constant.  My quesions are:   Am I correct with my consclusions?   Also, I'm stuck in the case where $|a|&gt;1$. Any ideas?  Thanks Looking for an intuitive explanation why the row rank is equal to the column rank for a matrix