AnsweredAssumed Answered

Custom ClassLoader failing with BeanInfo & BeanCustomizer for ProcessParam

Question asked by zoikks@gmail.com on Feb 27, 2015
Latest reply on Mar 3, 2015 by jbarrez
Good afternoon,

I have built a framework for running workflows that uses Activiti 5.16.3, MySql 5.6.  The framework is written using EJB 3.1 technology and executes on WebLogic 12.1.1.  Although this is an EJB project, I have used Spring to inject the ProcessEngine into the base EJBs.

My framework is designed to allow for running many different processes.  I have attempted to write my own custom class loader that reads a directory external to the framework and classloads the necessary objects on-the-fly.  I wanted to be able to swap out an individual jar specific to a process without directly modifying any other code or rebuild the EAR (downing the server to replace a jar isn't critical at this point)

I have read some of the posting about what to watch out for while writing your own classloader (granted, I probably haven't found all the posting on classloaders yet).   I used the  setClassLoader in the ProcessEngineConfiguration to set the custom classloader and this appeared to be working properly with what I wanted to do. 

The problem I'm facing is that I have a pojo (ie org.zoikks.MyObject) that gets created in a delegate and put into the workflow.  As this happens and the workflow moves on, I see the an exception about trying to find a "BeanInfo" for the pojo (ie java.lang.ClassNotFoundException org.zoikks.MyObjectBeanInfo) and a second exception about trying to find a "Customizer" for the pojo (ie java.lang.ClassNotFoundException org.zoikks.MyObjectCustomizer)

I have traced through the code and found the call to the Introspector where  it tries to call getExplicitBeanInfo(Class<?> cls).  Immediately, it calls into my custom class loader looking for org.zoikks.MyObjectBeanInfo and org.zoikks.MyObjectCustomizer - neither of which exists in my classloader.

I have two questions:

1 - What is the purpose of the Introspector trying to get BeanInfo for a pojo?  (I assume it is for caching purposes - if so, is there a way to disable this?)

2 - Is there a way to point the Introspector to a different classloader or include the generated BeanInfos in my own classloader?

Many thanks,

- Joe

Outcomes