Deprecated: Assigning the return value of new by reference is deprecated in /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php on line 90

Deprecated: Assigning the return value of new by reference is deprecated in /home/techmasa/public_html/wp-content/plugins/sem-recent-posts.php on line 942

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php:90) in /home/techmasa/public_html/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 121

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php:90) in /home/techmasa/public_html/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 121
TechMasala - Technology Spice Rack » 2008 » March

Archive for March, 2008

Shell Script to Start and Stop JBoss

I was looking for a script to start and stop JBoss server on the Linux environment, but didn’t find anything that useful. I did find one for starting and stopping lighttpd server for our Rails applications and have been using it effectively. Even though I am not a shell script expert, I thought I will modify the script a bit and make use of it for JBoss. The main change that I had to make was to make the script wait until the server starts or stops. To make sure the server has successfully started, I had to tail the log file for one line until the last line contained the text “JBoss (MX MicroKernel) …….. Started”. To make sure the server stopped successfully I had to ensure the process was terminated completely. If you are in need of such a script, here it is.

Download JBoss start/stop Script

Some items you have to change in the script to work for your environment.

  • PIDFILE - File containing the process id. Change it to a location where you want to have this file.
  • STARTJBOSS - Command to start JBoss. Scan through this command in entire and make sure you have added the parameters necessary for your environment, set the minimum and maximum JVM heap, and also the server you want to start. You can get this information from the server log when you run JBoss using the run.sh script. The script assumes you have Java executable in the path.
  • LOGFILE - The server’s log file. Change it to a location where you want to have this file.

Additionally you might want to change line 32 to the right version of JBoss you are using. Make sure this line reflects exactly what you see in the server log at the end when JBoss completes starting the server. If it doesn’t match, this script will go in infinite loop.

An additional benefit I got after writing this script was to have our automated build scripts using Ant to deploy the applications on any box using the SSHExec tasks. Really cool and time saving.

Disclaimer - The script herein provided to you is “AS IS” without any warranties of any kind. The script has not been thoroughly tested under all conditions. I, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.


Deprecated: Function ereg_replace() is deprecated in /home/techmasa/public_html/wp-content/plugins/sociable/sociable.php on line 64
Blink this Shell Script to Start and Stop JBoss at blinklist.com    Bookmark Shell Script to Start and Stop JBoss at blogmarks    Bookmark Shell Script to Start and Stop JBoss at del.icio.us    Digg Shell Script to Start and Stop JBoss at Digg.com    Fark Shell Script to Start and Stop JBoss at Fark.com    Bookmark Shell Script to Start and Stop JBoss at Furl.net    Bookmark Shell Script to Start and Stop JBoss at NewsVine    Bookmark Shell Script to Start and Stop JBoss at reddit.com    Bookmark Shell Script to Start and Stop JBoss at Simpy.com    Bookmark Shell Script to Start and Stop JBoss at Spurl.net    Bookmark Shell Script to Start and Stop JBoss with wists    Bookmark Shell Script to Start and Stop JBoss at YahooMyWeb

Comments (4)      Cosmos

Foundation Stone #46 - Swim Against the Current

A river when it is a river is never stagnant. It keeps flowing. Until it reaches a pool or a greater river which then flows and reaches the ocean. A river flows until it reaches a point where water is stagnant. The definition of stagnant as I search, gives me,

  • dead(a): not circulating or flowing; “dead air”; “dead water”; “stagnant water”
  • not growing or changing; without force or vitality

If you look at it from a career perspective, it is easy to get into being stagnant. One doesn’t need to do anything beyond what he is expected. The person will be in the flow but at a point will become stagnant, in more business terms a commodity. You are no more worth than millions of others who are in the pool. Standing out or being uniquely recognized and becoming successful is to swim against the commodity pool. As you keep moving against, you will raise to a lesser commodity pool.

Gangotri GlacierTaking the same analogy of a river, if I have to take the example of river Ganges, it has many tributaries flowing through many cities North East India until it reaches the Ganges Delta and flows into the Bay of Bengal, north eastern part of the Indian Ocean. But the source of Ganges is a 19 mile stretch glacier in the Himalayas called the Gangotri glacier. The origin of yet another major river in India called Cauvery is Talakavery, which is a spring. The source of any river is unique and distinct.

To reach success and growth in career is to swim against the current, to constantly grow and change and not be stagnant. Growth is not possible until one exerts additional effort to do things beyond what is expected. When one tries to do things beyond what is expected, there will be hurdles and blocks as in the current that pushes the water in the river. Sure, swimming against the current is difficult, but when you make it you get towards a point, a unique identity and are in a pool of lesser commodity.

So what did you do/learn beyond what is expected out of you?


