This is looking like a classloader issue. I assume your function is correctly implementing the org.drools.runtime.rule.AccumulateFunction, as you mention that it works outside of guvnor. So my guess is that your function jar is being loaded by a classloader in a different hierarchy and that is raising the CCE?

   Edson

2011/7/25 Melton, Michael P CTR SPAWARSYSCEN-ATLANTIC, 01200 <michael.melton.ctr@navy.mil>
I am having trouble getting my rule package, which contains a reference to a custom accumulate function, to compile within Guvnor (5.2.0.Final on JBoss AS 5.1.0.GA).  I have been using the same rules as DRL files without issue in Eclipse.  I have tests which exercise the accumulate function and they are all passing.  The error I get from Guvnor when I try to build the package is:
 
Service method 'public abstract org.drools.guvnor.client.rpc.BuilderResult org.drools.guvnor.client.rpc.PackageService.buildPackage(java.lang.String,boolean,java.lang.String,java.lang.String,java.lang.String,boolean,java.lang.String,java.lang.String,boolean,java.lang.String) throws com.google.gwt.user.client.rpc.SerializationException' threw an unexpected exception: java.lang.ClassCastException: test.accumulate.BigIntegerSumAccumulateFunction cannot be cast to org.drools.runtime.rule.AccumulateFunction
 
I've isolated the problem into a reproducible test, or rather a set of steps:
1. Compile the attached BigIntegerSumAccumulateFunction.java into a jar and copy the jar to the JBoss server's lib folder.
2. Start up JBoss.
3. Create a new package in Guvnor.  I called mine "test".
4. Create a new fact that has a numeric property.  Here's mine:
   declare Foo
      value : int
   end
5. Upload the attached drools.packagebuilder.conf to the Guvnor package.
6. Create a new rule that references the custom accumulate function:
   when
      BigInteger() from accumulate( Foo( $v : value), bigIntegerSum( $v ) )
   then
      System.out.println("test");
7. Try to build the binary package in Guvnor.  The error listed above occurs.  Please see the end of this email for a full stack trace.
 
It's telling me that my custom accumulate function can't be cast to org.drools.runtime.rule.AccumulateFunction, but I have a unit test (also attached) that proves that it can.  Again, I have other tests which exercise rules that reference the accumulate function and they compile and work fine.
 
Any thoughts?  Why does the Guvnor compiler work differently from when I build my knowledge base in code?
 
Thanks in advance for any assistance.
 
Mike Melton
 
 
FULL STACK TRACE:
 
java.lang.ClassCastException: test.accumulate.BigIntegerSumAccumulateFunction cannot be cast to org.drools.runtime.rule.AccumulateFunction
 at org.drools.compiler.PackageBuilderConfiguration.loadAccumulateFunction(PackageBuilderConfiguration.java:491)
 at org.drools.compiler.PackageBuilderConfiguration.buildAccumulateFunctionsMap(PackageBuilderConfiguration.java:440)
 at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:177)
 at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:148)
 at org.drools.guvnor.server.builder.BRMSPackageBuilder.getPackageBuilderConfiguration(BRMSPackageBuilder.java:134)
 at org.drools.guvnor.server.builder.BRMSPackageBuilder.<init>(BRMSPackageBuilder.java:67)
 at org.drools.guvnor.server.builder.AssemblerBase.createBuilder(AssemblerBase.java:46)
 at org.drools.guvnor.server.builder.PackageAssembler.createBuilder(PackageAssembler.java:35)
 at org.drools.guvnor.server.builder.AssemblerBase.<init>(AssemblerBase.java:42)
 at org.drools.guvnor.server.builder.PackageAssemblerBase.<init>(PackageAssemblerBase.java:44)
 at org.drools.guvnor.server.builder.PackageAssembler.<init>(PackageAssembler.java:49)
 at org.drools.guvnor.server.RepositoryPackageOperations.buildPackage(RepositoryPackageOperations.java:522)
 at org.drools.guvnor.server.RepositoryPackageOperations.buildPackage(RepositoryPackageOperations.java:480)
 at org.drools.guvnor.server.RepositoryPackageService.buildPackage(RepositoryPackageService.java:299)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
 at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
 at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
 at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
 at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
 at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:157)
 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
 at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
 at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
 at org.drools.guvnor.server.RepositoryPackageService_$$_javassist_7.buildPackage(RepositoryPackageService_$$_javassist_7.java)
 at org.drools.guvnor.server.RepositoryServiceServlet.buildPackage(RepositoryServiceServlet.java:282)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
 at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
 at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
 at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
 at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
 at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:662)

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com