eclipse / dirigible

Eclipse Dirigibleâ„¢ Project
https://www.dirigible.io
Eclipse Public License 2.0
267 stars 90 forks source link

[IDE] Terminal Perspective doesn't Work #3789

Open iliyan-velichkov opened 6 months ago

iliyan-velichkov commented 6 months ago

When I open the terminal perspective on my mac I get an error in the console: image

2024-04-16 11:55:40.283 [ERROR] [http-nio-8080-exec-6] [background] o.e.d.c.t.e.TerminalWebsocketHandler - [ws:terminal] Failed to connecto to ws://localhost:9000/ws
java.lang.RuntimeException: Failed to connecto to ws://localhost:9000/ws
    at org.eclipse.dirigible.components.terminal.client.TerminalWebsocketClientEndpoint.<init>(TerminalWebsocketClientEndpoint.java:45) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
    at org.eclipse.dirigible.components.terminal.endpoint.TerminalWebsocketHandler.startClientWebsocket(TerminalWebsocketHandler.java:173) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
    at org.eclipse.dirigible.components.terminal.endpoint.TerminalWebsocketHandler.afterConnectionEstablished(TerminalWebsocketHandler.java:78) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
    at org.springframework.web.socket.handler.WebSocketHandlerDecorator.afterConnectionEstablished(WebSocketHandlerDecorator.java:70) ~[spring-websocket-6.1.5.jar!/:6.1.5]
    at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.afterConnectionEstablished(LoggingWebSocketHandlerDecorator.java:48) ~[spring-websocket-6.1.5.jar!/:6.1.5]
    at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.afterConnectionEstablished(ExceptionWebSocketHandlerDecorator.java:48) ~[spring-websocket-6.1.5.jar!/:6.1.5]
    at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:103) ~[spring-websocket-6.1.5.jar!/:6.1.5]
    at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131) ~[tomcat-embed-websocket-10.1.19.jar!/:na]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:938) ~[tomcat-embed-core-10.1.19.jar!/:na]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) ~[tomcat-embed-core-10.1.19.jar!/:na]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.19.jar!/:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.19.jar!/:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.19.jar!/:na]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat-embed-core-10.1.19.jar!/:na]
    at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Caused by: jakarta.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection to [ws://localhost:9000/ws] failed
    at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServerRecursive(WsWebSocketContainer.java:429) ~[tomcat-embed-websocket-10.1.19.jar!/:na]
    at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:123) ~[tomcat-embed-websocket-10.1.19.jar!/:na]
    at org.eclipse.dirigible.components.terminal.client.TerminalWebsocketClientEndpoint.<init>(TerminalWebsocketClientEndpoint.java:43) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
    ... 14 common frames omitted
Caused by: java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.PendingFuture.get(PendingFuture.java:200) ~[na:na]
    at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServerRecursive(WsWebSocketContainer.java:318) ~[tomcat-embed-websocket-10.1.19.jar!/:na]
    ... 16 common frames omitted
Caused by: java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method) ~[na:na]
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:256) ~[na:na]
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:202) ~[na:na]
    at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:217) ~[na:na]
    at java.base/sun.nio.ch.KQueuePort$EventHandlerTask.run(KQueuePort.java:312) ~[na:na]
    at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:113) ~[na:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.19.jar!/:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.19.jar!/:na]
    ... 1 common frames omitted
ThuF commented 5 months ago

It seems that in order for the Terminal to run locally several things should be done:

Screenshot 2024-05-10 at 18 43 44

It seems that also ttyd is not started in the Docker image. However if I login into the docker container and run the ttyd.sh on the root level, it seems that the process is started successfully, but the Terminal perspective still can't connect.

Screenshot 2024-05-10 at 19 05 20 Screenshot 2024-05-10 at 19 05 26

Here is the application log:

