[Rxtx] port in use exception

Dr. Douglas Lyon lyon at docjava.com
Mon Sep 25 03:52:50 MDT 2006


Hi All,
I have created a web-start testing facility to
try an help with the duplication of the bug that I am
seeing with the PortIO device. The web start console
reports:
----------------------------------------------------
Devel Library
=========================================
Native lib Version = R-testing-XTX-2.1-7pre20noLock
Java lib Version   = R-testing-XTX-2.1-7pre20noLock
port already in use
The application may be run from:
http://show.docjava.com:8086/book/cgij/code/jnlp/serialPort.SimpleWriteRead.jnlp

    public static void main(String[] args) {
         CommPortUtils cpu = CommPortUtils.getCommPortUtils();
         portIdInterface = cpu.getACommPortFromUser();



         // SETUP SERIAL PORT:
         try {
             serialPortInterface = (SerialPortInterface) 
portIdInterface.open("SimpleWriteRead", 1000);
         } catch (PortInUseException e) {
             System.out.println("port already in use");
             return;
         }

Trent: You asked:
>Perhaps you are trying to open the port before the kernel is ready?  Are
>you opening right after closing?  The more recent versions of rxtx may
>close the port faster which could make a difference depending how you are
using threads.

I am not sure if I have answered your question. The program,
produced the above output after an overnight wait. How
can I tell if the kernel is ready?

Thanks!
  - Doug


>On Sun, 24 Sep 2006, Dr. Douglas Lyon wrote:
>
>>  Hi All,
>>  For the longest time, I was using RXTX to dial the phone.
>>  Recently, I switched to the PortIO device (USB to Serial converter).
>>
>>  If I quit from the application and restart, I get an exception, as seen
>>  below, on the Mac. However, trying again seems to work fine.
>>  As long as the application remains open, everything works well.
>>
>>  I do close the port when I am done.
>>  Hmm. I am using a odd-ball version of RXTX, as you can see.
>>  This could be the culprit. Any ideas?
>>  Thanks!
>>   - Doug
>>
>>  Native lib Version = R-testing-XTX-2.1-7pre20noLock
>>  Java lib Version   = R-testing-XTX-2.1-7pre20noLock
>>  trying to open:/dev/tty.usbserial
>>  gnu.io.PortInUseException: Unknown Application
>>	at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:335)
>>	at serialPort.Utils.init(Utils.java:62)
>>	at serialPort.Utils.<init>(Utils.java:37)
>>	at serialPort.Utils.getSerialPortUtils(Utils.java:101)
>>	at gui.touchtone.DialUtils.doModemDial(DialUtils.java:70)
>>	at addbk.JAddressBook.ViewPanel.dial(ViewPanel.java:141)
>>	at addbk.JAddressBook.ViewPanel.access$300(ViewPanel.java:20)
>>	at addbk.JAddressBook.ViewPanel$11.run(ViewPanel.java:127)
>>	at gui.run.RunButton.actionPerformed(RunButton.java:45)
>>	at
>>  javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
>>	at
>>  javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
>>	at
>> 
>>javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
>>	at
>>  javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
>>	at
>> 
>>javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
>>	at
>>  java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
>>	at java.awt.Component.processMouseEvent(Component.java:5554)
>>	at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
>>	at java.awt.Component.processEvent(Component.java:5319)
>>	at java.awt.Container.processEvent(Container.java:2010)
>>	at java.awt.Component.dispatchEventImpl(Component.java:4021)
>>	at java.awt.Container.dispatchEventImpl(Container.java:2068)
>>	at java.awt.Component.dispatchEvent(Component.java:3869)
>>	at
>>  java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
>>	at
>>  java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
>>	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
>>	at java.awt.Container.dispatchEventImpl(Container.java:2054)
>>	at java.awt.Window.dispatchEventImpl(Window.java:1774)
>>	at java.awt.Component.dispatchEvent(Component.java:3869)
>  >	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
>>	at
>> 
>>java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
>>	at
>> 
>>java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
>>	at
>>  java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
>>	at
>>  java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
>>	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
>
>
>hehe.. I remember making that oddball version for you :)  Its not very
>different from like releases at the time.
>
>Perhaps you are trying to open the port before the kernel is ready?  Are
>you opening right after closing?  The more recent versions of rxtx may
>close the port faster which could make a difference depending how you are
>using threads.
>
>--
>Trent Jarvi
>tjarvi at qbang.org
>_______________________________________________
>Rxtx mailing list
>Rxtx at qbang.org
>http://mailman.qbang.org/mailman/listinfo/rxtx




More information about the Rxtx mailing list