Can't connect to CLI jboss 7.1.1.FINAL in Ubuntu - jboss7.x

I can't connect to CLI Jboss 7.1.1.FINAL in Ubuntu, i wonder why?
in console i put :
mastervodoo#vodoo-Studio-1558:/opt/jboss-as-7.1.1.Final/bin$ ./jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
The controller is not available at localhost:9999
[disconnected /] connect 127.0.0.1
The controller is not available at 127.0.0.1:9999
[disconnected /] connect 127.0.1.1
The controller is not available at 127.0.1.1:9999
[disconnected /] connect 192.168.1.33
The controller is not available at 192.168.1.33:9999
[disconnected /]
is a standalone configuration, why i cannot enter?

Check your XML configuration, e.g. standalone.xml or domain.xml, and look <interfaces/> section. Make sure you're binding to 127.0.0.1 for the management interface. Also have a look at your management-native port in the <socket-binding/> section and make sure it's set to 9999. These are the defaults.
It should look something like the following:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
...
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
...
</socket-binding-group>
You could also pass properties to change the values if the expression values are being used.
$JBOSS_HOME/bin/standalone.sh -Djboss.bind.address.management=127.0.0.1 -Djboss.management.native.port=9999
If it's still not connecting it's likely a local issue. Most likely a firewall getting in the way or possibly you don't have localhost set-up in your hosts.

Check your hosts file!
/etc/hosts
Your localhost must be specified as 127.0.0.1.

In case your jboss instance is not binding to 127.0.0.1, you may use --controller option as follows:
./jboss-cli.sh --controller=YOUR_IP:9999

Just for the next guy to stumble on this, if you're on Mac, THIS will solve it:
http://saltnlight5.blogspot.com.au/2012/07/getting-jboss-clish-to-work-on-macosx.html
In case link goes down:
Start the server with: bin/standalone.sh -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.KQueueSelectorProvider
On the client side, first run: export JAVA_OPTS="-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.KQueueSelectorProvider"
Then run bin/jboss-cli.sh --connect
You should now be connected!

To me this happen due to JBoss being under heavy load while processing an erroneous task which caused Hibernate exceptions at a high rate.
I managed to connect after ~20 retries, after which I couldn't connect again.

Related

WildFly 10 How to configure slave hosts to connect to domain using HTTPS

