Exceptions thrown in a Java service are suppressed

I’m finding that when one of my Java services throws an exception, WebMethod suppresses the exception and simply returns from the service as though it worked – except of course the pipeline does not contain the output the service would have normally produced.

It would make much more sense to me if the exception caused WM to behave the same way it does when an EXIT:FAIL is executed in a Flow service.

Does anyone have a suggestion on how to get WM to do this? The only option I’m aware of at the moment is to put a Flow wrapper around every Java service, and to check its output to determine if an error occurred, and then do EXIT:FAIL – but that is really ugly…

hi,

does this help ?

try
{

}
catch(Exception err)
{
throw new ServiceException(err);
}

Thanks, that’s what I do.

With further testing I’ve found that when the service throws an exception and thus exits, WM immediately validates the pipeline output – and then reports an output validation error rather than report the exception that caused it.

Consequently, instead of getting a useful error message like:

com.wm.app.b2b.server.ServiceException: formatValue(name=BADNAME*X) unknown option “X”

… I get an unhelpful message like this:

com.wm.app.b2b.server.ServiceException: [ISC.0049.9006] Output validation for service ‘ssg.util.sql:buildColumnInsertSql’ failed: ‘/columnInsertSql VV-005 [ISC.0082.9034] Field is absent, field must exist’

I feel that WM should report the original exception rather than report an incidental downstream effect (the empty output pipeline). The only way to get a useful error message from the service is to disable output validation – which is a shame, as output validation is a good thing to have.