Failure to run commands from apache karaf client - osgi

I have downloaded apache karaf2.3.3 (on felix) on several CentOS6.4 machines. I see this issue only in a few machines. When I try to install a feature using the following commands
$KARAF_HOME/bin/start
$KARAF_HOME/bin/client "features:install myfeature"
I get the following stack trace:
WARN org.apache.sshd.client.session.ClientSessionImpl - Exception caught
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:197)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:273)
at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:44)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:690)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:664)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:653)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1124)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
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)
Looks like client fails to connect to karaf. Firewall is shutdown on all of the machines. Anyone knows why this could be failing? The feature gets happily installed if run karaf in console mode with /bin/karaf and type in the same command

My guess is that the port you defined for the remote Karaf console was already in use by another application before the Karaf installation. As such the wrong application accepts the link, cannot make anything of the data and resets the connection. I would suggest to stop Karaf, check with netstat or via telnet localhost <port> whether the port Karaf is configured to listen on is already in use, and find the related application. As an alternative, you can configure Karaf to use a different (not used) port. See for example this page

Related

Failed to obtain Jenkins slave

In my scenario Jenkins master is available in Linux machine and i can access this in my Local windows machine also.
I created one windows slave using launch method as "Launch agent by connecting to the master".As per guidelines , i created one folder in my windows and i pasted that slave and agent jars in that folder.
While I am trying to run the slave-agent i am getting error like below. (Screenshot attached)
I tried with 2nd option as well i.e i took the provided command in Jenkins slave and i pasted that into command. again it is giving failed to connect error message. Please find below error message.
I am new to this configuration.
Do i need provide my slave machine ip into the master machine or do i need to install any other things related to this. can someone please help me out.
Failed to obtain http://ip:7394839:computer/winslave1/slave-agent.jnlp?encrypt=true
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown....etc
Slave-agent error
Issue resolved. In my case whenever we are creating new slave it is generating new IP which is not having server. Here just we are creating another node for the existing server.
Whenever we are launching the slave using agent.jar with the slave IP we are getting timed out error. Instead of going with slave IP if we go with master IP , agent is launching successfully.
Please find below example.
If i try with slave IP(Below IP)
java -jar D:\Jenkins\agent.jar -jnlpUrl we are getting error
http://120.231.140:8080/computer/My_slave_node_name_Windows10/slave-agent.jnlp -secret anHexadecimal_Long_Number5d094b1f577bc772b65b7277ac57 -workDir "D:\Jenkins"
Below IP is master IP. Agent launched successfully.
java -jar D:\Jenkins\agent.jar -jnlpUrl http://120.241.141:8080/computer/My_slave_node_name_Windows10/slave-agent.jnlp -secret anHexadecimal_Long_Number5d094b1f577bc772b65b7277ac57 -workDir "D:\Jenkins"
There is change in IP for slave and master. If i launch the slave ip from the cmd we are getting a timed out error.
The other three possibilities are
Whitelist slave IP in master Instance security groups level(all traffic or required ports).
By default windows server will block with IE security settings so diable by following below.
"Enter Server Manager in Windows search to start Server manager application. Select Local Server. Navigate to the IE Enhanced Security Configuration property, select the current setting to open the property page, select the Off option button for the desired users, and then select OK"
Configure a port number for TCP JNLP connection and whitelist it on instance security groups.
Manage Jenkins > Configure Global Security > Enable security > TCP port for JNLP agents: Fixed.

Bluemix Docker Container deployment results in "No route to host"