Small question about WildFly 10 domain mode and HTTPS.
My host-master.xml parameters:
<management>
<security-realms>
<security-realm name="ManagementRealm">
<server-identities>
<ssl>
<keystore path="..." relative-to="jboss.domain.config.dir" keystore-password="..." alias="..." key-password="..." generate-self-signed-certificate-host="localhost"/>
</ssl>
</server-identities>
<authentication>
<local default-user="$local" skip-group-loading="true"/>
<properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
</authentication>
<authorization map-groups-to-roles="false">
<properties path="mgmt-groups.properties" relative-to="jboss.domain.config.dir"/>
</authorization>
</security-realm>
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket interface="management" port="${jboss.management.native.port:9999}"/>
</native-interface>
<http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
<socket interface="management" secure-port="${jboss.management.http.port:9990}"/>
</http-interface>
</management-interfaces>
My host-slave.xml parameters:
<security-realms>
<security-realm name="SlaveRealm">
<server-identities>
<secret value="..." />
</server-identities>
<domain-controller>
<remote protocol="remote" host="..." port="9999" username='slave' security-realm="SlaveRealm"/>
</domain-controller>
Domain server starts without any errors and Management conole is available by HTTPS.
But the slave node will not start and I receive an error message:
2017-02-23 17:35:05,149 WARN [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0001: Could not connect to remote domain controller remote://...:9999 -- java.lang.IllegalStateException: WFLYHC0110: Unable to connect due to SSL failure.
2017-02-23 17:35:05,149 WARN [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0147: No domain controller discovery options remain.
2017-02-23 17:35:05,150 ERROR [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0002: Could not connect to master. Aborting. Error was: java.lang.IllegalStateException: WFLYHC0120: Tried all domain controller discovery option(s) but unable to connect
2017-02-23 17:35:05,150 FATAL [org.jboss.as.host.controller] (Controller Boot Thread) WFLYHC0178: Aborting with exit code 99
I've tried to add "<server-identities><ssl><keystore..." part to "SlaveRealm" in host-slave.xml but recieve the same error.
How to configure domain and host-slave properly and simple? Thank you.
In the host.xml you have to specify <interfaces>. You can also pass interfaces values as command line argument while starting wildfly.
Master's host.xml
<interfaces>
<interface name="management">
<inet-address value="${wildfly.bind.address.management:##master.host.name##}"/>
</interface>
<interface name="public">
<inet-address value="${wildfly.bind.address:##master.host.name##}"/>
</interface>
<interface name="unsecure">
<!-- Used for IIOP sockets in the standard configuration.
To secure JacORB you need to setup SSL -->
<inet-address value="${wildfly.bind.address.unsecure:##master.host.name##}"/>
</interface>
</interfaces>
Slave host.xml
<management>
<security-realms>
<security-realm name="ManagementRealm">
<server-identities>
<secret value="##slave.encrypted.password##" />
</server-identities>
....
....
....
<domain-controller>
<!--<local/>-->
<!-- Alternative remote domain controller configuration with a host and port -->
<remote protocol="remote" host="##master.host.name##" port="9999" username="##slave.account.name##" security-realm="ManagementRealm"/>
</domain-controller>
<interfaces>
<interface name="management">
<inet-address value="${wildfly.bind.address.management:##slave.host.name##}"/>
</interface>
<interface name="public">
<inet-address value="${wildfly.bind.address:##slave.host.name##}"/>
</interface>
<interface name="unsecure">
<!-- Used for IIOP sockets in the standard configuration.
To secure JacORB you need to setup SSL -->
<inet-address value="${wildfly.bind.address.unsecure:##slave.host.name##}"/>
</interface>
</interfaces>
This configuration works for our Dev/QA/Production environments.

How to run Domain Controller and Host Controller in single machine in jboss7?

I have single machine with single IP address(192.168.1.3) . I copied domain directory as host1.
Changed domain.xml , host.xml to differentiate between domain controller and host controller . Now i have to run both domain controller and host controller in the single machine on single ip address , how can i make this configuration ? Could you suggest what other changes i have to make ?
Download EAP installer. Extract it. Make two copies of domain directories node1 and node2. Then execute these commands:
cd $JBOSS_HOME
cp -r ./domain ./node1
cp -r ./domain ./node2
To start this domain instances, you just have to change native port and management port in host.xml.
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket interface="management" port="${jboss.management.native.port:10999}"/>
</native-interface>
<http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
<socket interface="management" port="${jboss.management.http.port:10990}"/>
</http-interface>
</management-interfaces>
or you can mention them at runtime like:
./bin/domain.sh -Djboss.domain.base.dir=./node1/ -Djboss.bind.address=192.168.1.3 -Djboss.bind.address.management=192.168.1.3 <REST_OF_PARAMATERS>
./bin/domain.sh -Djboss.domain.base.dir=./node2/ -Djboss.bind.address=192.168.1.3 -Djboss.bind.address.management=192.168.1.3 -Djboss.management.native.port=10999 -Djboss.management.http.port=10990 <REST_OF_PARAMATERS>
Also you need to make sure that the servers defined in host.xml must have different port offsets for 'node1 domain' and 'node2 domain'.
Otherwise you would get an
java.net.BindException: Address already in use
error.

Wildfly 10 not load balancing to other host

I followed these instructions from Stuart Douglas video to enable Wildfly to balance request without the need of apache + mod_cluster, feature that is available since Wildfly 9.
It worked like in the video. But then, instead of adding the 3rd backend server to the same host, I created another host and added the backend3 server to it, which was also added to the backend-servers group.
So I had the following layout:
Server one (host controller and load balancer):
Backend1
Backend2
Server two (slave):
Backend3
I started the 2nd host as a slave and I could access the clustering-demo using its ip and the backend3 port. Besides, the host controller was able to register the slave:
[Host Controller] 10:05:52,198 INFO [org.jboss.as.domain.controller] (Host Controller Service Threads - 56) WFLYHC0019: Registered remote slave host "srv217", JBoss WildFly Full 10.0.0.Final (WildFly 2.0.10.Final)
However, when I accessed the main server, the load was still being balanced only to backend1 and backend2.
I tried to stop both and let only backend3 started, but then I couldn't access clustering-demo through the load balancer anymore.
Anyone know if an addicional configuration is required for the load balancer to work with a slave host?
EDIT:
I'm adding my host controller and slave log.
Host controller: http://pastebin.com/nyaDiPzS
Slave: http://pastebin.com/kMS72E4U
These lines caught my attention:
[Server:backend2] 08:56:58,956 INFO [org.infinispan.CLUSTER] (remote-thread--p7-t1) ISPN000310: Starting cluster-wide rebalance for cache clustering-demo.war, topology CacheTopology{id=1, rebalanceId=1, currentCH=DefaultConsistentHash{ns=80, owners = (1)[master:backend2: 80+0]}, pendingCH=DefaultConsistentHash{ns=80, owners = (2)[master:backend2: 40+40, master:backend1: 40+40]}, unionCH=null, actualMembers=[master:backend2, master:backend1]}
[Server:backend2] 08:56:59,023 INFO [org.infinispan.CLUSTER] (remote-thread--p7-t1) ISPN000310: Starting cluster-wide rebalance for cache routing, topology CacheTopology{id=1, rebalanceId=1, currentCH=DefaultConsistentHash{ns=80, owners = (1)[master:backend2: 80+0]}, pendingCH=DefaultConsistentHash{ns=80, owners = (2)[master:backend2: 40+40, master:backend1: 40+40]}, unionCH=null, actualMembers=[master:backend2, master:backend1]}
[Server:backend2] 08:56:59,376 INFO [org.infinispan.CLUSTER] (remote-thread--p7-t2) ISPN000336: Finished cluster-wide rebalance for cache clustering-demo.war, topology id = 1
It seems to confirm that slave:backend3 is not detected.
Change on your slave host default interface addresses to be visible for the master.
ie:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address}"/>
</interface>
<interface name="private">
<inet-address value="${jboss.bind.address}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address}"/>
</interface>
</interfaces>
where jboss.bind.address is a real IP of slave host.
And do the same on master host.
I am heaving the same issue.My master and slaves log output looks exactly the same.
I followed the video tutorial and the related project on GitHub: https://github.com/stuartwdouglas/modcluster-example
I have set all public IP addresses on the master and slave servers. The host controller registers the slaves, infinispan displays log messages for cluster rebalancing displaying the 2 slaves. But the load balancing does not work. It also appears that the session replication also does not work, despit the fact that infinispan displays all slaves as members of the cluster.
If I repeat the steps as described in the above mentioned GitHub project on a single machine, that is all servers are on the same IP, but on different ports - everything works.
I also found this: http://wildfly9.blogspot.bg/2015/10/wildfly-9-reverse-proxy-config-with.html?m=1, where he mentions adding the public IP addresses as default-host aliases. Did that too and still it is not working.
Can someone point us in the right direction. I presume it is something small, but substantial that is missing from the documentation and there is no adequate demo/tutorial on the net that demonstrated the set-up when all the slaves and the load balancer reside on different hosts (different IP addresses).

JBoss - how programatically check values from standalone.xml?

Does anyone know how to check in runtime from code if configuration has defined e.g. 'any-address' tag?
...
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<any-address/>
</interface>
</interfaces>
...
For "jboss.bind.address" i can get system property - but what in "any-address" case?
You can try to run a co-located management client from within your application.

How to deploy an application over the internet with JBoss AS 7

I am using JBoss 7 AS. I am deploying the projects via the linux box by the cmd like so
bin/standalone.sh -b [ipaddress]
This works fine only when i am on the network, however it doesn't work when i'm outside the network or over the internet.
How do i launch it so people can access it over the internet?
I tried this but it doesnt work.
bin/standalone.sh -b 0.0.0.0
It says:
Google Chrome could not load the webpage because took too long to respond. The website may be down, or you may be experiencing issues with your Internet connection.
Your first step is to understand and configure your interface and port bindings. Before we get to that, it should be clarified that the -b runtime switch has been active since JBoss AS7.0.2, but wasn't present in previous releases of AS 7. Refer to the following link for more information via the JBoss Application Server 7 community forums.
https://community.jboss.org/thread/168789
For your question, you will need to consider both the interface and the port attribute of the socket binding group. Assuming that you're using the standalone instance, you can find the socket binding groups declared in the standalone.xml configuration file as follows.
Socket Groups and Port Bindings
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
<socket-binding name="ajp" port="8009"/>
<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8443"/>
<socket-binding name="osgi-http" interface="management" port="8090"/>
<socket-binding name="remoting" port="4447"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
You can see that the http connector is bound to port 8080, and you can also see that the management API port bindings are bound to java tokens. These are values that you can override (hence the "${thing:value}" syntax), but you lose the power to override them if you hardcode them. This is relevant because the default interface is a java token, allowing you to use the -b switch to override it.
Interfaces
Here's the default public interface in the standalone.xml file. The word "public" is just a relative handle. You can "call" it anything that you want, just as long as it means something to you and you can associate server groups and socket bindings to it later. This is a great feature of AS 7, allowing you to declare a set of attributes in one element, and inherit their attributes elsewhere by referencing that element name.
The following example allows you to reference the public interface elsewhere without needing to know what the actual Inet Address value is.
<interfaces>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
Getting Gooey
You can change these values either via the Management CLI or the Management Console (keeping with the workflow guidance that it's better to use the Management APIs and leave the XML alone). Like most GUIs, Management Console is the easiest to jump into first. Here's the socket binding screen. Notice that there's only really one "socket binding group" in the standalone instance, in this case the standard-sockets group.
You can edit the http binding if you need, but you should also think about the interface that you are using to connect to the internet. I'm going to assume that you have set up your webserver to suit your needs (which is probably more a question for apache than JBoss). Here's the console view for interface settings.
This shows the public interface that the standard-sockets binding group is relating itself to in the config file. Advanced configurations can use the Advanced section to create ordered conditions for partitioning traffic. You can even enable the <any-address/> element that is described in the first link I posted above.
From these two screens, you should be able to configure the required interface and port bindings to expose your application to the internet.
The binding -b 0.0.0.0 does not work in JBoss AS7. Instead you have to configure the interfaces in standalone/configuration/standalone.xml.
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:<your-public-ip>}"/>
</interface>
</interfaces>
As I cannot comment to drri's answer, I'm adding a note as an answer.
When you configure more port bindings, you have also to add a connector to it inside
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
in following way:
when you add binding named some-binding on port 10000, you specify it like:
<socket-binding name="some-binding" port="10000"/>
and then you add a connector accordingly:
<connector name="some-binding" protocol="HTTP/1.1" scheme="http" socket-binding="some-binding"/>