Check/connect to Redis running within docker from Java(Spring Boot) or Node.js - node.js

I quick started with Redis on Windows PC with
docker run -p 6379:6379 redis
(Redis does not have Windows distribution, fork for Windows is not the latest version )
1:C 10 Sep 08:17:03.635 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.3 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 1
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
...
1:M 10 Sep 08:17:03.644 * The server is now ready to accept connections on port 6379
Then however I can't connect from Spring Boot app. With application.properties like
spring.redis.host=localhost
spring.redis.port=6379
got error
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
at redis.clients.jedis.Connection.connect(Connection.java:164) ~[jedis-2.8.2.jar:na]
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:80) ~[jedis-2.8.2.jar:na]
at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1677) ~[jedis-2.8.2.jar:na]
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:87) ~[jedis-2.8.2.jar:na]
at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868) ~[commons-pool2-2.4.2.jar:2.4.2]
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435) ~[commons-pool2-2.4.2.jar:2.4.2]
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363) ~[commons-pool2-2.4.2.jar:2.4.2]
at redis.clients.util.Pool.getResource(Pool.java:49) ~[jedis-2.8.2.jar:na]
... 23 common frames omitted
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_45]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_45]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) ~[na:1.8.0_45]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_45]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_45]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_45]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_45]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_45]
at redis.clients.jedis.Connection.connect(Connection.java:158) ~[jedis-2.8.2.jar:na]
... 30 common frames omitted
When trying to use Node.js with node_redis example,
I got
Error Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED

As you mentioned (in the comments), redis bundled their image with protected-mode set to yes (see here).
How to go around protected-mode
1) Disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent.
2) Alternatively you can disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server.
3) If you started the server manually (perhaps for testing), restart it with the '--protected-mode no' option.
4) Setup a bind address or an authentication password.
source: redis-github
Build your own image
You could create your own image by pulling redis's and ADDing your own redis.conf to the image ?
Or update the start command in the Dockerfile to disable protected-mode: CMD [ "redis-server", "--protected-mode", "no" ]
You can also take a look at this Dockerfile which contains the modification suggested above (last line): https://github.com/docker-library/redis/blob/23b10607ef1810379d16664bcdb43723aa007266/3.2/Dockerfile
This Dockerfile is provided in a Redis issue on github, it replaces the startup command with CMD [ "redis-server", "--protected-mode", "no" ].
You could just download this Dockerfile and type:
$ docker build -t redis-unprotected:latest .
$ docker run -p 6379:6379 redis-unprotected

Ran into a similar problem today.
Using the redis container's IP address for the JedisConnectionFactory solved the issue for me.
Docker command:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' some-redis-instance

Thanks to Alex answer and comment in https://github.com/docker-library/redis/issues/74
I was able to connect to the Redis using full IP 192.168.99.100:6379
Note that latest 3.2 image has protected mode disabled
https://github.com/docker-library/redis/issues/75

Related

WebSphere v7.0 doesn't start CREATE_LISTENER_FAILED_4

