jBoss 6 (may be 7, 4 and 6 too) Cluster in a single laptop - jboss

I need to test some cluster oriented developments. Unfortunately I have just my laptop and no other PCs at hand.
I there a concrete way to setup a jBoss 6 cluster within my laptop with a single IP address?
Thanks in advance for the help.

The only problem with running two JBoss servers on one IP address is that they are set to bind to the same ports. So there are two ways how to resolve this problem.
1: Just say JBoss server to use another set of ports. You can set it when starting server.
./run.sh -Djboss.service.binding.set=ports-01
It means that all ports will be higher by 100, so for example admin console won't be on port 8080 but on 8180. Default value is ports-default and others are ports-01, ports-02 etc.
2: The second possibility is to create another virtual IP address, and bind servers to different addresses.
./run.sh -b 192.168.1.2
./run.sh -b 192.168.1.3
Also don't forget to set properly jboss.messaging.ServerPeerID parameter. So commands it will be:
./run.sh -Djboss.messaging.ServerPeerID=1
./run.sh -Djboss.service.binding.set=ports-01 -Djboss.messaging.ServerPeerID=2
or
./run.sh -b 192.168.1.2 -Djboss.messaging.ServerPeerID=1
./run.sh -b 192.168.1.3 -Djboss.messaging.ServerPeerID=2
In the same way you can configure JBoss AS5, but JBoss AS7 configuration is completely different.

I wrost case you have to use a virtual pc like VirtualBox or VMware.

This article explains how to setup a Torquebox (specialized JBoss to jruby) cluster in one machine and has info on how to create the virtual ips. Hope it helps.

Related

Consul.io - how to run multiple servers on same machine

This is probably a very basic question for you, but I'm just getting into consul and for testing purposes, I wanna run multiple servers on my PC. For example, I run the first server with
consul agent -server -bootstrap-expect=1 -dc=dev -data-dir=/tmp/consul -ui-dir="c:/consul 0.5.2/dist"
and then I try to run the second server with
consul agent -server -data-dir=/tmp/consul2 -dc=dc2
but it returns
==> Error starting agent: Failed to start Consul server: Failed to start RPC lay
er: listen tcp 0.0.0.0:8300: bind: Only one usage of each socket address (protoc
ol/network address/port) is normally permitted.
What am I missing from my command?
You are launching two consul servers using mostly default values. In this case the problem is that you use default ports.
When you read the error message you will notice that your second consul server tries to bind to port 8300. But your first server is already using this port, causing the second server to fail at startup. (note: consul binds to a variety of ports, each having another purpose and default setting. Take a look at the documentation).
As suggested by LenW, you can use Vagrant to set your environment. You could follow the consul tutorial.
If you do not want to use vagrant or set up any virtual machines on your own. You could change the defaults of the second server.
If you are trying to simulate a production topology on your dev machine I would look at using Vagrant in combination with VirtualBox to simulate a couple of machines for testing.

Why does JBoss 7.1.1 recognize localhost but not my IP address?

