You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by "zhuangchong (Jira)" <ji...@apache.org> on 2021/01/22 06:11:02 UTC

[jira] [Created] (ZEPPELIN-5216) ZSession createFromExistingSession method not allowed

zhuangchong created ZEPPELIN-5216:
-------------------------------------

             Summary: ZSession createFromExistingSession method not allowed
                 Key: ZEPPELIN-5216
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-5216
             Project: Zeppelin
          Issue Type: Bug
          Components: zeppelin-client
    Affects Versions: 0.9.0
         Environment: 0.9.0
            Reporter: zhuangchong


Zeppelin open safety certification, the execution ZSession.createFromExistingSession(clientConfig, interpreter, sessionId) method, return an error message'Unable to call rest api, status: 405, statusText: Method Not Allowed, message: Method Not Allowed‘

The cause of the problem:

ZSession createFromExistingSession direct call zeppelinClient.getSession(this.getSessionId()) method, not for safety certification

**Modify**

The new method:
{code:java}

public static ZSession createFromExistingSession(ZeppelinClient zeppelinClient, String interpreter, String sessionId) throws Exception
{ return createFromExistingSession(zeppelinClient, interpreter, sessionId, (MessageHandler)null); }

public static ZSession createFromExistingSession(ZeppelinClient zeppelinClient, String interpreter, String sessionId, MessageHandler messageHandler) throws Exception {
 ZSession session = new ZSession(zeppelinClient, interpreter, sessionId);
 session.reconnect(messageHandler);
 return session;
 }
private ZSession(ZeppelinClient zeppelinClient, String interpreter, String sessionId) throws Exception {
 this.zeppelinClient = zeppelinClient;
 this.interpreter = interpreter;
 this.sessionInfo = new SessionInfo(sessionId);
 }

{code}
 

**Call**

1.enable security authentication
{code:java}
//
ZeppelinClient zeppelinClient = new ZeppelinClient(clientConfig);
zeppelinClient.login(userName,password);
ZSession.createFromExistingSession(zeppelinClient,interpreter, sessionId);

{code}
2.close security authentication
{code:java}
//
ZeppelinClient zeppelinClient = new ZeppelinClient(clientConfig);
ZSession.createFromExistingSession(zeppelinClient,interpreter, sessionId);
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)