Saturday, December 25, 2010

Ignorance - Courage - Wisdom

Ignorance is Past,
Courage is Present,
Wisdom is Future.

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.

460 Failed to submit job *: Unspecified reason (scheduler NAK'd request).
at gnu.hylafax.HylaFAXClientProtocol.jsubm(
at gnu.hylafax.HylaFAXClient.submit(

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 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

#set the layout for appender named X to be a pattern layout

Commons Logging - Log4J Configuration

If you use commons-logging in your java application, make sure to have log4j library (jar) and file on the class path. You really don't need much tweaking to get started :)

Simple file:

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.

# A1 uses PatternLayout.

To learn more on jump to log4j manual

This page is powered by Blogger. Isn't yours?