Wednesday, July 27, 2011

java.lang.SecurityException When Shutdowning JBoss

We can run following command when starting JBoss. We assume there are already jboss system user in OS.

# Centos
su jboss -c '$JBOSS_HOME/bin/ -b > /dev/null 2> /dev/null &'
# Ubuntu
sudo -u jboss $JBOSS_HOME/bin/ -b > /dev/null 2> /dev/null &

Stopping jboss actually should be done by running this

# Centos
su jboss -c '$JBOSS_HOME/bin/ -S &'
# for ubuntu
sudo -u jboss '$JBOSS_HOME/bin/ -S &'

But in my system this will Exception in thread "main" java.lang.SecurityException: Failed to authenticate principal=null, securityDomain=jmx-console. This is happen because likely we have enabled the interceptor in jmx-invoker-service.xml file in deploy folder. Then for shuttingdown jboss we should provide some credential that we can see at login-config.xml file in the conf folder.

So the shutdown command should be like this
# Centos
su jboss -c '$JBOSS_HOME/bin/ -S -u admin -p admin &'
# for ubuntu
sudo -u jboss '$JBOSS_HOME/bin/ -S -u admin -p admin &'

Actually there still some exception when running this. jboss.remoting:service=invoker,transport= bisocket,,port=4457,JBM_clientMaxPoolSize=200,clientLeasePeriod=10000,clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper,dataType=jms,marshaller=org.jboss.jms.wireformat.JMSWireFormat,numberOfCallRetries=1,numberOfRetries=10,pingFrequency=214748364,pingWindowFactor=10,socket.check_connection=false,timeout=0,unmarshaller=org.jboss.jms.wireformat.JMSWireFormat is not registered.


2011-07-27 10:06:07,835 ERROR [org.jboss.remoting.transport.Connector] invalid Object Name jboss.remoting:service=invoker,transport= socket,,port=3873 is not registered.

But after running

ps ax | grep java

I cannot see any JBoss instance that still running. So I conclude that shutdowning has been done correcly. I will check the later issue when have time. Meanwhile those shutdowning command can be put into some script.


Tuesday, July 26, 2011

Evident of Domain Ownership

This post confirms my ownership of the site and that this site adheres to Google AdSense program policies and Terms and Conditions: ca-pub-7639114857160614

Monday, July 25, 2011

Fixing Rhythmbox Lyrics cannot display Apostrophes

I don't have too good voice. But still, I love singing. One of my favorite music player in Ubuntu is Rhythmbox. The player is have very complete features and good library management system. This player also support plugin system. So any interested developer can extend this player for any new features.

One of important feature for any music player especially for the one who love singing or just grumbling is lyric plugin. In Windows OS world, they have very good lyric application, Mini Lyric. The application can run lyric in realtime while the song is playing. Rhythmbox actually already have one eventhough not as sophisticated application that I mentioned previously. The plugin only fetch the lyric from some lyric database web service when we play some song. But the lyric will not played as the song run. But it is enough.

The problem is don't know why this plugin cannot show apostrophes. For example application will show this word "It's fantastic" where actually it should be show this "It's fantastic". Previously I ignore this problem. But as the time goes on, I curious how to solve this. Here are the remedy. Open terminal and do these.

cd /usr/lib/rhythmbox/plugins/lyrics/

Add this text:

lyrics = lyrics.replace("'", "'")

Between these lines (line 107 in my system):

lyrics = unescape_entities(artistitle) + unescape_entities(lyrics)

and this line:

lyrics += "\n\nEsta letra foi disponibilizada pelo site\n"

so it became:

lyrics = unescape_entities(artistitle) + unescape_entities(lyrics)
lyrics = lyrics.replace("'", "'")
lyrics += "\n\nEsta letra foi disponibilizada pelo site\n"

After this restart Rhythmbox and empty your lyric folder. The problem should be solved now.

Friday, July 15, 2011

Introducing Google+ and Comparing Google+ Vs. Facebook

Google seems want to try to attack Facebook domination in social networking. Their weapon name is Google+. Actually the service itself has not launched officially. Maybe still in kind of beta version to some limited people. Fortunately I got invitation from my friend so can be an early adopter and write this post.

