Unbale to start h2o from java code

400 views
Skip to first unread message

marut...@gmail.com

unread,
Dec 6, 2014, 11:54:24 AM12/6/14
to h2os...@googlegroups.com
Hi,
I am trying to start h2o from java code. I have included following depencies in my code. h2o-app, h2o-web, h20-flow, h2o-classic, h2o-scala, h2o-algos, h2o-core, sparkling-water-core. And here is my code

---------------------------------------------------
import org.apache.spark.h2o.*;
import org.apache.spark.rdd.*;
import water.fvec.*;
import water.fvec.DataFrame;
import water.*;
import water.api.*;
import hex.*;
import jsr166y.*;
import water.H2O;
import javax.script.*;
import javax.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.resources.*;
import java.io.File;
import org.apache.spark.h2o.H2OContext;
import org.apache.spark.h2o.*;
import org.apache.spark.sql.SQLContext;
import hex.deeplearning.*;
import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
import hex.deeplearning.DeepLearningModel.DeepLearningParameters;
//import h2oContext.*;
public class H2o {
public static void main(String[] args){

H2OClientApp.start();
H2O.waitForCloudSize(3,1024);

System.exit(0);

}

}
------------------------------------------------------------
If i run this code i am getting the error like
-------------------------------------------------------------------------
10:49:57.644 main INFO WATER: ----- H2O started -----
10:49:57.822 main INFO WATER: Build git branch: master
10:49:57.822 main INFO WATER: Build git hash: d8ee05301370ef192a2668ce9f021209d35e7e95
10:49:57.822 main INFO WATER: Build git describe: jenkins-master-1558-5-gd8ee053-dirty
10:49:57.823 main INFO WATER: Build project version: 2.9.0.99999
10:49:57.823 main INFO WATER: Built by: 'michal'
10:49:57.823 main INFO WATER: Built on: 'Fri Oct 24 11:21:17 PDT 2014'
10:49:57.823 main INFO WATER: Java availableProcessors: 4
10:49:57.936 main INFO WATER: Java heap totalMemory: 0.02 gb
10:49:57.936 main INFO WATER: Java heap maxMemory: 0.24 gb
10:49:57.938 main INFO WATER: Java version: Java 1.7.0_51 (from Oracle Corporation)
10:49:57.938 main INFO WATER: OS version: Windows 7 6.1 (x86)
10:49:58.459 main INFO WATER: Machine physical memory: 2.80 gb
10:49:58.459 main INFO WATER: ICE root: '/tmp/h2o-Administrator'
10:49:59.746 main INFO WATER: Possible IP Address: lo (Software Loopback Interface 1), 127.0.0.1
10:49:59.746 main INFO WATER: Possible IP Address: lo (Software Loopback Interface 1), 0:0:0:0:0:0:0:1
10:49:59.746 main INFO WATER: Possible IP Address: eth3 (Atheros AR8131 PCI-E Gigabit Ethernet Controller (NDIS 6.20)), fe80:0:0:0:75ac:8838:aeeb:2cb6%10
10:49:59.746 main INFO WATER: Possible IP Address: eth4 (Bluetooth Device (Personal Area Network)), fe80:0:0:0:2d1c:606b:d49:6097%11
10:49:59.747 main INFO WATER: Possible IP Address: net6 (Atheros AR9285 Wireless Network Adapter), 192.168.1.131
10:49:59.747 main INFO WATER: Possible IP Address: net17 (Teredo Tunneling Pseudo-Interface), fe80:0:0:0:e0:0:0:0%27
10:49:59.747 main INFO WATER: Possible IP Address: eth8 (VirtualBox Host-Only Ethernet Adapter), 192.168.56.1
10:49:59.747 main INFO WATER: Possible IP Address: eth8 (VirtualBox Host-Only Ethernet Adapter), fe80:0:0:0:3cbe:9951:b48d:2521%31
10:49:59.747 main INFO WATER: Possible IP Address: net20 (Microsoft ISATAP Adapter #3), fe80:0:0:0:0:5efe:c0a8:183%35
10:50:00.049 main INFO WATER: Multiple local IPs detected:
+ /192.168.1.131 /192.168.56.1
+ Attempting to determine correct address...
+ Using /192.168.1.131
10:50:01.818 main INFO WATER: Internal communication uses port: 54322
+ Listening for HTTP and REST traffic on http://192.168.1.131:54321/
10:50:03.141 main INFO WATER: H2O cloud name: 'Administrator'
10:50:03.142 main INFO WATER: (v2.9.0.99999) 'Administrator' on /192.168.1.131:54321, discovery address /233.190.242.173:59838
10:50:03.142 main INFO WATER: If you have trouble connecting, try SSH tunneling from your local machine (e.g., via port 55555):
+ 1. Open a terminal and run 'ssh -L 55555:localhost:54321 Admini...@192.168.1.131'
+ 2. Point your browser to http://localhost:55555
10:50:03.892 main INFO WATER: Cloud of size 1 formed [/192.168.1.131:54321 (00:00:00.000)]
10:50:03.893 main INFO WATER: Log dir: '\tmp\h2o-Administrator\h2ologs'
Exception in thread "main" java.lang.ExceptionInInitializerError
at water.api.RequestServer.<clinit>(RequestServer.java:84)
at water.H2O.startNetworkServices(H2O.java:1023)
at water.H2O.main(H2O.java:934)
at water.H2OClient.main(H2OClient.java:16)
at water.H2OClientApp.driver(H2OClientApp.java:16)
at water.H2OClientApp.main(H2OClientApp.java:13)
at water.H2OClientApp.start(H2OClientApp.java:11)
at H2o.main(H2o.java:27)
Caused by: java.lang.NullPointerException
at water.Boot.getResource2(Boot.java:377)
at water.api.Request.loadTemplate(Request.java:240)
at water.api.Request.<clinit>(Request.java:235)
... 8 more
------------------------------------------------------------------------
H2o is able to start but at the end i am getting this NullPointerException. Am i missing any dependency?? Why i am facing issue. Any help would be helpful

Thanks,

cli...@0xdata.com

unread,
Dec 6, 2014, 2:56:04 PM12/6/14
to h2os...@googlegroups.com
Hey Maruthi -
If you launch h2o-dev from class-files or component jars (as is common when running from e.g. IdeaJ), the javascript & other resources are loaded from a local file, which isn't being found.  When launching from the fully built jar, h2o looks for the resources inside the jar.
We should change that NPE to a "can't find this file" message instead. 

The search path code isn't super smart, but it should work if you launch from the top-level h2o-dev directory. 

We do this so we can e.g. flip html & JS resources and the same time as flipping a single matching class file - i.e., rapid dev turnaround.

Cliff

maruthi Donthi

unread,
Dec 8, 2014, 11:01:15 AM12/8/14
to h2os...@googlegroups.com
Hi,
Thanks for your response. So if I want to run the h2o in eclipse by using maven jar files, then What i have to do to run it without NPE?

Thanks,

maruthi Donthi

unread,
Dec 8, 2014, 1:44:51 PM12/8/14
to h2os...@googlegroups.com
Hi,
I am able to build h2o-dev successfully using the link https://github.com/h2oai/h2o-dev . Now i am trying to run h2o from simple java code in eclipse. I am using h2o-dev maven repository plugins to use h2o.

When i call H2oClientApp.start(); still i am still having the NullPointerException error. 

As you said h2o looks for javascript resources locally. But i am able to built h20-dev then it should have work for eclipse as well. I am not sure, But please provide me some instruction on how to get rid of this error.
 
Thanks,

Michal Malohlava

unread,
Dec 8, 2014, 5:05:54 PM12/8/14
to h2os...@googlegroups.com
Hi Maruthi,

the best start to coding with h2o-dev is to clone H2O Droplets:
 https://github.com/h2oai/h2o-droplets

Side note: droplet is a simple project allows for bootstrapping a new project on top of h2o-dev.

Check also Tom's blog post how to use them http://h2o.ai/blog/2014/10/running-your-first-droplet-on-h2o/

Regarding your NPE: can you send me more information - which version of artifacts did you use? And eclipse release - luna?

But i really recommend to start from H2O Droplets, generate eclipse files (./gradlew eclipse) and import project to eclipse.
You can also use Eclipse Groovy plugin, but currently it is untested feature.

Michal


Dne 12/8/14 v 10:44 AM maruthi Donthi napsal(a):
--
You received this message because you are subscribed to the Google Groups "H2O & Open Source Scalable Machine Learning - h2ostream" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2ostream+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Michal Malohlava

unread,
Dec 8, 2014, 5:28:23 PM12/8/14
to h2os...@googlegroups.com
Hi Maruthi,

i already replied in different thread. Check h2o-stream - https://groups.google.com/forum/#!topic/h2ostream/_QPPX0kSpu8

michal

Dne 12/8/14 v 2:13 PM maruthi Donthi napsal(a):
Hi,
I figured out how to start h2o from eclipse. I am using artifacts of 0.1.13 version. But now i am having problem with CloudSize.

I am using this code to run h2o.

H2OClientApp.start();
H2O.waitForCloudSize(3, 10000);

But i am getting the following error:

Exception in thread "main" java.lang.RuntimeException: Cloud size under 3
at water.H2O.waitForCloudSize(H2O.java:851)
at com.stratio.examples.JavaExample.main(JavaExample.java:77)

Any help on this??

Thanks,
Reply all
Reply to author
Forward
0 new messages