[jboss-user] [jBPM Users] - Re: JBPM 4.1 Blob issue on AS400 DB2

irisjacky99 do-not-reply at jboss.com
Tue Nov 10 17:33:41 EST 2009

OK, after a lot of troubleshooting debugging. Finally find a solution for it. I really hope someone from JBPM team can comment on this. 

Basically, the LobLocator won't work if I try to getBytes once the resultset is closed. This is because BlobStrategyBlob in JBPM has following method

  public byte[] get(Lob lob) {
  |     if (lob.cachedBytes!=null) {
  |       return lob.cachedBytes;
  |     }
  |     java.sql.Blob sqlBlob = lob.blob;
  |     if (sqlBlob!=null) {
  |       try {
  |         return sqlBlob.getBytes(1, (int) sqlBlob.length());
  |       } catch (SQLException e) {
  |         throw new JbpmException("couldn't extract bytes out of blob", e);
  |       }
  |     } 
  |     return null;
  |   }

The highlighted one is calling hibernate code, and then use the lob locator. If it is new deployment with the test, the cachedBytes is return, therefore, no problem. 

When we start process from existing deployment. it call this.

     log.trace("loading deployment "+deploymentId+" from db");
  |       DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class, Long.parseLong(deploymentId));
  |       deployerManager.deploy(deployment);
  |       object = repositoryCache.get(deploymentId, objectName);
  |       if (object==null) {
  |         throw new JbpmException("deployment "+deploymentId+" doesn't contain object "+objectName);
  |       }

The highlighted code does the loading from db. But it will not load blob data and just have lob locator instead. Then the  deployerManager.deploy(deployment); 
will call the lob locator to get data. And it is not happy because the resultset is closed by then. Therefore, exception in the original post happened.

I finally get around it by specifying the jdbc properties 
<prop key="lob threshold">1048576</prop>	

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264917#4264917

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264917

More information about the jboss-user mailing list