I work with WebSphere v7.0. When I tried to start the server, I get the following error on the console.
[26/08/19 10:02:35:224 CEST] 00000000 WsServerImpl E WSVR0009E: Se ha producido un error durante el inicio
com.ibm.ws.exception.RuntimeError: org.omg.CORBA.INTERNAL: CREATE_LISTENER_FAILED_4 vmcid: 0x49421000 minor code: 56 completed: No
at com.ibm.ws.runtime.component.ORBImpl.start(ORBImpl.java:439)
at com.ibm.ws.runtime.component.ContainerHelper.startComponents(ContainerHelper.java:538)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:627)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:618)
at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:502)
at com.ibm.ws.runtime.WsServerImpl.bootServerContainer(WsServerImpl.java:298)
at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:214)
at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:666)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:213)
at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:93)
at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:74)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
at org.eclipse.core.launcher.Main.run(Main.java:981)
at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:341)
at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:111)
Caused by: org.omg.CORBA.INTERNAL: CREATE_LISTENER_FAILED_4 vmcid: 0x49421000 minor code: 56 completed: No
at com.ibm.ws.orbimpl.transport.WSTransport.createListener(WSTransport.java:867)
at com.ibm.ws.orbimpl.transport.WSTransport.initTransports(WSTransport.java:605)
at com.ibm.rmi.iiop.TransportManager.initTransports(TransportManager.java:157)
at com.ibm.rmi.corba.ORB.set_parameters(ORB.java:1303)
at com.ibm.CORBA.iiop.ORB.set_parameters(ORB.java:1690)
at org.omg.CORBA.ORB.init(ORB.java:364)
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:92)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:179)
at com.ibm.ejs.oa.EJSServerORBImpl.<init>(EJSServerORBImpl.java:102)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:55)
at com.ibm.ws.runtime.component.ORBImpl.start(ORBImpl.java:432)
... 29 more
[26/08/19 10:02:35:135 CEST] 00000000 FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvid
I checked the port BOOTSTRAP_ADDRESS in the file serverindex.xml
<specialEndpoints xmi:id="NamedEndPoint_1183122129640" endPointName="BOOTSTRAP_ADDRESS">
<endPoint xmi:id="EndPoint_1183122129640" host="F120000.cargas02.sir" port="2809"/>
</specialEndpoints>
The output command netstat -ano is
TCP 0.0.0.0:2809 0.0.0.0:0 LISTENING 4072
How can I fix this error?
Usually an ORB Listener Thread creation failure occurs because either:
Another process is already listening on the port in question (in this case 2809).
The ephemeral port range has been expanded on the OS such that the WebSphere server port ranges (2800 - ~10000) are now included in that range, increasing the possibility of a WAS server port number being assigned to another process as an ephemeral port.
For scenario #1: use netstat -ano or lsof -i :<port#> commands and search for the port to find the process using the port. If a conflicting process is found, change the config/port ussage of that process. Or edit the WebSphere serverindex.xml file in dmgr-profile-root/config/cells/cellName/nodes/nodename (make sure to take a backup beforehand). Change the 2809 port to another port not in use. Save and sync the changes.
For scenario #2: Check the ephemeral port range on the server box (internet search based on the OS will give specific instructions for this). Make sure the low end of the port range is sufficiently greater than the highest WebSphere server ports found in the serverindex.xml file.
Finally, it's also possible the WebSphere server did not properly shutdown and close all ports from its previous run. An OS reboot may be needed to release the port(s).

CArtAgO java.rmi.ConnectException Connection refused in a distributed environment

I am trying to connect remotely to a JaCaMo application by CArtAgO infrastructure.
In the server my jcm file is like this:
mas testsvr {
agent bob
workspace world
platform: cartago(infrastructure)
class-path: lib // java class path
asl-path: src/agt, src/agt/inc // agent source path
}
And a client application is like this:
mas testclient {
agent alice
platform: cartago()
node n1 running # 10.0.0.14
class-path: lib // java class path
asl-path: src/agt, src/agt/inc // agent source path
}
When I've run with a server listening I got the following output:
CArtAgO Http Server running on http://127.0.1.1:3273
Jason Http Server running on http://127.0.1.1:3272
Looking for rmi://10.0.0.11/cartago_node
java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:130)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
at com.sun.proxy.$Proxy6.join(Unknown Source)
at cartago.infrastructure.rmi.CartagoInfrastructureLayer.joinRemoteWorkspace(CartagoInfrastructureLayer.java:62)
at cartago.CartagoService.joinRemoteWorkspace(CartagoService.java:372)
at cartago.NodeArtifact.joinRemoteWorkspace(NodeArtifact.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cartago.ArtifactOpMethod.exec(ArtifactOpMethod.java:39)
at cartago.Artifact.doOperation(Artifact.java:407)
at cartago.Artifact.access$200(Artifact.java:32)
at cartago.Artifact$ArtifactAdapter.doOperation(Artifact.java:1275)
at cartago.WorkspaceKernel.serveOperation(WorkspaceKernel.java:1136)
at cartago.WorkspaceKernel.access$000(WorkspaceKernel.java:48)
at cartago.WorkspaceKernel$EnvironmentController.run(WorkspaceKernel.java:1477)
When I've run without a server listening the output was:
CArtAgO Http Server running on http://127.0.1.1:3273
Jason Http Server running on http://127.0.1.1:3272
java.rmi.ConnectException: Connection refused to host: 10.0.0.11; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at cartago.infrastructure.rmi.CartagoInfrastructureLayer.joinRemoteWorkspace(CartagoInfrastructureLayer.java:58)
at cartago.CartagoService.joinRemoteWorkspace(CartagoService.java:372)
at cartago.NodeArtifact.joinRemoteWorkspace(NodeArtifact.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cartago.ArtifactOpMethod.exec(ArtifactOpMethod.java:39)
at cartago.Artifact.doOperation(Artifact.java:407)
at cartago.Artifact.access$200(Artifact.java:32)
at cartago.Artifact$ArtifactAdapter.doOperation(Artifact.java:1275)
at cartago.WorkspaceKernel.serveOperation(WorkspaceKernel.java:1136)
at cartago.WorkspaceKernel.access$000(WorkspaceKernel.java:48)
at cartago.WorkspaceKernel$EnvironmentController.run(WorkspaceKernel.java:1477)
So, it shows that the client found the server but something wrong happened and the connection was refused. What is happening? Which is the default CArtAgO's connection port?
CArtAgO uses Java RMI, the default port is 20100. For LipeRMI connection the default port is 20101. Other constants can be checked in http://www.emse.fr/~boissier/enseignement/maop17-spring/doc/api/cartago-api/index.html?constant-values.html
It is suggested to leave server and client with no restrictions checking whether iptables INPUT, FORWARD and OUTPUT are showing ACCEPT for any case. You can use the following command:
$ iptables -L -v
On linux with JaCaMo application running you can see if the port 20100 was opened by the app (you can use ss or netstat). The response should be "LISTEN" for 20100 port
$ ss -tnl | grep 20100
or
$ netstat -tuplen | grep 20100
It is also necessary to have DNS working for the machines because the connection will use names. You may test it by command ping using machine names. From clients:
$ ping name_server
From server (ping clients)
$ ping name_client1
In case of no DNS server to solve names, it is necessary to edit /etc/hosts file. Considering the server named 'myserver_hostname' on ip 192.168.0.1 and client named 'myclient_hostname' on ip 192.168.0.2, the file on both machines, server and client, may be like this:
127.0.0.1 localhost
#127.0.1.1 myserver_hostname -- RMI will not use it anymore
192.168.0.1 myserver_hostname
192.168.0.2 myclient_hostname

Apache James 3 unexpectedly quits after few seconds

I always get this whenever I try to add domain
Error connecting to remote JMX agent : Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)]
usage: java org.apache.james.cli.ServerCmd --host <arg> <command>
-h,--host <arg> node hostname or ip address
-p,--port <arg> remote jmx agent port number
AddUser <username> <password>
RemoveUser <username>
ListUsers
Although I discovered that James quits some seconds after starting, I have jaxb jar file, I have put it in every lib folder there is to put.
Is there anything I am doing wrong? Am I to specify input mysql details and if so where, I can't seem to figure this out.

