The terrorists entered from the rear side of Sunjwan Army camp where family quarters are located, DGP S P Vaid said.
At least three persons, including an Army personnel and his daughter, have been injured, officials said.
The militants, who are believed to be around three, have been isolated, they said.
IGP SD Singh Jamwal told reporters here that "around 4:55 am suspicious movement was noticed by the sentry and his bunker was fired upon. The fire was retaliated. The number of militants isn't known. They've been cornered in one of the family quarters."
Unconfirmed reports said one person has died in the gunfight.
Soon after the attack, reinforcements of the Armys special forces and SOG rushed to the spot and cordoned off the whole area amid a fierce gunfight, security official said.
Schools in the entire area around the camp have been closed by authorities as a precautionary measure.
A high alert has been sounded in Jammu and security beefed up in and around the city.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)