sjamesr/jfreesane

While Scanning the document through java code using jfreesane getting java.io.IOException: unexpected status 9 (STATUS_IO_ERROR) while opening device.

Closed this issue · 11 comments

From bhanucha...@gmail.com on October 08, 2012 21:34:27

What steps will reproduce the problem? 1.I am trying to connect the Printer through java program. It should scan the document and it should produce image
2.device.open(), while executing this I am getting above problem 3. What is the expected output? What do you see instead? it should scan the document What version of the product are you using? On what operating system? Linux, Deskjet_3050_J610_series Please provide any additional information below. Some times it showing scan complete. But where the image is storing,the location I am not getting. Most of time I am getting java.io.IOException: unexpected status 9 (STATUS_IO_ERROR) while opening device.

Attachment: javacode

Original issue: http://code.google.com/p/jfreesane/issues/detail?id=4

From s...@jdns.org on October 09, 2012 13:59:30

Can you please provide a stack trace indicating the source of the exception? This will help us to figure out what's going on. Also, saned logs might reveal something interesting.

From bhanucha...@gmail.com on October 09, 2012 23:20:20

Hi,Thanks for your response.

Now I able to scan the document, but problem is in getting the scanned image back to local system.This is I am doing with remote system. Sane server running in remote system only and scanner connected to remote system.I am getting following issue.

java.net.NoRouteToHostException: No route to host
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.(Socket.java:375)
at java.net.Socket.(Socket.java:218)
at au.com.southsky.jfreesane.SaneSession.acquireImage(SaneSession.java:175)
at au.com.southsky.jfreesane.SaneDevice.acquireImage(SaneDevice.java:90)
at wtc.img.ImageScanner.scanImage(ImageScanner.java:45)
at wtc.img.ImageScanner.main(ImageScanner.java:57)

And also for second execution(After successful scan) of my ImageScanner class I am getting following Exception.ie first execution success,next execution fail with following exception and third execution get success.

au.com.southsky.jfreesane.SaneException: STATUS_IO_ERROR
at au.com.southsky.jfreesane.SaneSession.acquireImage(SaneSession.java:161)
at au.com.southsky.jfreesane.SaneDevice.acquireImage(SaneDevice.java:90)
at wtc.img.ImageScanner.getsession(ImageScanner.java:39)
at wtc.img.ImageScanner.main(ImageScanner.java:50)

Pleae provide the solution.
Thanks
Bhanu.

From s...@jdns.org on October 09, 2012 23:32:28

The "No route to host" problem is happening when JFreeSane is trying to connect to the sane server on a data port (provided by saned when you acquire an image). Have you got any funny port forwarding/firewalling/networking tricks going on?

From bhanucha...@gmail.com on October 09, 2012 23:49:35

saned logs:::::::::

Oct 10 12:12:25 localhost xinetd[863]: START: sane-port pid=5726 from=::ffff:192.168.1.46
Oct 10 12:12:25 localhost xinetd[863]: START: sane-port pid=5727 from=::ffff:192.168.1.203
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 346: invalid http_status=0
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=1580
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=5
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=298
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=2048
Oct 10 12:12:26 localhost saned[5727]: scan/sane/http.c 350: dumping len=289
Oct 10 12:12:27 localhost saned[5727]: scan/sane/http.c 189: timeout reading data sec_timeout=1
Oct 10 12:12:27 localhost xinetd[863]: EXIT: sane-port status=0 pid=5726 duration=2(sec)
Oct 10 12:12:27 localhost xinetd[863]: EXIT: sane-port status=0 pid=5727 duration=2(sec)
Oct 10 12:12:31 localhost xinetd[863]: START: sane-port pid=5730 from=::ffff:192.168.1.46
Oct 10 12:12:32 localhost xinetd[863]: START: sane-port pid=5731 from=::ffff:192.168.1.203

From s...@jdns.org on October 10, 2012 00:05:01

Are you connecting to a sane daemon speaking the sane protocol or HTTP? I'm not familiar with any SANE HTTP server and JFreeSane currently does not support any such server (only "native" saned protocol).

From bhanucha...@gmail.com on October 10, 2012 03:13:44