Deprecated: Function ereg_replace() is deprecated in /home/techmasa/public_html/wp-content/plugins/sociable/sociable.php on line 64
Blink this Foundation Stone #46 - Swim Against the Current at blinklist.com    Bookmark Foundation Stone #46 - Swim Against the Current at blogmarks    Bookmark Foundation Stone #46 - Swim Against the Current at del.icio.us    Digg Foundation Stone #46 - Swim Against the Current at Digg.com    Fark Foundation Stone #46 - Swim Against the Current at Fark.com    Bookmark Foundation Stone #46 - Swim Against the Current at Furl.net    Bookmark Foundation Stone #46 - Swim Against the Current at NewsVine    Bookmark Foundation Stone #46 - Swim Against the Current at reddit.com    Bookmark Foundation Stone #46 - Swim Against the Current at Simpy.com    Bookmark Foundation Stone #46 - Swim Against the Current at Spurl.net    Bookmark Foundation Stone #46 - Swim Against the Current with wists    Bookmark Foundation Stone #46 - Swim Against the Current at YahooMyWeb

Comments      Cosmos

Flex and Ant Build

One of our projects uses Flex 2 for our presentation layer. We were using Flex builder as the IDE to build the flex components, packaged it with the rest of the J2EE application as war and deployed it. As a practice with rest of the projects we wanted a build automation done in place for continuous integration, as well as saving time building and deploying it to different environments. We could get the ant scripts ready within no time for the J2EE piece of it as it was straightforward and we have done it numerous times. As far as flex goes even though flex ant tasks are available with documentation it wasn’t that easy for us to get things built as flex builder would do it. Sure the ant tasks built the swf files but when we deployed the application on the server we always got this error “RSL Error 1 of 1″ and nothing beyond that. Searching this error resulted in different reasons but nothing concrete in nature.

To be more exact, our application consisted of a Flex model folder containing action scripts common across the other Flex modules. So this had to be set as a run time shared library (RSL) rather than packaging it along with other modules. Packaging with other modules would make it work, but it becomes bulky and performance degrades because the model classes are loaded for each Flex package. To make it a RSL while building the flex components, the model has to be referred as RSL using the attribute in the task. We did this but only got the error mentioned above “RSL Error 1 of 1″. We were clueless at this point and tried out combination of attributes while compiling using mxmlc.

Our only hope remained in identifying what makes the build done by the flex builder make it work and the difference between the parameters it uses and what we use. We knew this because the size of SWF generated out of a Flex builder build was very different from the size that came out of our ant build. Because the build properties are GUI based, how to get what configuration flex builder uses and how it translates to the appropriate compiler options? After exploring the available compilation parameters with mxmlc, we found out the parameter -dump-config would dump the configuration used in a file. We added this parameter to the compiler parameters in the Flex compiler options as shown below in the screen.

dump config option

We compared the configuration that flex builder used versus what we had been using in the mxmlc task, only to find out there wasn’t much difference except for few of the compile time properties which was also present in the flex.config file we were using. The same RSL attribute was present making the model package as reference. We were back to square one wondering what could be the difference and what we are missing. After two days of struggle, a careful re-examination of the configuration in Flex builder when referring the model package in other packages revealed something. Take a look at the snapshot below.

Flex Build Path - Auto Extract SWF - True

The “Auto extract swf: true” was something that we could not find a translation when using the compc ant task and we could not find any documentation mentioning this in the flex ant tasks documentation. We were able to confirm that something is happening here again because of the size difference between what Flex builder generated versus what our ant build generated. There must be a way to produce the package exploded rather than having it packaged as one SWF, just like an exploded war file. Fortunately there was option to do this with the compc task when the directory attribute is set to true and the output attribute holds a directory value. When we were able to do this everything got revealed. Here is a snapshot of the directory structure.

compc output

A look at the files that got generated told us that the SWF that contained the model was having a name of “library.swf”, and when this directory was packaged and added as RSL, there is a mismatch in the reference. The flex runtime binary is looking for MyModel.swf while the only file present is library.swf. That should be the reason for the RSL Error. Also the size when Flex builder built the package was exactly equivalent to the size of the library.swf file present above. So that answers what “Auto extract swf: true” configuration does.

So our ant script was ready, we used one compc task to generate an exploded model directory. Picked the library.swf and copied it to the war with “MyModel.swf”. Another compc task to generate the model packaged so that we can refer it only for compilation for other flex models. Once we did this, everything worked perfectly. So here is the sample ant code (right click and save as, then open in an editor) that made the trick.

Hope this is useful for someone struggling with similar situation and it saves the head cracking time. If someone has found out an easier approach to this please pass that on, we would be happy to learn.


Deprecated: Function ereg_replace() is deprecated in /home/techmasa/public_html/wp-content/plugins/sociable/sociable.php on line 64
Blink this Flex and Ant Build at blinklist.com    Bookmark Flex and Ant Build at blogmarks    Bookmark Flex and Ant Build at del.icio.us    Digg Flex and Ant Build at Digg.com    Fark Flex and Ant Build at Fark.com    Bookmark Flex and Ant Build at Furl.net    Bookmark Flex and Ant Build at NewsVine    Bookmark Flex and Ant Build at reddit.com    Bookmark Flex and Ant Build at Simpy.com    Bookmark Flex and Ant Build at Spurl.net    Bookmark Flex and Ant Build with wists    Bookmark Flex and Ant Build at YahooMyWeb

Comments (3)      Cosmos


Creative Commons License  This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.