• Post Reply Bookmark Topic Watch Topic
  • New Topic

javax.comm.PortInUseException: Port currently owned by Unknown Windows Application

 
Ashwin Ganesh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.comm.PortInUseException: Port currently owned by Unknown Windows Application

I am trying to do a program to send sms using a GSM modem.but i get the above error while try to run.
that com port is not using by any program as in my knowledge.

Please help me resolve the issue.

I have replicated the issue, by stopping the gateway and starting it back.

What i have identified is, even after stopGateway() is called, the connection is not released.
 
Henry Wong
author
Sheriff
Posts: 22529
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashwin Ganesh wrote:
I have replicated the issue, by stopping the gateway and starting it back.

What i have identified is, even after stopGateway() is called, the connection is not released.



If you stop the gateway, wait a few minutes, and then restart it, does it work? If so, it may be a TCP timed wait issue. Unfortunately, we can't tell if you are using TCP at all since you are providing a higher level exception here.

Henry
 
Ashwin Ganesh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making the thread to sleep for a minute and then starting the gateway again. Still it fails.
 
Henry Wong
author
Sheriff
Posts: 22529
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

BTW, I should mention that while the TCP timed wait is generally about 30 seconds, I have seen it (in some cases) set as high as five minutes.

Henry
 
Ashwin Ganesh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya Henry. You are right. I have even tried that. Still jumping to the same exception.

Even after calling serialPort.close(), the port is not getting released.
 
Ashwin Ganesh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The issue is now resolved. In place of comm.jar file, i used RXTXcomm.jar which resolved the issue.

Now am able to stop and start the gateway without getting PortInUseException.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!