我正在为特定数据库开发笔记本,因此我决定使用Apache Zeppelin作为基础,因此我首先为其创建了最基本的解释器。
我使用了以下文档:https://zeppelin.apache.org/docs/latest/development/writing_zeppelin_interpreter.html。 因此,我创建了继承org.apache.zeppelin.interpreter.Interpreter类的类:
import org.apache.zeppelin.interpreter.Interpreter;
import org.apache.zeppelin.interpreter.InterpreterContext;
import org.apache.zeppelin.interpreter.InterpreterException;
import org.apache.zeppelin.interpreter.InterpreterResult;
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
import org.apache.zeppelin.interpreter.InterpreterResult.Type;
import java.util.Properties;
public class GeoInterpreter extends Interpreter {
public GeoInterpreter(Properties properties) {
super(properties);
}
public void open() throws InterpreterException {
}
public void close() throws InterpreterException {
}
public InterpreterResult interpret(String s, InterpreterContext interpreterContext) throws InterpreterException {
return new InterpreterResult(Code.SUCCESS, Type.TEXT, s);
}
public void cancel(InterpreterContext interpreterContext) throws InterpreterException {
}
public FormType getFormType() throws InterpreterException {
return null;
}
public int getProgress(InterpreterContext interpreterContext) throws InterpreterException {
return 0;
}
}
之后,我为解释器配置了pom.xml文件,如文档所示。 pom.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>adrax</groupId>
<artifactId>geo-interpreter</artifactId>
<version>0.8.0</version>
<parent>
<artifactId>interpreter-parent</artifactId>
<groupId>org.apache.zeppelin</groupId>
<version>0.8.0</version>
<relativePath>../interpreter-parent</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.zeppelin</groupId>
<artifactId>zeppelin-interpreter</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
接下来,我从模板创建“ zeppelin-site.xml”,将我的解释器添加到“ zeppelin.interpreters”属性中,如下所示:
. . .
<property>
<name>zeppelin.interpreters</name>
<value>…,adrax.GeoInterpreter</value>
</property>
. . .
然后,将带有“ interpreter-setting.json”的解释器的jar放入“ interpreter”文件夹。 我的解释器-setting.json:
[
{
"group": "geo",
"name": "geo",
"className": "adrax.GeoInterpreter",
"editor": {
"language": "java",
"editOnDblClick": false,
"completionKey": "TAB"
}
}
]
最后,我尝试用我的解释器运行Zeppelin(zeppelin.cmd),并收到几个错误,整个服务器日志:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Admin/Documents/Development/Java/Geonotebook/zeppelin-0.8.0-bin-netinst/lib/interpreter/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/Admin/Documents/Development/Java/Geonotebook/zeppelin-0.8.0-bin-netinst/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
INFO [2019-01-20 20:26:45,332] ({main} ZeppelinConfiguration.java[create]:121) - Load configuration from file:/C:/Users/Admin/Documents/Development/Java/Geonotebook/zeppelin-0.8.0-bin-netinst/conf/zeppelin-site.xml
INFO [2019-01-20 20:26:45,395] ({main} ZeppelinConfiguration.java[create]:129) - Server Host: 0.0.0.0
INFO [2019-01-20 20:26:45,396] ({main} ZeppelinConfiguration.java[create]:131) - Server Port: 8080
INFO [2019-01-20 20:26:45,396] ({main} ZeppelinConfiguration.java[create]:135) - Context Path: /
INFO [2019-01-20 20:26:45,397] ({main} ZeppelinConfiguration.java[create]:136) - Zeppelin Version: 0.8.0
INFO [2019-01-20 20:26:45,440] ({main} Log.java[initialized]:186) - Logging initialized @7383ms
INFO [2019-01-20 20:26:45,501] ({main} ZeppelinServer.java[setupWebAppContext]:387) - ZeppelinServer Webapp path: C:\Users\Admin\Documents\Development\Java\Geonotebook\zeppelin-0.8.0-bin-netinst\webapps
INFO [2019-01-20 20:26:45,573] ({main} ZeppelinServer.java[main]:213) - Starting zeppelin server
INFO [2019-01-20 20:26:45,576] ({main} Server.java[doStart]:327) - jetty-9.2.15.v20160210
INFO [2019-01-20 20:28:17,850] ({main} StandardDescriptorProcessor.java[visitServlet]:297) - NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
WARN [2019-01-20 20:28:17,928] ({main} ServletHolder.java[getNameOfJspClass]:923) - Unable to make identifier for jsp rest trying rest instead
WARN [2019-01-20 20:28:18,294] ({main} ZeppelinConfiguration.java[getConfigFSDir]:527) - zeppelin.config.fs.dir is not specified, fall back to local conf directory zeppelin.conf.dir
WARN [2019-01-20 20:28:18,294] ({main} ZeppelinConfiguration.java[getConfigFSDir]:527) - zeppelin.config.fs.dir is not specified, fall back to local conf directory zeppelin.conf.dir
DEBUG [2019-01-20 20:28:18,307] ({main} InterpreterSettingManager.java[<init>]:148) - InterpreterRootPath: C:\Users\Admin\Documents\Development\Java\Geonotebook\zeppelin-0.8.0-bin-netinst\interpreter
INFO [2019-01-20 20:28:18,393] ({main} InterpreterSettingManager.java[<init>]:163) - Using RecoveryStorage: org.apache.zeppelin.interpreter.recovery.NullRecoveryStorage
INFO [2019-01-20 20:28:18,395] ({main} InterpreterSettingManager.java[<init>]:167) - Using LifecycleManager: org.apache.zeppelin.interpreter.lifecycle.NullLifecycleManager
WARN [2019-01-20 20:28:18,431] ({main} InterpreterSettingManager.java[init]:329) - No interpreter-setting.json found in C:\Users\Admin\Documents\Development\Java\Geonotebook\zeppelin-0.8.0-bin-netinst\interpreter\${interpreter.name}
DEBUG [2019-01-20 20:28:18,441] ({main} InterpreterSettingManager.java[registerInterpreterFromPath]:371) - Reading interpreter-setting.json from file C:\Users\Admin\Documents\Development\Java\Geonotebook\zeppelin-0.8.0-bin-netinst\interpreter\geo-interpreter\interpreter-setting.json
WARN [2019-01-20 20:28:18,453] ({main} ContextHandler.java[log]:2062) - unavailable
MultiException stack 1 of 1
java.lang.NullPointerException
at java.util.HashMap.putMapEntries(Unknown Source)
at java.util.HashMap.putAll(Unknown Source)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.registerInterpreterSetting(InterpreterSettingManager.java:405)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.registerInterpreterFromPath(InterpreterSettingManager.java:374)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.init(InterpreterSettingManager.java:327)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.<init>(InterpreterSettingManager.java:171)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.<init>(InterpreterSettingManager.java:131)
at org.apache.zeppelin.server.ZeppelinServer.<init>(ZeppelinServer.java:151)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1375)
at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1083)
at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:978)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1082)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074)
at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.createAndInitialize(AbstractHk2InjectionManager.java:213)
at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.createAndInitialize(ImmediateHk2InjectionManager.java:54)
at org.glassfish.jersey.server.ApplicationConfigurator.createApplication(ApplicationConfigurator.java:138)
at org.glassfish.jersey.server.ApplicationConfigurator.init(ApplicationConfigurator.java:96)
at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$0(ApplicationHandler.java:313)
at org.glassfish.jersey.server.ApplicationHandler$$Lambda$44/2067180044.accept(Unknown Source)
at java.util.Arrays$ArrayList.forEach(Unknown Source)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:313)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:616)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:396)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:163)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.zeppelin.server.ZeppelinServer.main(ZeppelinServer.java:215)
╤П╨╜╨▓ 20, 2019 8:28:18 PM org.glassfish.jersey.internal.Errors logErrors
WARNING: The following warnings have been detected: WARNING: A HTTP GET method, public javax.ws.rs.core.Response org.apache.zeppelin.rest.InterpreterRestApi.listInterpreter(java.lang.String), should not consume any entity.
WARNING: A HTTP GET method, public javax.ws.rs.core.Response org.apache.zeppelin.rest.CredentialRestApi.getCredentials(java.lang.String) throws java.io.IOException,java.lang.IllegalArgumentException, should not consume any entity.
WARNING: The (sub)resource method createNote in org.apache.zeppelin.rest.NotebookRestApi contains empty path annotation.
WARNING: The (sub)resource method getNoteList in org.apache.zeppelin.rest.NotebookRestApi contains empty path annotation.
WARN [2019-01-20 20:28:18,992] ({main} WebAppContext.java[doStart]:514) - Failed startup of context o.e.j.w.WebAppContext@12028586{/,file:/C:/Users/Admin/Documents/Development/Java/Geonotebook/zeppelin-0.8.0-bin-netinst/webapps/webapp/,STARTING}{C:\Users\Admin\Documents\Development\Java\Geonotebook\zeppelin-0.8.0-bin-netinst\zeppelin-web-0.8.0.war}
javax.servlet.ServletException: rest@355bd4==org.glassfish.jersey.servlet.ServletContainer,-1,false
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:637)
at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:396)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:163)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.zeppelin.server.ZeppelinServer.main(ZeppelinServer.java:215)
Caused by: A MultiException has 1 exceptions. They are:
1. java.lang.NullPointerException
at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1085)
at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:978)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1082)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074)
at org.glassfish.jersey.inject.hk2.AbstractHk2InjectionManager.createAndInitialize(AbstractHk2InjectionManager.java:213)
at org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager.createAndInitialize(ImmediateHk2InjectionManager.java:54)
at org.glassfish.jersey.server.ApplicationConfigurator.createApplication(ApplicationConfigurator.java:138)
at org.glassfish.jersey.server.ApplicationConfigurator.init(ApplicationConfigurator.java:96)
at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$0(ApplicationHandler.java:313)
at org.glassfish.jersey.server.ApplicationHandler$$Lambda$44/2067180044.accept(Unknown Source)
at java.util.Arrays$ArrayList.forEach(Unknown Source)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:313)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:616)
... 20 more
Caused by: java.lang.NullPointerException
at java.util.HashMap.putMapEntries(Unknown Source)
at java.util.HashMap.putAll(Unknown Source)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.registerInterpreterSetting(InterpreterSettingManager.java:405)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.registerInterpreterFromPath(InterpreterSettingManager.java:374)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.init(InterpreterSettingManager.java:327)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.<init>(InterpreterSettingManager.java:171)
at org.apache.zeppelin.interpreter.InterpreterSettingManager.<init>(InterpreterSettingManager.java:131)
at org.apache.zeppelin.server.ZeppelinServer.<init>(ZeppelinServer.java:151)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1375)
at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1083)
... 37 more
INFO [2019-01-20 20:28:19,072] ({main} AbstractConnector.java[doStart]:266) - Started ServerConnector@5ed190be{HTTP/1.1}{0.0.0.0:8080}
INFO [2019-01-20 20:28:19,073] ({main} Server.java[doStart]:379) - Started @101031ms
INFO [2019-01-20 20:28:19,073] ({main} ZeppelinServer.java[main]:223) - Done, zeppelin server started
即使日志说Zeppelin服务器已经启动,在打开localhost:8080后,我仍然收到“ HTTP错误:503访问问题。原因:服务不可用”。
我在Windows 10上运行Apache Zeppelin 0.8.0。
请帮忙弄清楚我在做什么错。也许我在文档中缺少重要的内容。
答案 0 :(得分:2)
通过在我的“ interpreter-setting.json”中添加“属性”来解决此问题:
[
{
"group": "geo",
"name": "geo",
"className": "adrax.GeoInterpreter",
"editor": {
"language": "java",
"editOnDblClick": false,
"completionKey": "TAB"
},
properties: {
}
}
]