Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, April 16, 2013

Run multiple instances of JBoss AS7 on the same machine (Mac + Linux)

NOTE: This tutorial assumes you have a working JBoss server running on port 8080.

1. Copy your existing JBOSS directory and rename it to jboss_maint (or something similar)

2. Go inside the jboss_maint/standalone/standalone.xml file. Find the <management-interface> element in the files. It looks something like the followings:

<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.https.port:9999}"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.https.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> 
As you can see above, the public interface is being used as the default interface (In case you are interested, the definition of the public interface resides in <interface> element inside the same file).

Since we are using the same IP address for both maintenance and development servers, we only need to offset all ports to 100. You can achieve this via changing the port-offset attribute of <socket-binding-group> property:

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:100}">
Save the changes, go inside your jboss_maint/bin directory:

cd server/jboss_maint/bin
Start up your new server:
./standalone.sh

Now you should be able to browse to localhost:8180 and see the index page of JBOSS AS7. (Remember that 8080 plus the preset offset value (100) equals 8180).

Thursday, July 26, 2012

Apache ActiveMQ 5 Installation Guide for Ubuntu 11.10

If you are not familiar with Apache ActiveMQ, you better start with my previous post: Introduction: JMS (with) Spring and Apache ActiveMQ.

As I was installing Apache ActiveMQ on my Ubuntu 11.10 machine, I encountered a strange problem. If you go and read the official Installation Guide, it should be relatively easy to start ActiveMQ with the following commands after you download it:
 
$ cd [installation_dir]/

bin/activemq

OR

[insllation_dir]$: bin/activemq > /tmp/smlog  2>&1 &;
Note: /tmp/smlog may be changed to another file name.  

However, instead of running, it generated the following error message:

Configuration of this script:
    The configuration of this script can be placed on /etc/default/activemq or /home/amir/.activemqrc.
    To use addtional configurations for running multiple instances on the same operating system
    rename or symlink script to a name matching to activemq-instance-.
    This changes the configuration location to /etc/default/activemq-instance- and
    $HOME/.activemqrc-instance-. Configuration files in /etc have higher precedence. 

The issue as I observed was that for some reason, ApacheMQ had not created any configuration file, which supposed to be in /etc/default/apachemq. Therefor after extracting the apache-activemq-x.x.x.tar.gz file, run the following command:

$ [installation_dir]: ./bin/activemq setup activemq

and after that copy that activemq configuration file into /etc/default (Root privileges needed here):
 
$[installation_dir]: sudo cp activemq /etc/default

Now just run:
 
$[installation_dir]: bin/activemq start 
 
Now ActiveMQ should be up and running on http://localhost:8161/admin/.
Note: Remember not to close the terminal which you started ActiveMQ with, as it will terminate the ActiveMQ process or run it with the following command:

nohup bin/activemq > /tmp/smlog 2>&1 &

Thursday, July 19, 2012

Apache Maven 2.2.1 issues with Ubuntu 11.10

If you are running Maven 2.2.1 (older but latest stable version) and by chance you are still on Ubuntu 11.10 with OpenJDK6, you might run into some issues.

Firstly, remember that it is recommended that you define your environment variables under /etc/environment. Secondly, it is also recommended that you avoid using OpenJDK6. It is understandable that installing it is more easy and convenient, however you will have definitely problems while building your package with
mvn package
command (if not while generating your Maven skeleton).

If you have hit the problem and scrolled to the info section, it claims that you have not set your JAVA_HOME environment variable correctly. What you just need to do is to download the Official JDK6, then extract it to any folder you like and point $JAVA_HOME environment variable to that.

It will work just fine after that!