admin-listener port defined in domain.xml for glassfish should be same that of which netbeans is trying to connect, e.g. 4848 (default) as below:
<network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener>
</network-listeners>
location of domain.xml:
<Glassfish Installation folder>\glassfish-3.1.2.2\glassfish\domains\<domain-name>\config
I had accidentally changed the admin port from 4848 to something else. Saving it to 4848 fixed the problem. I am not sure yet where configuration of netbeans resides for connecting GF admin port.