Centos 6.5
JBoss 7.1.1.Final
starting jboss as ./standalone.sh
When I go to localhost:8080 there is jboss, nice and happy
When I go to 192.168.111.222:8080 I get a 404 page not found error
This is problematic.
I have looked at other questions here that have advocated the following
./standalone.sh -b 0.0.0.0
This gives an error. It says the address is already in use.
I have tried
./standalone.sh -b 192.168.111.222
This doesn't work either.Same error as above. I have checked each time to see if there is another jboss process running out there and the answer is no.
I have tried modifying the jboss/standalone/configuration/standalone.xml interfaces to accept all connections. That didn't work either
No matter what I do, it always says:
Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
and going to ipaddr:8080 doesn't work, but localhost:8080 does work.
I saw one thread recommend modifying your hosts file to point your ip address at local host: I already have an entry there pointing my ip address at a domain name (which also doesn't work)
Other services on my machine work just fine, able to reach addresses whether I use localhost or specify the IP address, so this seems to be a jboss specific problem.
How do I fix this? I haven't used jboss before and I'm starting to see why.
There is probably some other process listening on port 8080. Try to find the process by
netstat -tulpn | grep 8080
You can simply change the AS7 port numbers by setting port-offset. Start JBoss AS7 like this:
./standalone.sh -b 0.0.0.0 -Djboss.socket.binding.port-offset=150
The web port will be 8230 in this case. (i.e. you'll use 192.168.111.222:8230 in the browser).

Angular app not working in IE 9 on remote server

I have a simple angular application that works just fine when deployed on my local JBoss instance, but when I deploy the same war file in our sandboxed environment (also JBoss) the application doesn't load. Just shows up as a blank page. When viewed on Chrome or FF it works fine as well.
Not a lot to go on, but any pointers in the right direction would be very helpful.
Edit: Just another piece of info, it doesn't work locally on IE either when the address contains the computer name and not localhost. So http://localhost:8080/angularapp works but http://[machinename]:8080/angularapp does not.
In the post you don't make completely clear in what environments you've the problem (it's clear it doesn't work using IE, but does it work in all cases with Chrome and FF?).
But the problem you're experiencing when trying to access using the machine name (http://machinename:8080/...), may be caused because you've not defined properly the IP bindings in the JBoss startup: by default JBoss binds only to localhost (127.0.0.1), if you want JBoss to be accessed from any other network interface, you've to define it. That can be done using the -b parameter of the startup script (run.sh for Jboss 3.x/4.x/5.x/6.x or standalone.sh if it's JBoss 7). For example:
./run.sh -b xxx.xxx.xxx.xxx (where xxx.xxx.xxx.xxx is your server IP) will make the JBoss accessible only from that IP (and its corresponding machine name, provided is correctly defined in the DNS or /etc/hosts ...), but not from localhost.
./run.sh -b 0.0.0.0 will make the JBoss accessible from all the networks interfaces of your server.

How to make JBoss accessible using IP?

My JBoss server is running in my system and trying to access it from other system using ip address of my system, but its not accessible and even from my own system i am not able to access using ip.
How can i make jboss enable using ip address.
Thanks
We can run JBoss as ./run.sh -b 127.0.0.1 or run.bat -b 127.0.0.1
This will make JBoss accessible using ip.
If the JBoss is running on your machine you can access it using this URL
http://localhost:<portnumber>
If you have started the JBoss using the command
run.bat>
then you can access the JBoss through above URL only.
If you use this command to start the JBoss :
run –b 0.0.0.0.>
then you can access the JBoss using this URL also
http://<ipaddress>:<portnumber>
In addition to this, if in place of IP address if you want to use some domain name then add that domain name
<IP address> <domain name>
into the host file at this path:
C:\WINDOWS\system32\drivers\etc>
then you can access your jboss through this url
http://<domain name>:<portnumber>
For more details you can check this blog http://tarunjain-jaintarun.blogspot.com/2012/08/acessing-jboss-using-ipaddress.html

How do you run multiple instances of JBoss 4.0 (running under Eclipse) on the same machine?

At my office we run JBoss 4.0 and use Eclipse to debug and run the JBoss server. We're deploying simple wars, nothing terribly complex. However, I haven't yet figured out how to get this version of JBoss to either allow me to run separate instances of the war (HEAD and the Branch, for example) or to run separate servers controlled by two different projects in Eclipse. Anyone know how to do this? I've searched and found nothing that addresses this specifically.
The three things you have to think about are:
Making sure that instances do not overwrite each other’s files
Making sure that the instances don’t open the same TCP ports
Determining how to shut down each instance
Create a copy of your configuration so you don't have file collisions (like when temp files are created). Then, I would recommend just binding the two configurations to different IPs on the same machine, which will avoid port conflicts. You can do something like this:
run –b 192.168.0.100 –c myconfig
run –b 192.168.0.101 –c myconfig2
If you have two network cards, this is easy. If you don't, you can setup virtual IP addresses with a loopback adapter on Windows. On Linux, you can use ifconfig.
To shut down, just make sure you specify the IP/port to shut down, like this:
shutdown –s 192.168.0.100:1099 -S
shutdown –s 192.168.0.101:1099 -S
I'm not sure how to get you going on Eclipse, but you should be able to specify those flags to the run and shutdown scripts through the configuration somehow.
We cover this topic in depth in JBoss in Action in section 15.2 - Collocating multiple application server instances.
I think you can subscribe various instances of JBoss to your eclipse installation. normal installation example
Hope it helps you