Pages

Sunday, February 20, 2011

Your Glassfish instance doesn't start. Have you checked the OSGi cache?

I've seen this many times: you just upgraded your NetBeans and the bundled Glassfish and it suddenly stops responding. Or maybe you upgraded a Glassfish instance and your domain fails to start leaving you watching and endless stream of dots and no further activity:

$ asadmin start-domain your-domain
Waiting for DAS to start......................
$ vmstat 1

 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr s0 s1 -- --   in   sy   cs us sy id
 0 0 0 945484 1100116 222 58 947 7 7  0  0  0 12  0  0 1423 1516 1185  3  1 96
 0 0 0 838032 1383588 7  23  0  0  0  0  0  0  4  0  0  601  757 1085  0  1 99
 0 0 0 838032 1383588 4   4  0  0  0  0  0  0  1  0  0  598  782 1071  0  0 100
 0 0 0 838032 1383588 4   4  0  0  0  0  0  0  0  0  0  565 1079 1296  1  0 99

If this is happening to you, chances are that the OSGi cache of your domain is poisoned and prevents your server from working properly. In this case, try to clean it up with ($GR is Glassfish installation root):

$ rm -r $GR/glassfish/domains/your-domain/osgi-cache

and start the server again.



2 comments:

  1. Hi,
    I am stuck with this problem recently.
    I have a question though. When you start after stopping the glassfish and removing the osgi-cache, the osgi-cache again gets created, which in my case is again stopping the glassfish to start. So if I keep on deleting the osgi-cache manually, from another window, It works fine. Can you help me with any further suggestions?

    ReplyDelete
  2. Hi Shaun,

    It's been a long time (and upgrades in between) since I'm not experiencing this issue any longer.

    However, a quick suggestion: why don't you wrap the server start/stop commands in a shell script together with the osgi-cache deletion command?

    Something like (pseudocode of the stop script):

    #!/bin/sh

    asadmin stop-domain domainname
    rm -rf /path/to/osgi-cache

    Cheers,
    -- Enrico

    ReplyDelete