ZooKeeper Starting on Incorrect Port - java

I am trying to start a zookeeper server from a a Java code withing a webapp. But somehow I see that it is trying to start on the Tomcat port rather than the port provided in the properties file.
I keep seeing this:
WARN | o.e.j.s.ServletContextHandler#269d82e2{/,null,UNAVAILABLE} contextPath ends with /*
WARN | Empty contextPath
StartZooKeeperServer EXCEPTION: org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands
org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands
at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:107)
at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:138)
But I have the clientPort set in the properties as 2182.
If you need any more information please do let me know.

The problem is not with the Zookeeper server but with the Admin Server.
Admin Server binds by default to port 8080. However, this port is allocated in your system so this exception is thrown.
You can add the following property to your zookeeper configuration:
admin.serverPort=9876 (any port other than 8080)
You can even disable this server if you do not need it using:
admin.enableServer=false
More information on the Zookeeper admin server:
https://zookeeper.apache.org/doc/r3.6.1/zookeeperAdmin.html#sc_adminserver

Related

Not able to access keycloak on kubernetes

I am facing a weird issue, my keycloak is running successfully in minikube but at the same time I am not able to access by port forwarding to 8080. I wanted my own spi to be deployed so created a new docker image file as shown below.
FROM jboss/keycloak:latest
ADD common-keycloak-spi-0.1.jar /opt/jboss/keycloak/standalone/deployments/
ENTRYPOINT ["/usr/bin/env"]
CMD ["sh","/opt/jboss/tools/docker-entrypoint.sh"]
Now this runs fine in docker container but when I am trying to depoloy it on kubernetes I am unable to access the service by using port forwading.
vipul#vipul-Latitude-5530:~/Downloads$ kubectl port-forward springdoc-64f8dbf547-xrqcl 8080:8080
Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080
Handling connection for 8080
Handling connection for 8080
E0216 15:24:29.872454 24829 portforward.go:407] an error occurred forwarding 8080 -> 8080: error forwarding port 8080 to pod 5ad97759ea56d8d9acbeecc9dc3cda33bdb0ff138b5c126de37cb7bad985b74f, uid : exit status 1: 2023/02/16 09:54:29 socat[93218] E connect(5, AF=2 127.0.0.1:8080, 16): Connection refused
E0216 15:24:29.873263 24829 portforward.go:233] lost connection to pod
Handling connection for 8080
E0216 15:24:29.874222 24829 portforward.go:345] error creating error stream for port 8080 -> 8080: EOF
vipul#vipul-Latitude-5530:~/Downloads$ kubectl exec springdoc-64f8dbf547-xrqcl -- /bin/bash
And also getting NONE for any port and host port in kubectl describe .
Thanks
You can check the following step to troubleshoot the issue:
Check whether the firewall is blocking the port. “netstat -anp | grep 8080”
Check the pod is configured correctly with port and host port in the config yaml file. Use thislink as a reference.
If you are using the same port configuration in Docker container and in the kubectl will not access the same port so try to check the port number.
Also you can check the blog by Ales Nosek for hostport.

Change of port number not workingin sprintboot

I changed default port number from 8080 to 8082 in application.properties file using server.port=8082. Even after changing port number, if I try to run sprint boot app, server is taking default port 8080 and application is not starting.
Error message;
Description:
Web server failed to start. Port 8080 was already in use.
Action:
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
i solved it like this
Solution
Enter 'server.port='8080' (changed port number) in the following 'application.properties' file where you can create a project.
After connecting to the terminal
Type 'sudo lsof -i :[port number you want to check]' to see which ports are running.
Delete server.port and run it again.

Run Tomcat on *:<port> instead of localhost:<port>

I am trying to access my localhost server from Parallels Desktop and facing some issues.
For example, I have an app on Spring Boot that runs on port 8081, and running sudo lsof -PiTCP -sTCP:LISTEN in Terminal gives me the following output:
java 8168 username 107u IPv6 0x53524f3d71f26ae5 0t0 TCP *:8081 (LISTEN)
And the output for second application (not Spring Boot, but Spring inside Tomcat 7) is:
java 7756 username 504u IPv6 0x53524f3d6cfe6fa5 0t0 TCP localhost:8096 (LISTEN)
I can easily access the first application from Parallels Desktop by address http://10.211.55.2:8081/, but doing the same for http://10.211.55.2:8096/ gives me this site can’t be reached error message.
So, how can I run my second application on *:8096 instead of localhost:8096?
The IP address tomcat listens in is controlled by the address attribute in the connector element in tomcat configuration file server.xml.
To listen on all addresses, set the address to 0.0.0.0:
<Connector port="8096"
address="0.0.0.0"
...other attributes.../>

How to create a domain data grid in Payara Server with domain discovery mode?

I want to create a Domain Data Grid in Payara Server 5.191 with Domain Discovery Mode, where each node discovers each other by knowing the node IP address and port. According to the documentation, the nodes are configured in the domain.xml. However, I couldn't find anything on how to exactly specify the nodes in the domain.xml. What is the name of the configuration option, where the nodes are specified?
It is similar to Glassfish.
Create it in the Windows Operating System
You must download the application server. enter link description here
when installed a directory is created
C:\Payara_Server
C:\Payara_Server\bin
We open shell command window
and inside the command window
C:\Payara_Server\bin ./asadmin
asadmin> create-domain --adminport 4848 domain1
Enter admin user name[Enter to accept default]>
Using port 4848 for Admin.
Default port 8080 for HTTP Instance is in use. Using 1161
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8081 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Default port 8686 for JMX_ADMIN is in use. Using 1162
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=moonbeam.gateway.2wire.net,OU=GlassFish,O=Oracle Corp.,L=Redwood Shores,ST
California,C=US]
Domain domain1 created.
Command create-domain executed successfully.
C:\Payara_Server\glassfish\domains\domain1 created
Start the server
asadmin> start-domain domain1
link it with IDE NETBEANS

Tomcat is running on 8080 port but unable to access remotely using ip address?

I have freshly installed apache-tomcat-7.0.62 on server. It starts without any error but i am unable to access it using : -
http://IP:8080/
here IP is ip address of server.
I have also run following command : -
here is the screenshot
Thanks
Find the server.xml located under confs folder of the catalina(tomcat).
Find out Connector tag which each one indicates for one connector isntance.
If the connector comes with no address attribute(as default), so tomcat will listen for all addresses. If it has address attribute, so just remove it out, or either have another Connector to listen for the related ipv4 address.
<Connector ... address="ip_v4_addr"/>
Check tomcat spec for Connectors here.
Next make sure the port is open and allowed to be invoked by any firewall, also make sure the ip-address is valid(public and reachable), and ISP doesn't block it.
Default port for tomcat(HTTP) is 8080 and 8443 for HTTPS, maybe your ISP doesn't let you workout with non-std ports, or the firewall issue.

Categories

Resources