小编zer*_*_yu的帖子

SnakeYaml“无法找到属性错误”

这是我的 config.yml 的一部分:

#Authenctication
AuthenticationConfig:
  AuthencticationType: LDAP
  LDAPConfig:
     LDAPUrl: ldap://localhost:389
     ConnectionType: simple
     LDAPSecurityConfig:
        RootDN: cn=manager,dc=maxcrc,dc=com
        RootPassword: secret
        UserSearchDN: ou=People,dc=maxcrc,dc=com
        GroupdSearchDB: ou=Groups,dc=maxcrc,dc=com
Run Code Online (Sandbox Code Playgroud)

我有一个用于解析的类:

public class YamlConfiguraiton {
    private AuthenticationConfiguration AuthenticationConfig;

    public void setAuthenticationConfig(AuthenticationConfiguration AuthenticationConfig) {
        this.AuthenticationConfig = AuthenticationConfig;
    }

    public AuthenticationConfiguration getAuthenticationConfig() {
        return this.AuthenticationConfig;
    }
}
Run Code Online (Sandbox Code Playgroud)

然而,当我跑

try(InputStream in = new FileInputStream(new File(ymalPath))) {
            yamlConfig = yaml.loadAs(in, YamlConfiguraiton.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
Run Code Online (Sandbox Code Playgroud)

发生以下错误:

Exception in thread "main" Cannot create property=AuthenticationConfig for JavaBean=com.ibm.entity.matching.common.bootstrap.YamlConfiguraiton@e7860081
 in 'reader', line 2, column …
Run Code Online (Sandbox Code Playgroud)

java yaml snakeyaml

5
推荐指数
1
解决办法
5483
查看次数

Eclipse:加载 SSH2 私钥时出错

我在 macOS Mojave 版本 10.14.1 上使用 eclipse 版本:2018-12 (4.10.0)。我按照https://help.github.com/enterprise/2.9/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/上的说明进行设置GitHub 的 ssh 密钥。我可以毫无问题地在终端中“git clone”存储库。但是,到了eclipse的时候,出现了异常:

org.eclipse.jgit.api.errors.TransportException: git@github.***.com:EA/entity-matching.git: invalid private key: [B@47822527
    at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:222)
    at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:161)
    at org.eclipse.egit.core.op.ListRemoteOperation.run(ListRemoteOperation.java:116)
    at org.eclipse.egit.ui.internal.clone.SourceBranchPage$8.run(SourceBranchPage.java:340)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.eclipse.jgit.errors.TransportException: git@github.***.com:EA/entity-matching.git: invalid privatekey: [B@47822527
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:191)
    at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:140)
    at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:280)
    at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:170)
    at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:200)
    ... 4 more
Caused by: com.jcraft.jsch.JSchException: invalid privatekey: [B@47822527
    at com.jcraft.jsch.KeyPair.load(KeyPair.java:664)
    at com.jcraft.jsch.KeyPair.load(KeyPair.java:561)
    at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
    at com.jcraft.jsch.JSch.addIdentity(JSch.java:407)
    at com.jcraft.jsch.JSch.addIdentity(JSch.java:367)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getJSch(JschConfigSessionFactory.java:399)
    at org.eclipse.egit.core.EclipseSshSessionFactory.createSession(EclipseSshSessionFactory.java:53)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:208)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:138)
    ... 8 more
Run Code Online (Sandbox Code Playgroud)

我确定 URI …

eclipse ssh

3
推荐指数
1
解决办法
2542
查看次数

标签 统计

eclipse ×1

java ×1

snakeyaml ×1

ssh ×1

yaml ×1