<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use/access in a python notebook a scala library installed from JAR file? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10212#M5447</link>
    <description>&lt;P&gt;Hi @blackcoffee AR​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Apr 2023 02:12:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-04-09T02:12:54Z</dc:date>
    <item>
      <title>How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10195#M5430</link>
      <description>&lt;P&gt;I'm using Azure Event Hubs Connector &lt;A href="https://github.com/Azure/azure-event-hubs-spark" target="test_blank"&gt;https://github.com/Azure/azure-event-hubs-spark&lt;/A&gt; to connect an Even Hub.&lt;/P&gt;&lt;P&gt;When I install this library from Maven , then everything works, I can access lib classes using JVM:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;connection_string = "&amp;lt;connection_string&amp;gt;"
sc._jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt(connection_string)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However for some reasons I have to istall the same lib from previously downloaded JAR file. The file is downloaded from &lt;A href="https://search.maven.org/artifact/com.microsoft.azure/azure-eventhubs-spark_2.12/2.3.22/jar" target="test_blank"&gt;https://search.maven.org/artifact/com.microsoft.azure/azure-eventhubs-spark_2.12/2.3.22/jar&lt;/A&gt;. But then I cannot access the lib classes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ERROR:root:Exception while sending command.
Traceback (most recent call last):
  File "/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/clientserver.py", line 516, in send_command
    raise Py4JNetworkError("Answer from Java side is empty")
py4j.protocol.Py4JNetworkError: Answer from Java side is empty
&amp;nbsp;
During handling of the above exception, another exception occurred:
&amp;nbsp;
Traceback (most recent call last):
  File "/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/java_gateway.py", line 1038, in send_command
    response = connection.send_command(command)
  File "/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/clientserver.py", line 539, in send_command
    raise Py4JNetworkError(
py4j.protocol.Py4JNetworkError: Error while sending or receiving
Py4JError: org.apache.spark.eventhubs.EventHubsUtils.encrypt does not exist in the JVM
---------------------------------------------------------------------------
Py4JError                                 Traceback (most recent call last)
&amp;lt;command-110542307469722&amp;gt; in &amp;lt;cell line: 17&amp;gt;()
     15 
     16 connectionString = ""
---&amp;gt; 17 sc._gateway.jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt(connectionString)
&amp;nbsp;
/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/java_gateway.py in __getattr__(self, name)
   1545                     answer, self._gateway_client, self._fqn, name)
   1546         else:
-&amp;gt; 1547             raise Py4JError(
   1548                 "{0}.{1} does not exist in the JVM".format(self._fqn, name))
   1549 
&amp;nbsp;
Py4JError: org.apache.spark.eventhubs.EventHubsUtils.encrypt does not exist in the JVM&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What I have tried is to import the lib but it did not help:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from py4j.java_gateway import java_import
java_import(sc._gateway.jvm,"org.apache.spark.eventhubs")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank for any hints.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2023-02-02 09_30_01-Window"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/724i399CB22CCA9F9925/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-02-02 09_30_01-Window" alt="2023-02-02 09_30_01-Window" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 09:02:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10195#M5430</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-02-02T09:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10196#M5431</link>
      <description>&lt;P&gt;Can you use this one which is built for python?&lt;/P&gt;&lt;P&gt;&lt;A href="https://pypi.org/project/azure-eventhub/" target="test_blank"&gt;https://pypi.org/project/azure-eventhub/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 14:57:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10196#M5431</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2023-02-02T14:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10197#M5432</link>
      <description>&lt;P&gt;Thanks, yes I could use the python library if I rework my application. But it is then some effort.&lt;/P&gt;&lt;P&gt;Anyway it is interesting why the same library installed from .jar file instead of MAven can not be used.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 16:22:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10197#M5432</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-02-02T16:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10198#M5433</link>
      <description>&lt;P&gt;Hi @blackcoffee AR​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 06:05:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10198#M5433</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-09T06:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10199#M5434</link>
      <description>&lt;P&gt;Hi @Vidula Khanna​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;no, there is no solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 06:45:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10199#M5434</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-02-09T06:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10201#M5436</link>
      <description>&lt;P&gt;Hi @Kaniz Fatma​&amp;nbsp;,&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Restarting the cluster after installation does not help.&lt;/LI&gt;&lt;LI&gt;Anything is compatible. JAR file downloaded from &lt;A href="https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-spark_2.12/2.3.22" alt="https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-spark_2.12/2.3.22" target="_blank"&gt;https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-spark_2.12/2.3.22&lt;/A&gt;. PySpark Version :3.3.0. Cluster Runtime11.3.x-scala2.12&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With only (1) one installed, it is not working. With (1) and (2) installed, everything is working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2023-03-02 14_04_00-Window"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/730iFDEF756D86B0756B/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-03-02 14_04_00-Window" alt="2023-03-02 14_04_00-Window" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 13:06:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10201#M5436</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-03-02T13:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10203#M5438</link>
      <description>&lt;P&gt;@Kaniz Fatma​&amp;nbsp;, there is no solution for the problem in the answers.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 15:13:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10203#M5438</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-03-02T15:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10206#M5441</link>
      <description>&lt;P&gt;Hi @Kaniz Fatma​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Azure/azure-event-hubs-spark" target="test_blank"&gt;https://github.com/Azure/azure-event-hubs-spark&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-spark_2.12/2.3.22" target="test_blank"&gt;https://mvnrepository.com/artifact/com.microsoft.azure/azure-eventhubs-spark_2.12/2.3.22&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 15:26:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10206#M5441</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-03-02T15:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10208#M5443</link>
      <description>&lt;P&gt;Code to reproduce:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sc._jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt("1234567890")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Error message:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ERROR:root:Exception while sending command.