Getting " Cannot run program "bash"" while building chef in jenkins

I have installed chef-plugin in jenkins and did the following configurations:
Run chef client on remote host:
enabled: checked
ssh host: "remote host"
ssh login: root
chef_json template: "{
"run-list" :[
"recipe[test]"
]
}"
color output: checked
and got the following error:
Started by user swetha sreeramoju
Building in workspace C:\.jenkins\workspace\chef-sample
[2015-05-27 19:06:44 +0530] INFO: [34m[47mrendering ERB template[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [34m[47mparsing JSON string[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [34m[47msaving JSON to file[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [2m[1m[34m[47m[4mchef json url[0m[0m[0m[0m[0m[34m[47m : http://localhost:8080/jenkins//job/chef-sample/ws/chef.json[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [2m[1m[34m[47m[4mhost[0m[0m[0m[0m[0m[34m[47m : 10.0.12.209[0m[0m
$ bash -c "ssh root#10.0.12.209 sudo chef-client -l info -j http://localhost:8080/jenkins//job/chef-sample/ws/chef.json "
ERROR: Cannot run program "bash": CreateProcess error=2, The system cannot find the file specified (Java::JavaIo::IOException)
java.lang.ProcessBuilder.start(Unknown Source)
hudson.Proc$LocalProc.<init>(Proc.java:244)
hudson.Proc$LocalProc.<init>(Proc.java:216)
hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
hudson.Launcher$ProcStarter.start(Launcher.java:382)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440)
org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304)
org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:52)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:134)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:64)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
org.jruby.ast.FCallSpecialArgNode.interpret(FCallSpecialArgNode.java:45)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:64)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)
org.jruby.ast.CallOneArgFixnumNode.interpret(CallOneArgFixnumNode.java:59)
org.jruby.ast.IfNode.interpret(IfNode.java:110)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.IfNode.interpret(IfNode.java:116)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:268)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:220)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236)
org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:160)
org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:133)
org.jruby.runtime.Block.yieldSpecific(Block.java:99)
org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:196)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
org.jruby.ast.FCallOneArgBlockNode.interpret(FCallOneArgBlockNode.java:34)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:224)
org.jruby.proxy.hudson.tasks.Builder$Proxy2.perform(Unknown Source)
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764)
hudson.model.Build$BuildExecution.build(Build.java:205)
hudson.model.Build$BuildExecution.doRun(Build.java:162)
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
hudson.model.Run.execute(Run.java:1744)
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
hudson.model.ResourceController.execute(ResourceController.java:98)
hudson.model.Executor.run(Executor.java:374)
Build step 'Run chef client on remote host' marked build as failure
Finished: FAILURE
Chef client and server is running in Linux machine, and jenkins is configured in Windows7.
The problems seems a bit wider as explained here SSH+slaves+and+Cygwin:
This is because Jenkins is trying to call Windows API and execute "/bin/bash" without going through Cygwin path translation. Windows interprets /bin/bash as c:\bin\bash.exe, and unless that path exists, it will fail.
A quick solutions is to pass from a linux node.
Another quick possibility is to make an on-demand Jenkins node out of the Chef-client linux machine (a few clicks) and run there the proper shell line (although it's probably more an hack):
chef-client -l info -j http://localhost:8080/jenkins//job/chef-sample/ws/chef.json
Jenkins client and server is running in Linux machine, and jenkins is configured in Windows7.
That makes no sense.
What's "Jenkins client"? The browser that you used to connect to Jenkins? You can connect through any browser on any OS. It has no affect whatsoever on the execution. The execution happens on master/slave nodes.
"Jenkins [...] server is running in Linux". OK. But then why does your log say Building in workspace C:\.jenkins\workspace\chef-sample. Clearly it is running on Windows node. So either there is a Windows slave node that you are not mentioning, or the Jenkins server is not on Linux but on Windows.
"Jenkins is configured in Windows7". Well, that just continues to add to the confusion. Is Jenkins server running on Windows or Linux, you just said "Linux" in the previous sentence.
Your issue is that you cannot run bash in Jenkins on Windows (and everything points to that being the case here), unless you have a bash equivalent (Cygwin) installed on Windows

Jenkins SSH slave fails to create /home/<user>/jenkins

When configuring an ssh slave on Jenkins, which runs on an ec2 instance, I get the following error message when I click on the "Launch Slave Agent".
[08/06/14 18:41:46] [SSH] Opening SSH connection to ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:22.
[08/06/14 18:41:46] [SSH] Authentication successful.
[08/06/14 18:41:46] [SSH] The remote users environment is:
[08/06/14 18:41:46] [SSH] Starting sftp client.
[08/06/14 18:41:46] [SSH] SFTP failed. Copying via SCP.
[08/06/14 18:41:46] [SSH] Remote file system root /home/<user>/jenkins does not exist. Will try to create it...
Failed to create /home/<user>/jenkins
[08/06/14 18:41:46] [SSH] Copying latest slave.jar...
hudson.util.IOException2: Could not copy slave.jar into '/home/<user>/jenkins' on slave
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:967)
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:926)
at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:596)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:228)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Error during SCP transfer.
at com.trilead.ssh2.SCPClient.put(SCPClient.java:523)
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJarUsingSCP(SSHLauncher.java:965)
... 7 more
Caused by: java.io.IOException: Remote scp terminated unexpectedly.
at com.trilead.ssh2.SCPClient.readResponse(SCPClient.java:50)
at com.trilead.ssh2.SCPClient.sendBytes(SCPClient.java:140)
at com.trilead.ssh2.SCPClient.put(SCPClient.java:519)
... 8 more
[08/06/14 18:41:46] [SSH] Connection closed.
Jenkins configuration for this node is as follows :
Please note that I've set JavaPath property because Jenkins "Couldn't figure out the Java version of java" (that's the error message I was getting)
Any idea how I could fix this issue ? Thanks
I have had same issue. After reading the following post talking about new version, realized something wrong on the SSH plugin that i'm using.
So I have visited to Manage plugins --> Installed --> searched 'SSH' (disabled SSH related clients by removing selection)
Basically you need:
Disabled - SSH Slaves plugin (probably comes with Jenkins)
Added SSH plugin (version 2.4).
Which resolved the issue, that i have had and successfully connected after other setups shown in this doc from step 6, JENKINS-SETTING UP MASTER SLAVE ENVIRONMENT. ( slave.jar -jnlpUrl....)
Hope this will help someone in future.
You need to provide a valid path on the ec2 instance to which the user has an access.
I was experiencing the same thing, no environment variables
The remote users environment is:
(empty)
.
.
.
I set the home directory that i was using for a new one for the jenkins user (example: /jenkinsFolder) and enabled the shell for jenkins in /etc/passwd (it was disabled)
then I was able to see environment variables when launching the slave.

Resources