0

我有一个使用 spring-boot 的名为 ROCServerEntrypoint 的应用程序。我想运行这个嵌入 CRaSH shell 的 Spring Boot 应用程序。我添加了以下 Maven 依赖项。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-remote-shell</artifactId>
    <version>1.3.3.RELEASE</version>
</dependency>

根据需要,我在 spring beans.xml 中添加了以下配置,以通过 SSH 启用远程访问。

   <bean class="org.crsh.spring.SpringWebBootstrap" scope="prototype">
            <property name="config">
                <props>
                    <prop key="crash.telnet.port">5000</prop>
                    <!-- VFS configuration -->
                    <prop key="crash.vfs.refresh_period">1</prop>
                    <!-- SSH configuration -->
                    <prop key="crash.ssh.port">2000</prop>
                    <!-- Authentication configuration -->
                    <prop key="crash.auth">simple</prop>
                    <prop key="crash.auth.simple.username">admin</prop>
                    <prop key="crash.auth.simple.password">admin</prop>
                </props>
            </property>
        </bean>

</beans>

我不知道下一步该怎么做。我是 linux 系统概念的新手。请简要解释远程访问它的含义以及崩溃外壳对此有何帮助?

此外,尝试通过 SSH 连接,它抛出以下

[priyanka@priyanka-ux programs]$ ssh -p 2000 admin@localhost
ssh: connect to host localhost port 2000: Connection refused

我在这里缺少什么吗?

4

1 回答 1

0

我还不允许发表评论,所以我必须将其放入答案中:

你已经解决了你的问题吗?

可以添加 CRaSH 以远程连接到正在运行的应用程序和查询管理或其他信息。简化远程通常意味着从另一台计算机使用某种终端程序。但是“远程”也可能来自本地系统,就像您正在尝试的那样。

您可能需要检查CRaSH 参考

如果您的问题仍然存在,一些提示可能有助于定位问题:

  1. 确保您的程序正在运行
  2. 检查您的日志文件或 system.out 是否有任何错误和/或某些包含“ [...] .CrshAutoConfiguration$CrshBootstrapBean [...] ”的行
  3. 尝试不使用您自己的 CRaSH 配置并使用spring boot 自动配置来检查它是否在默认设置下工作
  4. 如果您不想修改您的应用程序,请使用一个简单的测试应用程序来检查 CRaSH 是否已正确初始化。类似以下的内容可能就足够了(假设您已经添加了spring-boot-starter-remote-shell 作为依赖项!)

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.autoconfigure.websocket.WebSocketMessagingAutoConfiguration;
    
    @SpringBootApplication(exclude = { WebSocketMessagingAutoConfiguration.class })
    public class Application {
    
        public static void main(String[] args) throws Exception {
            SpringApplication.run(Application.class, args);
        }
    }
    
于 2016-06-22T12:08:36.543 回答