I am getting The following sane logs when i get No Root Found
Oct 10 15:27:25 localhost xinetd[863]: START: sane-port pid=19991 from=::ffff:192.168.1.46
Oct 10 15:27:25 localhost xinetd[863]: START: sane-port pid=19992 from=::ffff:192.168.1.203

But I am not sure why sane daemon speaking to HTTP protocol. This log I am getting when i got following Exception

au.com.southsky.jfreesane.SaneException: STATUS_IO_ERROR
at au.com.southsky.jfreesane.SaneSession.acquireImage(SaneSession.java:161)
at au.com.southsky.jfreesane.SaneDevice.acquireImage(SaneDevice.java:90)
at wtc.img.ImageScanner.getsession(ImageScanner.java:39)
at wtc.img.ImageScanner.main(ImageScanner.java:50)

Letme clarify one thing that what is should be the "timeout" value. Its using defualt as 0(zero) is it ok. I am expecting because of this I am getting No root to Host.. Is it right? And one thig is that I executed this successfully in Remotesystem itself withou getting any Exception . But I am unble I am getting this No root problem while I am executing from my local machine.

I debugged the code.. I find that host is null, is this giving the problem?

Actually this is my first experience writing a java program which communicates with hardware device through network.

I hope this information gives you the idea to solve my problem.

Some times I am getting following Exceptions also..

ava.io.IOException: input stream was truncated while reading a word
at au.com.southsky.jfreesane.SaneWord.fromStream(SaneWord.java:72)
at au.com.southsky.jfreesane.SaneInputStream.readWord(SaneInputStream.java:133)
at au.com.southsky.jfreesane.SaneSession.acquireImage(SaneSession.java:159)
at au.com.southsky.jfreesane.SaneDevice.acquireImage(SaneDevice.java:90)
at wtc.img.ImageScanner.getsession(ImageScanner.java:39)
at wtc.img.ImageScanner.main(ImageScanner.java:50)
au.com.southsky.jfreesane.SaneException: STATUS_INVAL
at au.com.southsky.jfreesane.SaneSession.acquireImage(SaneSession.java:161)
at au.com.southsky.jfreesane.SaneDevice.acquireImage(SaneDevice.java:90)
at wtc.img.ImageScanner.getsession(ImageScanner.java:39)
at wtc.img.ImageScanner.main(ImageScanner.java:50)

Waiting for your responce

Thanks

Bhanu

From bhanucha...@gmail.com on October 10, 2012 03:15:48

And also clarify one thing that should i provide any port number explicitly or it is taken care by sane server?

From bhanucha...@gmail.com on October 10, 2012 03:31:44

The following logs may help you....

ct 10 15:55:39 localhost xinetd[863]: START: sane-port pid=22224 from=::ffff:192.168.1.46
Oct 10 15:55:43 localhost xinetd[863]: EXIT: sane-port status=0 pid=22224 duration=4(sec)
Oct 10 15:55:59 localhost xinetd[863]: START: sane-port pid=22227 from=::ffff:192.168.1.46
Oct 10 15:56:20 localhost xinetd[863]: START: sane-port pid=22232 from=::ffff:192.168.1.203

Oct 10 15:57:08 localhost xinetd[863]: EXIT: sane-port status=0 pid=22227 duration=69(sec)
Oct 10 15:57:08 localhost xinetd[863]: EXIT: sane-port status=0 pid=22232 duration=48(sec)
Oct 10 15:58:04 localhost xinetd[863]: START: sane-port pid=22289 from=::ffff:192.168.1.46
Oct 10 15:58:09 localhost xinetd[863]: EXIT: sane-port status=0 pid=22289 duration=5(sec)

From bhanucha...@gmail.com on October 10, 2012 10:28:17

Thanks For your cooperation. Finally I got my requirement. This is the problem of port range. This ranged ports are closed. After they opened its working fine.

Thanks
Bhanu

From s...@jdns.org on January 28, 2013 07:08:33

Status: Fixed

From javaprob...@gmail.com on May 24, 2013 06:23:00

Hi, I am trying the same and what would be the host id and I should I get it. like you have given the "192.168.1.203". How do I can see this?