0

I'm trying to open a connection with JavaPOS to a fiscal printer via VPN. Actually, with a printer I can do this task but with a customer's printer this error comes out:

jpos.JposException: 106, 0
    at jp.co.epson.FiscalDriver.FiscalPrinter.CommonFiscalPrinterService.open(CommonFiscalPrinterService.java:2436)
    at jpos.BaseJposControl.open(Unknown Source)
    at Main.main(Main.java:11)

What do you think could be the problem? The error 106 in opening the printer communication means that the communication is already open but I've never done it.

My code:

public static void main(String[] args) 
{
    FiscalPrinter stampante = new FiscalPrinter();
    try 
    {
        stampante.open("P");
        stampante.claim(1000);
        stampante.setDeviceEnabled(true);
        System.out.println("YES !");
    } 
    catch (JposException e) 
    {
        e.printStackTrace();
    }
}
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
LG1598
  • 1
  • 1
  • It's going to be better for you if you post the *full stack trace, formatted as code* – g00se Aug 03 '23 at 11:13
  • Incidentally that code, if it's jpos, seems to be `E_ILLEGAL` – g00se Aug 03 '23 at 11:20
  • Yes, it means that the Control is already open but i don't know why – LG1598 Aug 04 '23 at 08:17
  • How do you know it means that? – g00se Aug 04 '23 at 09:11
  • On Java for Retail POS Programming Guide, under the open method explanation it says this: – LG1598 Aug 04 '23 at 09:41
  • Some possible values of the exception’s ErrorCode property are: Value Meaning JPOS_E_ILLEGAL The Control is already open. JPOS_E_NOEXIST The specified logicalDeviceName was not found. JPOS_E_NOSERVICE Could not establish a connection to the corresponding Device Service. – LG1598 Aug 04 '23 at 09:42
  • In terms of a printer, I don't know what "the control is already open" could mean – g00se Aug 04 '23 at 09:44
  • I think it means that opens a device for I/O – LG1598 Aug 04 '23 at 09:50
  • Given the source code presented, as already commented, the printer is probably left open. Running the program multiple times without resetting or restarting the printer will cause problems like the one in your question. It is necessary to execute `setDeviceEnabled(false);`, `release();`, `close();` for `stampante.` at the end of the program. – kunif Aug 20 '23 at 00:54

0 Answers0