Thursday, February 14, 2013

Glassfish: sources

Where are all those sources of the glassfish that one can use for addapting the behavior/studing the way it operates?

I've found following link for svn access:
https://svn.java.net/svn/glassfish~svn

Therefor as in my case if I need 3.1.1 version I can obtain it simply via:
svn co https://svn.java.net/svn/glassfish~svn/tags/3.1.1/ glassfish_3.1.1

Tuesday, February 5, 2013

Java Web Start: debugging

Have you ever been in a need to debug JWS application?

One way to do the trick is to adapt environment variable: JAVAWS_VM_ARGS

As I'm running linux and need this in my daily work, I added following to my .bashrc file:
export JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9010,server=y,suspend=n -XX:MaxPermSize=128m"

Some notes:
  • suspend=n - this makes sence for me, as I'm not waiting for debugger to connect. To make sure I connect only once I'm interested. And app won't get stuck
  • -XX:MaxPermSize=128m - is not related to debugging but rather to memory, feel free to remove/adapt to your needs

After jws runs, I can connect from eclipse to port configured, in my case: 9010 (use the one that fits your environment) and remotely debug the app.

That's it. Easy, right?

There are however also some disadvatages of my simple solution.
Major one is that I can have only one JWS instance running at time. As there is a port conflict (same ons is in use for every one), but I can live with that.

Glassfish: Exception while shutting down application container : java.lang.NullPointerException

OK, this one is one of the crazy ones :)
Have you ever seen exception like this in your glassfish server logs during ear deployment?
[#|2013-02-05T08:08:40.769+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=90;_ThreadName=Thread-2;|Exception while shutting down application container|#]

[#|2013-02-05T08:08:40.938+0100|SEVERE|glassfish3.1.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=90;_ThreadName=Thread-2;|Exception while shutting down application container : java.lang.NullPointerException|#]
Well I did, today. And as I've googled, noone could ever get some more meaningfull stacktrace out of it. Sounds like a nightmare. So where the problem could be?

In development following rule usually works for me:
If you can't get any meaningful information on the problem you're facing and googling didn't help, think of what has been changed since the last success. 
(Well this doesn't seem to be always applicable, but most of the time it is)

This rule was also worked for another guy facing similar exception.

Well in my case too many things changed, but I had backup of the last successfully built artifact. Comparing it with the latest one I've found out that I forgot to include commons-pool dependency in my ear file. So finally following did the trick for me:
<dependency>
 <groupId>commons-pool</groupId>
 <artifactId>commons-pool</artifactId>
 <version>1.6</version>
 <scope>runtime</scope>
</dependency>
As I introduced for client-server communication spring remoting (as a corba alternative) where pooling is used.

So hey, that wasn't so bad although exception handling of glassfish didn't show something useful! I tought I'll be stuck here for at least a day :)

Monday, February 4, 2013

Maven: debugging

If you've ever been in the situation that you'd need to debug maven build, these are the options that could help.

Debugging maven run

If you need to debug maven plugins run itself use instead of standard:
mvn <your sfuff>
the debug one:
mvnDebug <your sfuff>
It should tell you it's waiting for connection, in a way like this:
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000
Afterwards use your preffered way to connect to socket 8000 via remote debugger. (For eclipse steps can be found here, or googled)

Debugging test execution

If you need to debug maven-surefire-plugin run use following:
mvn -Dmaven.surefire.debug test
It would wait for connection, in a way like this:
Listening for transport dt_socket at address: 5005
Afterwards use your preffered way to connect to socket 5005 via remote debugger. (For eclipse steps can be found here, or googled)
Easy, isn't it?

Thursday, January 31, 2013

current twitter problems

Twitter seem to be facing some problems at least in my case :(

However the status pages are really nice :)



Friday, January 25, 2013

fedora and freebsd kernel (hoax)


Have you already read the news related to Fedora on freebsd kernel plans for Fedora 19?

Well, that sounds like an ambitious goal. But who is spreading the news?
Some sources people usually trust:
- slashdot: http://slashdot.org/submission/2464323/fedora-proposal-to-support-freebsd-kernel-and-cinnamon-by-default as well as on
- phoronix: http://www.phoronix.com/scan.php?page=news_item&px=MTI4MzQ

But what is the source of this breathtaking decision? In both cases it's fedora wiki: https://fedoraproject.org/wiki/Features/FreeBSD_kernel_integration

And now the funny/real part.

Check the history of wikipage:
https://fedoraproject.org/w/index.php?title=Features/FreeBSD_kernel_integration&action=history
As it's obvious it's been clarified, it's just a joke.

But what is the root cause behind all this?


From now on for the czech speaking people only :)

Original idea: as a result of discussion/comments for the cinnamon coming to fedora news: http://www.abclinuxu.cz/zpravicky/cinnamon-jako-vychozi-rozhrani-ve-fedore-19#9

And the situation clarification is in comments under: http://www.abclinuxu.cz/zpravicky/freebsd-kernel-ve-fedore-19

It's really worth reading :) and enjoying the way how easy it can be to mislead people if you convince source they trust :)

Monday, January 21, 2013

Linux liveCD for unencrypted partition access

Q: Have you ever needed to manipulate the data on the hdd where there would be no operating system to boot to?
A: Linux liveCD could be the answer.

Recently I faced similar problem. In my case it was due to my "wise idea" of putting "/" including "/home" on the same partition, and as I went out of disk space. After reboot, ubuntu was not able to complete the process all the way up to working UI.

Please note that this is the case of unencrypted ext3 filesystem. Might not be your case.

following steps might work (as they did for me):
  • download on the other machine some livecd (livecd of ubuntu could be an option)
  • if there is empty usb key available use: pendrive linux (http://www.pendrivelinux.com/), which has really easy interface, it seems to be able to do even the download of the selected distro for you and does the job of conversion of the liveCD image to bootable usb key
  • after booting from USB on the problematic PC and having some window manager loaded (might be Unity for Ubuntu)
gksudo nautilus
if you can see the mounted filesystem there, you're lucky, just do whatever is required (possibly delete some non-critical stuff).

Otherwise (as in my case) follow the later steps:
sudo fdisk -l
this should show you all the partitions. It's important in this step to identify the one you're interested in to see the files of. You can find it based on size. As I assume you can read the output and find the important one.
In my case it was:
/dev/sdbX
now as we know the partition, let's mount important one:
sudo mkdir /media/ubuntu
sudo mount /dev/sda6 /media/ubuntu
sudo cd /media/ubuntu
now check how much is your disk occupied using:
df -h
afterwards, manipulate the files in a way you need to (possibly delete some non-critical stuff).
I used:
rm -rf /media/ubuntu/home/<user_name>/<some_dir>
And that should be it.
Happy rebooting and using the original system (if there is one) :)

And if you feel like this is too muuch technical task for you to accomplish. Just let me know that with my guidance over the skype call, my wife was able to do these steps successfully, while she's not friend of the linux cli at all.