Locking issue with serial port

Hi,
In my application,I need to monitor the devices connected through serial port in solaris sparc 9 OS.I used c and java code for it and I am able to do the same but the problem comes when I restart the system and the open my application and try to monitor it.but I m unable to monitor the devices and getting the message --

but when I delete /var/lock/LCK..a file.I am able to monitor again.

So plz let me know why it is happening and how to solve it.

Thanks in advance..

Don't go around deleting lock files....
This is the convention you are encountering:

Filesystem Hierarchy Standard - 5.9 /var/lock : Lock files

Yes,I know thaty I want to know how to resolve it......port is being locked by my application but unable to communicate with it after restart the system...

appreciate any advice/ideas.