Traceback (most recent call last):
  File "/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/clientserver.py", line 516, in send_command
    raise Py4JNetworkError("Answer from Java side is empty")
py4j.protocol.Py4JNetworkError: Answer from Java side is empty
&amp;nbsp;
During handling of the above exception, another exception occurred:
&amp;nbsp;
Traceback (most recent call last):
  File "/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/java_gateway.py", line 1038, in send_command
    response = connection.send_command(command)
  File "/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/clientserver.py", line 539, in send_command
    raise Py4JNetworkError(
py4j.protocol.Py4JNetworkError: Error while sending or receiving
Py4JError: org.apache.spark.eventhubs.EventHubsUtils.encrypt does not exist in the JVM
---------------------------------------------------------------------------
Py4JError                                 Traceback (most recent call last)
&amp;lt;command-1516643832031051&amp;gt; in &amp;lt;cell line: 1&amp;gt;()
----&amp;gt; 1 sc._jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt(connectionString)
&amp;nbsp;
/databricks/spark/python/lib/py4j-0.10.9.5-src.zip/py4j/java_gateway.py in __getattr__(self, name)
   1545                     answer, self._gateway_client, self._fqn, name)
   1546         else:
-&amp;gt; 1547             raise Py4JError(
   1548                 "{0}.{1} does not exist in the JVM".format(self._fqn, name))
   1549 
&amp;nbsp;
Py4JError: org.apache.spark.eventhubs.EventHubsUtils.encrypt does not exist in the JVM&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 16:12:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10208#M5443</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-03-02T16:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10211#M5446</link>
      <description>&lt;P&gt;I know how to create the Event hub configuration dictionary. The configuration is not the problem. Here is the bigger code snippet:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;connectionString = "&amp;lt;exmaple&amp;gt;" # the value does not matter
ehConf = {
    "eventhubs.connectionString" : sc._jvm.org.apache.spark.eventhubs.EventHubsUtils.encrypt(connectionString)
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Main problem is here:&lt;/P&gt;&lt;P&gt;Py4JError: org.apache.spark.eventhubs.EventHubsUtils.&lt;B&gt;encrypt does not exist in the JVM&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 20:01:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10211#M5446</guid>
      <dc:creator>blackcoffeeAR</dc:creator>
      <dc:date>2023-03-02T20:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use/access in a python notebook a scala library installed from JAR file?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10212#M5447</link>
      <description>&lt;P&gt;Hi @blackcoffee AR​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Apr 2023 02:12:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-use-access-in-a-python-notebook-a-scala-library-installed/m-p/10212#M5447</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-09T02:12:54Z</dc:date>
    </item>
  </channel>
</rss>

