Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 02-26-2017 11:13 AM
I have following error with zeppelin in HDP2.5.
so, I have searched to know the installation and import scala packages like python.
but I failed.
How can I remove the errors.
In addition, I don't want to use eclipse for spark, but zeppelin.
Thanks.
error said: "<console>:63: error: object eclipse is not a member of package org import org.eclipse.jetty.client.ContentExchange"
import org.eclipse.jetty.client.ContentExchange
import org.eclipse.jetty.client.HttpClient
def createExchangeForSign(client: HttpClient, sign: String): (String, ContentExchange) = {
val exchange = new ContentExchange()
exchange.setURL(s"http://new73s.herokuapp.com/qsos/${sign}.json")
client.send(exchange)
(sign, exchange)
}
def readExchangeCallLog(mapper: ObjectMapper, exchange: ContentExchange): Array[CallLog] = {
exchange.waitForDone()
val responseJson = exchange.getResponseContent()
val qsos = mapper.readValue(responseJson, classOf[Array[CallLog]])
qsos
}
val contactsContactLists = validSigns.distinct().mapPartitions{
signs =>
val mapper = createMapper()
// create a connection pool
val client = new HttpClient()
client.start()
// create http request
signs.map {sign =>
createExchangeForSign(client, sign)
// fetch responses
}.map{ case (sign, exchange) =>
(sign, readExchangeCallLog(mapper, exchange))
}.filter(x => x._2 != null) // Remove empty CallLogs
}
println(contactsContactLists.collect().toList)
Created 02-26-2017 04:26 PM
I think the issue here is that ContentExchange is not in org.eclipse.jetty I see a similar class in org.mortbay.jetty
confirm that's what you need, then you can load it in Zeppelin with command below and whatever the new maven repo for the class ContentExchange you're looking for.
%spark.dep
z.reset()
z.load("org.eclipse.jetty:jetty-client:9.4.2.v20170220")
%spark import org.eclipse.jetty.client.ContentExchange import org.eclipse.jetty.client.HttpClient
Created 02-26-2017 04:26 PM
I think the issue here is that ContentExchange is not in org.eclipse.jetty I see a similar class in org.mortbay.jetty
confirm that's what you need, then you can load it in Zeppelin with command below and whatever the new maven repo for the class ContentExchange you're looking for.
%spark.dep
z.reset()
z.load("org.eclipse.jetty:jetty-client:9.4.2.v20170220")
%spark import org.eclipse.jetty.client.ContentExchange import org.eclipse.jetty.client.HttpClient
Created on 02-27-2017 02:16 AM - edited 08-19-2019 03:04 AM
@Osoeng Kwon I tested your imports and it does indeed look like ContentExchange is no longer in the package org.eclipse.jetty.client. My maven search prompted me to the following version that has both classes.
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>7.6.13.v20130916</version>
<type>jar</type>
</dependency>
you might want to reconsider using it as it's from 2013, there are many version of jetty-client available since then. Also there's something wrong with your code, I ran it in Zeppelin and it didn't work, most likely I'm missing some of the imports you did not copy/paste. I loaded the dependency using the interpreter configuration page, under Spark, click edit and add the dependency in the dependencies section (the screenshot below shows how it looks in my configuration), using z.load as I've shown earlier is deprecated. I ran all of your code in Zeppelin after that and I received the following:
import org.eclipse.jetty.client.ContentExchange
import org.eclipse.jetty.client.HttpClient
createExchangeForSign: (client: org.eclipse.jetty.client.HttpClient, sign: String)(String, org.eclipse.jetty.client.ContentExchange)
<console>:29: error: not found: type CallLog
def readExchangeCallLog(mapper: ObjectMapper, exchange: ContentExchange): Array[CallLog] = {
^
<console>:29: error: not found: type ObjectMapper
def readExchangeCallLog(mapper: ObjectMapper, exchange: ContentExchange): Array[CallLog] = {
Created 02-27-2017 05:05 AM
Thanks for your reply. I have success with followings:
%spark.dep
z.reset()
z.load("org.eclipse.jetty:jetty-client:7.6.13.v20130916")
%spark
import org.eclipse.jetty.client.ContentExchange
import org.eclipse.jetty.client.HttpClient
DepInterpreter(%dep) deprecated. Remove dependencies and repositories through GUI interpreter menu instead. DepInterpreter(%dep) deprecated. Load dependency through GUI interpreter menu instead. res1: org.apache.zeppelin.dep.Dependency = org.apache.zeppelin.dep.Dependency@2448cc17
import org.eclipse.jetty.client.ContentExchange
import org.eclipse.jetty.client.HttpClient
Created 02-27-2017 07:18 AM
How can see the dependency information needed to solve my error?