- dev Is it possible that you are constructing more than one HiveContext in a single JVM? Due to global state in Hive code this is not allowed.
Michael On Wed, Sep 17, 2014 at 7:21 PM, Cheng, Hao <hao.ch...@intel.com> wrote: > Hi, Du > > I am not sure what you mean “triggers the HiveContext to create a > database”, do you create the sub class of HiveContext? Just be sure you > call the “HiveContext.sessionState” eagerly, since it will set the proper > “hiveconf” into the SessionState, otherwise the HiveDriver will always get > the null value when retrieving HiveConf. > > > > Cheng Hao > > > > *From:* Du Li [mailto:l...@yahoo-inc.com.INVALID] > *Sent:* Thursday, September 18, 2014 7:51 AM > *To:* u...@spark.apache.org; dev@spark.apache.org > *Subject:* problem with HiveContext inside Actor > > > > Hi, > > > > Wonder anybody had similar experience or any suggestion here. > > > > I have an akka Actor that processes database requests in high-level > messages. Inside this Actor, it creates a HiveContext object that does the > actual db work. The main thread creates the needed SparkContext and passes > in to the Actor to create the HiveContext. > > > > When a message is sent to the Actor, it is processed properly except that, > when the message triggers the HiveContext to create a database, it throws a > NullPointerException in hive.ql.Driver.java which suggests that its conf > variable is not initialized. > > > > Ironically, it works fine if my main thread directly calls > actor.hiveContext to create the database. The spark version is 1.1.0. > > > > Thanks, > > Du >