Junbo Li created ZEPPELIN-3752:
----------------------------------

             Summary: Cannot initiate class defined in Zeppelin
                 Key: ZEPPELIN-3752
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-3752
             Project: Zeppelin
          Issue Type: Improvement
          Components: zeppelin-interpreter
    Affects Versions: 0.7.3
            Reporter: Junbo Li


Cannot initiate class defined in Zeppelin.

Example:

 
{code:java}
class MyClass
{code}
{quote}{{defined class MyClass}}{quote}
I can create instance via new statement of course

 
{code:java}
new MyClass{code}
 
{quote}{{res1: MyClass = MyClass@9debbf4}}{quote}
But cannot create instance via reflection

 
{code:java}
classOf[MyClass].getConstructors.head.newInstance()
{code}
{quote}java.lang.IllegalArgumentException: wrong number of arguments
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
... 72 elided{quote}
The constructor requires an argument $iw, looks like this:
{code:java}
classOf[MyClass].getConstructors{code}
{quote}{{Array[java.lang.reflect.Constructor[_]] = Array(public 
MyClass($iw))}}{quote}
But even with $iw, it fails:

 
{code:java}
classOf[MyClass].getConstructors.head.newInstance($iw){code}
{quote}{{java.lang.NullPointerException}}{{... 77 elided}}{quote}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to