Google+ General Layouts
After about 2 days using it I have several comments. Of course it is unavoidable for us comparing Google+ versus Facebook. Before continuing, please remind that probably my opinion could be little bit subjective.
Facebook General Layouts
Let's start from general features. Google+ divide main screen into several main menu. The home screen will show something called Stream. Stream is exactly equal with Facebook News Feed. But currently no filter for top news and most recent in Google+ stream. The next menu is Photos. Since beginning Google+ have intention to integrate smoothly with their existing photo sharing application, Picassa. In Google+ Photos menu, the photo thumbnail is larger comparing to Facebook.

The third menu is Profile. Almost exactly same again with Profile menu in Facebook. This menu is divided more into Posts, About, Photos, Videos, +1's and Buzz. Other than +1's and Buzz I think self explained. +1's actually launched before Google+. If I am not mistake +1's button was introduced in Google IO event 2011. In this sub menu we will see anythings around web where we already pushed +1's button. For person who not familiar yet, +1's button is really close with Facebook Like button. The Buzz tab will show our Google Buzz update. Google Buzz itself is a kind of micro blogging platform like tweeter. But until now I still see that Twitter still unbeatable.

The last main menu in Google+ is Circles. I will quote the definition of Circles from Google+ documentation itself as follow. Google+ Circles helps you organize everyone according to your real-life social connections--say, 'family,' 'work friends,' 'music buddies,' and 'alumni'. Then, you can share relevant content with the right people, and follow content posted by people you find interesting. For example, you might post an announcement about your engagement and show it only to people in your friends and family circles, or maybe you see a post from the circle you created for your book club that there's a recent article on your favorite author. At first sight it seems similar with friends grouping mechanism in Facebook. But after I do several trial it is little bit more sophisticated. Of course the story will different if no longer from now, Facebook will do some features update.

Speaking about main features, I still stand at Facebook side, because there are still several feature that likely have not integrated yet to Google+. For example event and Group. I don't know whether this thing will be integrated at the end.

After describing general features, I will make sort description about their user interface layouting. Not too many differents with Facebook. Google+ use white as main color versus Facebook which use some blue in a lot of their pages. I also feel Google+ layout is far more cleaner and more clear compared Facebook. I start feel not too comfort because more days, there are more scam and unintended advertising by tagging photos in Facebook. For now such problem doesn't happen in Google+. For layout things, I choose Google+ is better than Facebook.

Last I want to share little bit about mobile apps user experience for this two Social Networking platform. We should realize that one of the main reason why social networking is booming because penetration of mobile user. That's why mobile apps is important in this era.
Google+ Mobile Apps

Facebook Mobile Apps

Even though still very new Google+ already launch their mobile apps at least for Android. The iPhone version is promised to be launched soon. The Android version itself without clear reason cannot be downloaded from market for Indonesian user. I myself finally can install the apps after searching the apk files from the internet. Here are the short reviews and camparassions. Note: the version of mobile apps that I used is Android base.

Google+ mobile apps, is designed perfectly. This make sense because Android itself is build by Google. The user interaction is very smooth, the way to use is very intuitif. Like in their web, mobile apps, have 5 main menu. Stream, Photos, Circles, Profile and Huddle. Until now I am still not too clear about what Huddle means. Maybe similar with chat in Facebook. Let's now move to the Facebook mobile apps. Because the age of Facebook is old enough (now is version 1.5.4), the features and the stability of the application is also perfect. So I can say that this two mobile apps is equal in quality and usability.

Final comment is about general things. Facebook already stand up for couple years while Google+ only try to begin. We are never know how the future will go. We never know whether Google+ will stand as strong competitor for Facebook or will dying for example like Google Wave. Only time will know. Facebook strong for their age and a lot of applications. Google will have advantage for many of their available services and big name of Google itself.

Once more the opinion from this post maybe little bit subjective. Hopefully this post will be useful.

Thursday, July 14, 2011

JBoss AS 7 has Released

