Tuesday, December 14, 2010
gnu-hylafax: scheduler NAK'd request ?
Working with gnu-hylafax library is a great, but if you don't pay careful attention it can blow your mind and keep you awake the whole night!
I kept wonder why sendfax command works fine but application built using gnu-hylafax library ends up with exception.
On reason for this was missing call to job.setKillTime("value"); (preferable to set value as 00259) This translates to JPARAM LASTTIME value command.
How to trace the issue?
Enable Log4JLogger for the application, you should be able to get the trace of all the TELNET commands executed. Verify the same with (sendfax -vv ...)
Sample log4j.properties file with gnu.hylafax.ClientProtocol logger:
I kept wonder why sendfax command works fine but application built using gnu-hylafax library ends up with exception.
460 Failed to submit job *: Unspecified reason (scheduler NAK'd request).
at gnu.hylafax.HylaFAXClientProtocol.jsubm(HylaFAXClientProtocol.java:702)
at gnu.hylafax.HylaFAXClient.submit(HylaFAXClient.java:632)
...
On reason for this was missing call to job.setKillTime("value"); (preferable to set value as 00259) This translates to JPARAM LASTTIME value command.
How to trace the issue?
Enable Log4JLogger for the application, you should be able to get the trace of all the TELNET commands executed. Verify the same with (sendfax -vv ...)
Sample log4j.properties file with gnu.hylafax.ClientProtocol logger:
#set the level of the root logger to DEBUG and set its appender as an appender named X
log4j.rootLogger = DEBUG, X
log4j.logger.X = DEBUG, X
log4j.logger.gnu.hylafax.ClientProtocol = DEBUG, X
#set the appender named X to be a console appender
log4j.appender.X=org.apache.log4j.ConsoleAppender
#set the layout for appender named X to be a pattern layout
log4j.appender.X.layout=org.apache.log4j.PatternLayout