we are deploying a docker-image using this command:
cf ic run -p 8080 -m 512 -e SPRING_PROFILES_ACTIVE=test -e logging.config=classpath:logback-docker-test.xml --name <container-name> registry.eu-gb.bluemix.net/<repository_name>/<container-name>:latest
Within that container we are starting a Java8 Spring-Boot application that uses a connection-pooling provider. The connection-pooling provider connects to an existing PostgreSQL-Database that is accessible on the standard port. We do not use any domain name to connect to PostgreSQL-Database. We only use the IP-Address and the standard postgresql port.
The deployment is working on a machine that uses the standard Docker container daemon and is also working on Amazon WebServices (AWS) without any problems and using the same deployment mechanism.
However, if we are deploying the image to the Bluemix-Container-Service we do get the following error at startup of the spring-boot application:
Caused by: java.net.NoRouteToHostException: No route to host
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.postgresql.core.PGStream.<init>(PGStream.java:61)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:129)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:146)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:35)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)
at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:47)
at org.postgresql.jdbc42.AbstractJdbc42Connection.<init>(AbstractJdbc42Connection.java:21)
at org.postgresql.jdbc42.Jdbc42Connection.<init>(Jdbc42Connection.java:28)
at org.postgresql.Driver.makeConnection(Driver.java:415)
at org.postgresql.Driver.access$100(Driver.java:47)
at org.postgresql.Driver$ConnectThread.run(Driver.java:325)
... 1 more
We don't know why this happens, because if we do a telnet on another Bluemix-Docker-Machine to the PostgreSQL-Database server with the desired port everything is fine.
This is very annoying, since we cannot use this Docker-Image on Bluemix currently and is currently obstructing our planned roll-out.
Can you help us with details what might be wrong and how can fix this?
Any help will be appreciated.
Regards,
Christian
Is this error raised when the container is starting up?
If so, the Docker/IBM Containers on Bluemix take about between 30 up to 60 seconds in networking status: during this phase the container is not able to connect to the network.
It should be really probably the root cause of the error you are getting: if the Java SpringBoot application is trying to connect to the PostgreSQL database when the container is still in networking phase, it will fail with this error.
You should start your application running on the container when the container has completed the networking phase (for example through a bash script that checks the availability of the PostgreSQL server, or simply configure your springboot to manage this exception)
Official bluemix support gave the hint to wait for 120 seconds before starting the Java-Application that needs network access. The suggested way is:
CMD ["/bin/sh", "-c", "sleep 120; exec java $JVM_ARGS -cp /app org.springframework.boot.loader.JarLauncher --spring.main.show_banner=false"]
With that we have got network access and everything is fine.

Is a local Zookeeper cluster required to run Apache Storm in local cluster mode?