2024-05-10 19:04:44 2024-05-10 16:04:44.135 [ERROR] [http-nio-8080-exec-6] [background] o.e.d.c.t.e.TerminalWebsocketHandler - [ws:terminal] jakarta.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection to [ws://localhost:9000/ws] failed
2024-05-10 19:04:44 java.lang.RuntimeException: jakarta.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection to [ws://localhost:9000/ws] failed
2024-05-10 19:04:44     at org.eclipse.dirigible.components.terminal.client.TerminalWebsocketClientEndpoint.<init>(TerminalWebsocketClientEndpoint.java:53) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
2024-05-10 19:04:44     at org.eclipse.dirigible.components.terminal.endpoint.TerminalWebsocketHandler.startClientWebsocket(TerminalWebsocketHandler.java:173) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
2024-05-10 19:04:44     at org.eclipse.dirigible.components.terminal.endpoint.TerminalWebsocketHandler.afterConnectionEstablished(TerminalWebsocketHandler.java:78) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
2024-05-10 19:04:44     at org.springframework.web.socket.handler.WebSocketHandlerDecorator.afterConnectionEstablished(WebSocketHandlerDecorator.java:70) ~[spring-websocket-6.1.6.jar!/:6.1.6]
2024-05-10 19:04:44     at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.afterConnectionEstablished(LoggingWebSocketHandlerDecorator.java:48) ~[spring-websocket-6.1.6.jar!/:6.1.6]
2024-05-10 19:04:44     at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.afterConnectionEstablished(ExceptionWebSocketHandlerDecorator.java:48) ~[spring-websocket-6.1.6.jar!/:6.1.6]
2024-05-10 19:04:44     at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:103) ~[spring-websocket-6.1.6.jar!/:6.1.6]
2024-05-10 19:04:44     at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:131) ~[tomcat-embed-websocket-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:938) ~[tomcat-embed-core-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) ~[tomcat-embed-core-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) ~[tomcat-embed-core-10.1.20.jar!/:na]
2024-05-10 19:04:44     at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
2024-05-10 19:04:44 Caused by: jakarta.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection to [ws://localhost:9000/ws] failed
2024-05-10 19:04:44     at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServerRecursive(WsWebSocketContainer.java:429) ~[tomcat-embed-websocket-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:123) ~[tomcat-embed-websocket-10.1.20.jar!/:na]
2024-05-10 19:04:44     at org.eclipse.dirigible.components.terminal.client.TerminalWebsocketClientEndpoint.<init>(TerminalWebsocketClientEndpoint.java:51) ~[dirigible-components-ide-terminal-11.0.0-SNAPSHOT.jar!/:na]
2024-05-10 19:04:44     ... 14 common frames omitted
2024-05-10 19:04:44 Caused by: java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused
2024-05-10 19:04:44     at java.base/sun.nio.ch.PendingFuture.get(PendingFuture.java:200) ~[na:na]
2024-05-10 19:04:44     at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServerRecursive(WsWebSocketContainer.java:318) ~[tomcat-embed-websocket-10.1.20.jar!/:na]
2024-05-10 19:04:44     ... 16 common frames omitted
2024-05-10 19:04:44 Caused by: java.net.ConnectException: Connection refused
2024-05-10 19:04:44     at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method) ~[na:na]
2024-05-10 19:04:44     at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:256) ~[na:na]
2024-05-10 19:04:44     at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:202) ~[na:na]
2024-05-10 19:04:44     at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:217) ~[na:na]
2024-05-10 19:04:44     at java.base/sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:305) ~[na:na]
2024-05-10 19:04:44     ... 1 common frames omitted

I guess we should install in the Docker image a ttyd version that we now works with the Terminal. Also we can create a *.js/*.ts service that starts the ttyd.sh once the user opens the Terminal perspective. Also it could check whether the DIRIGIBLE_TERMINAL_ENABLED environment variable is set to true, before running the ttyd.sh: https://github.com/eclipse/dirigible/blob/05311a534e158bfe01214abac5f377ffe3b5f40a/build/application/src/main/resources/application.properties#L29

@delchev What do you think about it?