JohnSnowLabs/spark-nlp-workshop

Py4JJava Error ( java.lang.NoClassDefFoundError) while running Text2SQL colab notebook

Darshan-j-24 opened this issue · 5 comments

Hello there, I'm trying to run the colab notebook Text2SQL . I entered my license key and stuff but when I run the third block that is given below I'm getting an error at spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) stating Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh.
: java.lang.NoClassDefFoundError: Could not initialize class ujson.package$
.
.
I'm not able to figure this out. It would be a great help if this is solved. Thank you

code block where I'm getting error
params = {"spark.driver.memory":"16G",
"spark.kryoserializer.buffer.max":"2000M",
"spark.driver.maxResultSize":"2000M"}
print (sparknlp.version())
print (sparknlp_jsl.version())
spark = sparknlp_jsl.start(license_keys['SECRET'],params=params)

error block:
Py4JJavaError Traceback (most recent call last)
in ()
18 print (sparknlp.version())
19 print (sparknlp_jsl.version())
---> 20 spark = sparknlp_jsl.start(license_keys['SECRET'],params=params)
21
22 print (sparknlp.version())

3 frames
/usr/local/lib/python3.7/dist-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
326 raise Py4JJavaError(
327 "An error occurred while calling {0}{1}{2}.\n".
--> 328 format(target_id, ".", name), value)
329 else:
330 raise Py4JError(

Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh.
: java.lang.NoClassDefFoundError: Could not initialize class ujson.package$
at com.johnsnowlabs.license.LicenseValidator$.getPayloadObject(LicenseValidator.scala:176)
at com.johnsnowlabs.license.LicenseValidator$.$anonfun$getSupportedPlatform$1(LicenseValidator.scala:192)
at scala.Option.getOrElse(Option.scala:121)
at com.johnsnowlabs.license.LicenseValidator$.getSupportedPlatform(LicenseValidator.scala:191)
at com.johnsnowlabs.license.LicenseValidator$.registerListener(LicenseValidator.scala:85)
at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh(start.scala:75)
at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh$(start.scala:74)
at com.johnsnowlabs.util.start$.registerListenerAndStartRefresh(start.scala:123)
at com.johnsnowlabs.util.start.registerListenerAndStartRefresh(start.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)

I faced same issue. I uninstalled Java and reinstalled 1.8 version. It worked later

On Sat, 29 Jan, 2022, 3:24 PM Darshan-j-24, @.> wrote: Hello there, I'm trying to run the colab notebook Text2SQL https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/Spark%20v2.7.6%20Notebooks/18.Text2SQL.ipynb . I entered my license key and stuff but when I run the third block that is given below I'm getting an error at spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) stating Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh. : java.lang.NoClassDefFoundError: Could not initialize class ujson.package$. . I'm not able to figure this out. It would be a great help if this is solved. Thank you code block where I'm getting error params = {"spark.driver.memory":"16G", "spark.kryoserializer.buffer.max":"2000M", "spark.driver.maxResultSize":"2000M"} print (sparknlp.version()) print (sparknlp_jsl.version()) spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) error block: Py4JJavaError Traceback (most recent call last) in () 18 print (sparknlp.version()) 19 print (sparknlp_jsl.version()) ---> 20 spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) 21 22 print (sparknlp.version()) 3 frames /usr/local/lib/python3.7/dist-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name) 326 raise Py4JJavaError( 327 "An error occurred while calling {0}{1}{2}.\n". --> 328 format(target_id, ".", name), value) 329 else: 330 raise Py4JError( Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh. : java.lang.NoClassDefFoundError: Could not initialize class ujson.package$ at com.johnsnowlabs.license.LicenseValidator$.getPayloadObject(LicenseValidator.scala:176) at com.johnsnowlabs.license.LicenseValidator$.$anonfun$getSupportedPlatform$1(LicenseValidator.scala:192) at scala.Option.getOrElse(Option.scala:121) at com.johnsnowlabs.license.LicenseValidator$.getSupportedPlatform(LicenseValidator.scala:191) at com.johnsnowlabs.license.LicenseValidator$.registerListener(LicenseValidator.scala:85) at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh(start.scala:75) at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh$(start.scala:74) at com.johnsnowlabs.util.start$.registerListenerAndStartRefresh(start.scala:123) at com.johnsnowlabs.util.start.registerListenerAndStartRefresh(start.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:748) — Reply to this email directly, view it on GitHub <#478>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AICBFNLS7DJHKXMWMBKRI4LUYO2ONANCNFSM5NCWGR3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.Message ID: @.>

Hi, Thanks for your reply. I have a question, did you try this in Colab...

I faced same issue. I uninstalled Java and reinstalled 1.8 version. It worked later

On Sat, 29 Jan, 2022, 3:24 PM Darshan-j-24, @.> wrote: Hello there, I'm trying to run the colab notebook Text2SQL https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/Spark%20v2.7.6%20Notebooks/18.Text2SQL.ipynb . I entered my license key and stuff but when I run the third block that is given below I'm getting an error at spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) stating Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh. : java.lang.NoClassDefFoundError: Could not initialize class ujson.package$. . I'm not able to figure this out. It would be a great help if this is solved. Thank you code block where I'm getting error params = {"spark.driver.memory":"16G", "spark.kryoserializer.buffer.max":"2000M", "spark.driver.maxResultSize":"2000M"} print (sparknlp.version()) print (sparknlp_jsl.version()) spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) error block: Py4JJavaError Traceback (most recent call last) in () 18 print (sparknlp.version()) 19 print (sparknlp_jsl.version()) ---> 20 spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) 21 22 print (sparknlp.version()) 3 frames /usr/local/lib/python3.7/dist-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name) 326 raise Py4JJavaError( 327 "An error occurred while calling {0}{1}{2}.\n". --> 328 format(target_id, ".", name), value) 329 else: 330 raise Py4JError( Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh. : java.lang.NoClassDefFoundError: Could not initialize class ujson.package$ at com.johnsnowlabs.license.LicenseValidator$.getPayloadObject(LicenseValidator.scala:176) at com.johnsnowlabs.license.LicenseValidator$.$anonfun$getSupportedPlatform$1(LicenseValidator.scala:192) at scala.Option.getOrElse(Option.scala:121) at com.johnsnowlabs.license.LicenseValidator$.getSupportedPlatform(LicenseValidator.scala:191) at com.johnsnowlabs.license.LicenseValidator$.registerListener(LicenseValidator.scala:85) at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh(start.scala:75) at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh$(start.scala:74) at com.johnsnowlabs.util.start$.registerListenerAndStartRefresh(start.scala:123) at com.johnsnowlabs.util.start.registerListenerAndStartRefresh(start.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:748) — Reply to this email directly, view it on GitHub <#478>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AICBFNLS7DJHKXMWMBKRI4LUYO2ONANCNFSM5NCWGR3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.Message ID: @.>

I installed java 1.8 but now getting a new error.
error:
Py4JJavaError Traceback (most recent call last)
in ()
18 print (sparknlp.version())
19 print (sparknlp_jsl.version())
---> 20 spark = sparknlp_jsl.start(license_keys['SECRET'],params=params)
21
22 print (sparknlp.version())

3 frames
/usr/local/lib/python3.7/dist-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
326 raise Py4JJavaError(
327 "An error occurred while calling {0}{1}{2}.\n".
--> 328 format(target_id, ".", name), value)
329 else:
330 raise Py4JError(

Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh.
: java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

at ujson.True$.(Value.scala:284)
at ujson.True$.(Value.scala)
at ujson.Value$.(Value.scala:167)
at ujson.Value$.(Value.scala)
at ujson.package$.(package.scala:90)
at ujson.package$.(package.scala)
at com.johnsnowlabs.license.LicenseValidator$.getPayloadObject(LicenseValidator.scala:176)
at com.johnsnowlabs.license.LicenseValidator$.$anonfun$getSupportedPlatform$1(LicenseValidator.scala:192)
at scala.Option.getOrElse(Option.scala:121)
at com.johnsnowlabs.license.LicenseValidator$.getSupportedPlatform(LicenseValidator.scala:191)
at com.johnsnowlabs.license.LicenseValidator$.registerListener(LicenseValidator.scala:85)
at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh(start.scala:75)
at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh$(start.scala:74)
at com.johnsnowlabs.util.start$.registerListenerAndStartRefresh(start.scala:123)
at com.johnsnowlabs.util.start.registerListenerAndStartRefresh(start.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)

hi, yes I am working on colab On Sat, Jan 29, 2022 at 8:33 PM Darshan-j-24 @.> wrote:

I faced same issue. I uninstalled Java and reinstalled 1.8 version. It worked later … <#m_6108523915662809677_> On Sat, 29 Jan, 2022, 3:24 PM Darshan-j-24, @.
> wrote: Hello there, I'm trying to run the colab notebook Text2SQL https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/Spark%20v2.7.6%20Notebooks/18.Text2SQL.ipynb https://github.com/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/Spark%20v2.7.6%20Notebooks/18.Text2SQL.ipynb . I entered my license key and stuff but when I run the third block that is given below I'm getting an error at spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) stating Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh. : java.lang.NoClassDefFoundError: Could not initialize class ujson.package$. . I'm not able to figure this out. It would be a great help if this is solved. Thank you code block where I'm getting error params = {"spark.driver.memory":"16G", "spark.kryoserializer.buffer.max":"2000M", "spark.driver.maxResultSize":"2000M"} print (sparknlp.version()) print (sparknlp_jsl.version()) spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) error block: Py4JJavaError Traceback (most recent call last) in () 18 print (sparknlp.version()) 19 print (sparknlp_jsl.version()) ---> 20 spark = sparknlp_jsl.start(license_keys['SECRET'],params=params) 21 22 print (sparknlp.version()) 3 frames /usr/local/lib/python3.7/dist-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name) 326 raise Py4JJavaError( 327 "An error occurred while calling {0}{1}{2}.\n". --> 328 format(target_id, ".", name), value) 329 else: 330 raise Py4JError( Py4JJavaError: An error occurred while calling z:com.johnsnowlabs.util.start.registerListenerAndStartRefresh. : java.lang.NoClassDefFoundError: Could not initialize class ujson.package$ at com.johnsnowlabs.license.LicenseValidator$.getPayloadObject(LicenseValidator.scala:176) at com.johnsnowlabs.license.LicenseValidator$.$anonfun$getSupportedPlatform$1(LicenseValidator.scala:192) at scala.Option.getOrElse(Option.scala:121) at com.johnsnowlabs.license.LicenseValidator$.getSupportedPlatform(LicenseValidator.scala:191) at com.johnsnowlabs.license.LicenseValidator$.registerListener(LicenseValidator.scala:85) at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh(start.scala:75) at com.johnsnowlabs.util.WithStart.registerListenerAndStartRefresh$(start.scala:74) at com.johnsnowlabs.util.start$.registerListenerAndStartRefresh(start.scala:123) at com.johnsnowlabs.util.start.registerListenerAndStartRefresh(start.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:282) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:238) at java.lang.Thread.run(Thread.java:748) — Reply to this email directly, view it on GitHub <#478 <#478>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AICBFNLS7DJHKXMWMBKRI4LUYO2ONANCNFSM5NCWGR3A https://github.com/notifications/unsubscribe-auth/AICBFNLS7DJHKXMWMBKRI4LUYO2ONANCNFSM5NCWGR3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.Message ID: @.
> Hi, Thanks for your reply. I have a question, did you try this in Colab... — Reply to this email directly, view it on GitHub <#478 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AICBFNI23FLR7TOZT2SEL43UYP6UBANCNFSM5NCWGR3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.
**>
-- Regards Pranita Mahajan

Hello again, were you able to run this model and get output because I got one error called : (link to that issue)Text2SQLSchemaParser not defined and an issue has also been reported and that issue has been closed with a reply saying that the text2SQL model has been deprecated for v3.0.0. Did you come across this not defined error. if yes how did you solve it...? Thanks in advance.