I have been trying to get a local copy of Storm working, following the guide in the storm-starter repo, and this tutorial.
When trying to run a topology with mvn compile exec:java -Dstorm.topology=org.apache.storm.starter.ExclamationTopology, the output eventually continues looping & spamming:
28534 [Thread-9-SendThread(localhost:2000)] INFO o.a.s.s.o.a.z.ClientCnxn - Opening socket connection to server localhost/127.0.0.1:2000. Will not attempt to authenticate using SASL (unknown error)
28534 [Thread-9-SendThread(localhost:2000)] WARN o.a.s.s.o.a.z.ClientCnxn - Session 0x152f7728a6a0011 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_45]
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[?:1.8.0_45]
at org.apache.storm.shade.org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) ~[storm-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.shade.org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) [storm-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
It seems it is trying to connect to a local Zookeeper cluster, but I have not seen the dependency or install requirement for Zookeeper in the Storm docs or in this other tutorial.
Do I need to install Zookeeper and is this just missing from the docs? Perhaps I'm mistaken and it is looking for something else at port 2000 on my localhost? If not, what is going wrong in my local setup?
If you run locally and use LocalCluter you do not need to install Zookeeper.
If you run locally in pseudo-distributed mode (ie, start up Nimubs and Supervisor locally) and use StormSubmitter you do need to install Zookeeper locally.

"Address already in use: bind" when running Spring Boot application

I have a problem with running my sample Spring Boot Application.
When I try to run it, this error occurs:
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473)
o.apache.catalina.core.StandardService : Failed to initialize connector [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:335)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:57)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:52)
at
Is it ok the first time you run it, and run it again you get an error?
If this is the case, You need to stop service before running again.
Here is a way to stop.
Click the stop button that looks like this:
"Address already in use" means, there is already another application running on port 8080. Use your OS tools to find that process and end it, before you start your application, or let your application run on another port. If you use an embedded server in your Boot application, you can specify the following property:
server.port=8085
Of course you can choose whatever port you want.
I have a very simple solution:
As the answer above stated, when you start Spring Boot app, the PID of underneath server(Tomcat or Undertow, or whatever) will be shown in the console; you may start again the app without terminating the former one, especially when you are in debug mode, thus the error. This applies to Intellij, too.
But, if you have started again, the PID is no longer available for you because previous session output is cleared.
So, if you are using Eclipse, just close it, and open Task Manager to terminate other java.exe JVM process. Be sure that you have no other JVM-based services running which cannot be stopped. (Like Kafka server, Apache Storm, etc.)
The Tomcat instance is one of them.
Log shows that server is already started on port 8080. I faced the same problem. go to windows task manager and end process that is javaw.exe, it worked on my application.
Two possibilities
P1.Another Application is using port 8080
Solution:-
a.Stop that application and free port 8080 for your application.
b.Change your application server port, for that create a file named
application.properties in resource folder and add property
server.port = 8085
(8085 can be replaced by any port number of your choice which will not conflict with other
application server ports)
location of application.properties file
snippet of application.properties file
P2. Your application is already running
Solution
a. Pretty simple solution for this situation is stop your currently
running application and rerun it
b.If you want to run multiple instances of your application then keep
current application running change server port as explained above and
run the application the new instance will run of another port.
Even I faced this issue u can just stop the application(there is a stop button on the top toolbar) and restart again it worked for me and I used STS
In the Eclipse situation, check if there are items running in the window "Progress"(Windows > Show View > Progress)
Stop the running process, which might be locking your desired port.
Got the same error.
The springboot application has inbuilt tomcat server which runs on port 8080..if you have any other process currently running on port 8080,The java.net.BindException will raise..so kill the processes which are using 8080 thorugh cmd as follows:
-->
open command prompt as Administrator.
--> netstat -ano | findstr :<PORT>
netstat -ano | findstr :8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 10568
TCP [::]:8080 [::]:0 LISTENING 10568
-->taskkill /PID <PID> /F
taskkill /PID 10568 /F
Now if you want recheck your running process by using netstat -ano | findstr :8080 command..
and again restart or rerun our application..
This is for first ever time you wanted to run springboot application.
Hope this might be helpfull,worked for me :)
Second case:
In the first time you run ok right? and run again it got an error? If right, You need stop service before run again..if it is the case follow #Sang9xpro
answer above.
Seems your server is already up. If you are using linux based system, type following command in terminal to check which port is active on your system.
"ps -ef | grep 8080"(or whatever port is mentioned)
Now you need to kill this one if you wish to run the server on same port.
kill -9 8080
Voilla!! Try booting your application once again and it will work.
Extra:
You'll come to me complaining an important application is already listening on mentioned port(8080) and you do not want to kill it. No probs.
Create an application.properties file inside your resource folder and change port to whatever you like.
server.port = 8081
Voilla!! You did it!! :)
Let me know if further clarifications required.
This is because you have run the spring boot application once in your eclipse IDE and closed the application and you assume that the embedded server is stopped. But it is not the case. Even after you closed your application in Eclipse -> Console window, embedded tomcat server is running. What you can do is, run your spring boot application again and look at the console messages. Immediately after Spring Logo, you can find Starting on with PID 16676. This is the PID you need to search in "Wndows Task Manager -> Processes -> PID". Select that process and "End Task". Now if you start your spring boot application, it will start without issues.

what port can use on OpenShift for org.apache.felix.shell.remote?

I would like to use bot web admin and gogo command line interface for Felix on OpenShift.
I can get web admin working, but to log into a running felix I need the remote shell.
I start felix with:
java -Dosgi.shell.telnet.port=15000 -Dorg.ops4j.pax.web.listening.addresses=127.7.77.1 -jar bin/felix.jar
and it throws:
ERROR: Bundle org.apache.felix.shell.remote [7] Error starting file:/var/lib/openshift/xxxxx/app-root/runtime/repo/osgi/felix-framework-4.4.1/bundle/org.apache.felix.shell.remote-1.1.2.jar (org.osgi.framework.BundleException: Activator start error in bundle org.apache.felix.shell.remote [7].)
java.net.BindException: Permission denied
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
Any idea how I can get that to work?
Thank you.
There are four externally available ports for your OpenShift Online application. Two web ports 80 (http)/ 443 (https), and two websocket ports 8000 (ws)/8443 (wss).
From the looks of your command you're trying to connect to 15000 which will result in the
java.net.BindException: Permission denied error
You could try replacing your port=15000 and listening.addresses= with the proper OpenShift Environment variables (see https://developers.openshift.com/en/managing-environment-variables.html for more information)

Resources