It is little bit surprising when I browse to theserverside this evening and found a news that announce JBoss 7 has been released. I am surprised because what I remember JBoss 6 was released not too long a go. When I see the release date, JBoss 7 is released only 6 months after the JBoss 6.

JBoss application server is very important for me. Since my first step as Java Enterprise developer JBoss is the application server I have used most often. The funny thing, even though the version now already at 7 number, I myself still use the JBoss 4 version for development. This is happen because most of the project that I handled still use that version.

These are some important features of JBoss 7 Application server. Fast start up (< 3 seconds), lighweight, modular core, hot incremental deployment, elegant administration, domain management, first class component. I still don't have many comments for those features because I have to dirt my hand first playing the application. I will write another post later.

Wednesday, July 13, 2011

Troubleshooting When Cron Job wont Executed

What to check when Cron job/script wont executed? One of the possible answer is maybe the PATH declaration in your script which is not correct. Here are the sample story.

Currently I have to do application profiling in aim to analyst the posible bottleneck in application. The tools that I use like I have mentioned before is JBoss Profiler. Fortunately, this tool can be integrated easily with existing JBoss application server. JBoss profiler itself consist two modules. The first one is several jar files and configurations that is dipped into application server. The second part is small client Java application that will snapshot and produce profile report for current situation of method/function graph call from our application source code.

We have necessity to run the client snapshot application for every particular range time. The mean of this approach is when application that we profile start to run slowly in some particular module and some particular time we can dig to profile report and analyze the possible source of problem. To achieve this requirement we need some job scheduler tools. Because most of server live in Unix environment, we are very lucky because we have well known job scheduler in most Unix box. The scheduler name is Cron.

Scheduling a job with Cron is only the matter of editing crontab definition. Crontab itself is a configuration file that consist a list of job/command that will be executed for every particular time. This is the content of my Cron file. See the last line of the Cron files.


# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
#* * * * * root
#* * * * * root
* * * * * root # this will be run every minute

This is the script content.

#! /bin/sh
#This script is intended to take profiling snapshot

export PATH=$PATH:/usr/local/jdk1.6.0_20/bin
cd /opt/jboss-profiler-2.0.0.Beta5
# run the profiler snapshot capturer
java -Xmx512m -jar jboss-profiler-client.jar snapshot
# move the produced report to other folder, in this case is to apache html folder so we can see remotely from browser client 
mv 201107* /var/www/html/profiler

#exit 0

I have run this configuration in my local successfully. But when I clone all the setting into the server the process seems not work as expected. I became more curious because after catching the log of cron tail -f /var/log/cron (or /var/log/syslog on ubuntu) the script actually already executed. The other of my confusedness, the script itself is worked perfectly if we executed it directly on the shell.

