Java Objects as Output Data cause taskOutput failure
book
Article ID: KB0086186
calendar_today
Updated On:
Products
Versions
TIBCO DataSynapse GridServer
-
Not Applicable
-
Description
Resolution: Using a user-defined Java object as output data causes an error similar to this:
01/23/2003 18:38:23:062 Error: JobSpaceRunner make taskOutput failed java.lang.ClassNotFoundException: ...
The Service uses a class loader to deserialize the output. This loader is the loader set as the context class loader of the thread that creates the Service, at the time of the createService call. In the somewhat rare case in which your output data is a user-defined Java object, but that class is not avaliable in the context class loader, you must set the context class loader to a loader that contains that class definition immediately prior to creating the Service. The former context class loader may then be restored if necessary.
This may occur if your software has already changed the context class loader for some other purpose. For example:
// save the current ClassLoader current = Thread.currentThread().getContextClassLoader(); //set to the correct one Thread.currentThread().setContextClassLoader (MyOutputObject.class.getClassLoader()); // create the service/job Service cs = Service.createService(...); //or Job j = new Job(); //restore the classloader Thread.currentThread().setContextClassLoader(current);
Issue/Introduction
Java Objects as Output Data cause taskOutput failure