Jul 13 11:02:01 ID31-ND102 crond[13350]: (root) CMD (
Jul 13 11:03:01 ID31-ND102 crond[13368]: (root) CMD (
Jul 13 11:04:01 ID31-ND102 crond[13397]: (root) CMD (
Jul 13 11:05:01 ID31-ND102 crond[13418]: (root) CMD (
Jul 13 11:06:01 ID31-ND102 crond[13447]: (root) CMD (
Jul 13 11:07:01 ID31-ND102 crond[13465]: (root) CMD (
Jul 13 11:08:01 ID31-ND102 crond[13493]: (root) CMD (
Jul 13 11:09:01 ID31-ND102 crond[13512]: (root) CMD (
Jul 13 11:10:01 ID31-ND102 crond[13544]: (root) CMD (
Jul 13 11:10:01 ID31-ND102 crond[13546]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 13 11:11:01 ID31-ND102 crond[13564]: (root) CMD (
Jul 13 11:12:01 ID31-ND102 crond[13593]: (root) CMD (
Jul 13 11:13:01 ID31-ND102 crond[13612]: (root) CMD (
Jul 13 11:14:01 ID31-ND102 crond[13644]: (root) CMD (

Then after some hours of debugging I realize one possible source of problem is in PATH declaration in crontab files.


Because I run java command then I have to add the path declaration to be like this.


Then the scheduler can run the script perfectly.

Notes: This command sometime takes long time to run. Please refer to jboss profiler documentation for more information.

java -Xmx512m -jar jboss-profiler-client.jar snapshot

Wednesday, July 6, 2011

Fixing Skype Aborted Problem

Since several last weeks the Skype in my working station won't start. I think this problem relate to Ubuntu Linux, operating system that I've used. Every  time I try to start it just appear for several second then disappear. When I start from command prompt it can be seen Skype logs "Aborted" word after it started then crash.

Previously I have tried several approach to fix the problem. Very basic is restarting the Ubuntu. Still not fix the problem. Then I reinstall the Skype. Also no sign of problem already cleared. Then I try to purge and remove all configurations. No changes.

Then after that my Skype always offline in office. This morning suddenly my colleague insisted me to start my Skype because there are something important to discuss. Even though still lazy I force myself to find remedy. I thought to reinstall again. But after short googling I found the perfect remedy.

Just open the console then type this command.

rm ~/.Skype/shared.xml

This will remove some configuration then after firing up Skype again, finally it can start normally.


Reference from here:

Tuesday, July 5, 2011

Detail Guide to Use JBoss Profiler

Long time I haven't write new post. Here the guide about remote profiling.

According to wikipedia, software profiling is a process of optimizing source code by analyzing the application running by profiler tools. By using profiler we can know how many times a method or function is invoked and also how long is taken for such invocation.

In the field Java, there so many profiler tools. Most known IDE usually have built in profiler tools. But there is sometime a need to do remote profiling. E.g profiling Java EE application that run in server. If we use JBoss application server then we are blessed by existence of JBoss profiler.

Excerpt from its website JBoss Profiler is a log based profiler using JVMPI and JVMTI. It uses an agent written in C that captures events from the JVM and logs to disk. A web application running on JBoss or another machine can be used to analyze these logs through a web browser.

The process of installing the profiler is very easy. First of course we need to download the newest version of the software from this link . In the time this post written I was using version 2.0 Beta5. Extract the files to some directory. I extract that to /opt directory. So the files will be available at /opt/jboss-profiler-<version>.

After extracting do the following steps exactly.
  1. Copy jboss-profiler.jar to jbossas/bin
  2. Copy to jbossas/bin
  3. Copy javassist.jar to jbossas/bin
  4. Edit in jbossas/bin to include the classes to be profiled
  5. Copy jboss-profiler-plugins.jar to jbossas/bin
  6. Edit run.conf (Unix) or run.bat (Windows) in jbossas/bin to include JBoss Profiler in JAVA_OPTS add the following argument: -javaagent:jboss-profiler.jar
  7. Copy jboss-profiler.sar to jbossas/server/<conf>/deploy

Note: you don't need to do step number 3 if you use JBoss 5 or JBoss 6 application server.

After finished copying the needed files, open The most important key is "includes". Add the java package you wish to profile. After it's done, we are ready to do profiling.

Start the server then run the following command from directory of our extracted jboss-profiler. In my case I extract to /opt/jboss-profiler-<version>. The command is

java -Xmx512m -jar jboss-profiler-client.jar

After running the that there will be a list of availables commands as follow.

startProfiler : Start the profiler
stopProfiler : Stop the profiler
snapshot : Take a snapshot
getSnapshot : Get a snapshot
listSnapshots : List snapshots
clearSnapshots : Clear snapshots
gc : Trigger garbage collection
enable : Enable the profiler
disable : Disable the profiler
load : Load a snapshot
save : Save a snapshot
diff : Compare snapshots
add : Add classes (public|package|protected|private)
remove : Remove classes
list : List classes

The most important command is snapshot. Everytime we run this command the profiler client will produce profiler report in current directory. The report consist html files with detail of method invocation for every classes that we have included in configuration.

Some problem that might appear:
1. Forget copying jboss-profiler.sar to jbossas/server/<conf>/deploy will make jboss-proiler-client.jar won't run
2. Make sure to chmod every jar in /opt/jboss-profiler-<version> directory to be excecuted. Otherwise the profiler client also won't run.

Happy profiling and let's find the thing to optimize let's kill the memory leak.