Thanks for the response. I have tried that actually. Left it out of the code snippet by accident. I  have tired both:

import org.jboss.seam.log.Log

global Log log

as well as:

global import org.jboss.seam.log.Log log

and neither made a difference.

Earnie!

----- Original Message ----
From: Ingomar Otter <iotter@mac.com>
To: Rules Users List <rules-users@lists.jboss.org>
Sent: Thursday, September 11, 2008 12:42:43 PM
Subject: Re: [rules-users] Problem with setting a Global

You have to declare the global in the rule package.
   
global foo.bar.Logger  logger;

--Ingomar
Am 11.09.2008 um 18:24 schrieb Earnest Dyke:

> Greetings all,
>
> I have the following Java code and rule. When executed I get an 
> "Unexpected Global" exception (see below). What am I doing wrong?
>
> ....
> @In WorkingMemory wm
>
> @Logger Log log;
>
> public void calculate() {
>        wm.setGlobal("logger",log);
>        wm.insert(calcResult);
>        wm.fireAllRules();
> }
>
>
> rule "Calc"
>    when
>        $c : CalcResult();
>    then
>        log(drools.getRule().getName(),log);
>    // Do calculation
> end
>
> function void log(String msg, Log log) {
>    log.debug(msg,new Object[]{});
> }
>
> When the calculate method is executed I get the following exception:
>
>
> java.lang.RuntimeException: Unexpected global [logger]
>     at 
> org
> .drools
> .common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:
> 367)
>     at 
> org.ebsinc.ia.action.AnalysisAction.createData(AnalysisAction.java:93)
>     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:585)
>     at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
>     at 
> org
> .jboss
> .seam
> .intercept.RootInvocationContext.proceed(RootInvocationContext.java:
> 31)
>     at 
> org
> .jboss
> .seam
> .intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:
> 56)
>     at 
> org
> .jboss
> .seam
> .core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
>     at 
> org
> .jboss
> .seam
> .intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:
> 68)
>     at 
> org
> .jboss
> .seam
> .persistence
> .ManagedEntityIdentityInterceptor
> .aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
>     at 
> org
> .jboss
> .seam
> .intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:
> 68)
>     at 
> org
> .jboss
> .seam
> .transaction
> .RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
>     at 
> org
> .jboss
> .seam
> .intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:
> 68)
>     at 
> org
> .jboss
> .seam
> .core
> .MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:
> 42)
>     at 
> org
> .jboss
> .seam
> .intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:
> 68)
>     at 
> org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:
> 106)
>     at 
> org
> .jboss
> .seam
> .intercept
> .JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
>     at 
> org
> .jboss
> .seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:
> 91)
>     at org.ebsinc.ia.action.AnalysisAction_$
> $_javassist_9.createData(AnalysisAction_$$_javassist_9.java)
>     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:585)
>     at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
>     at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:
> 125)
>     at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
>     at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
>     at org.jboss.seam.Component.newInstance(Component.java:1968)
>     at org.jboss.seam.Component.getInstance(Component.java:1865)
>     at org.jboss.seam.Component.getInstance(Component.java:1832)
>     at org.jboss.seam.Component.getInstanceFromFactory(Component.java:
> 1911)
>     at org.jboss.seam.Component.getInstance(Component.java:1855)
>     at org.jboss.seam.Component.getInstance(Component.java:1832)
>     at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
>     at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
>     at org.jboss.seam.Namespace.get(Namespace.java:28)
>     at 
> org
> .jboss.seam.el.SeamELResolver.resolveInNamespace(SeamELResolver.java:
> 197)
>     at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:57)
>     at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
>     at 
> com
> .sun
> .faces
> .el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:
> 64)
>     at 
> org
> .jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
>     at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
>     at 
> org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:
> 186)
>     at 
> com
> .sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:
> 71)
>     at 
> javax
> .faces
> .component
> .ValueBindingValueExpressionAdapter
> .getValue(ValueBindingValueExpressionAdapter.java:102)
>     at com.sun.facelets.component.UIRepeat.getValue(UIRepeat.java:143)
>     at com.sun.facelets.component.UIRepeat.getDataModel(UIRepeat.java:
> 121)
>     at com.sun.facelets.component.UIRepeat.setIndex(UIRepeat.java:305)
>     at com.sun.facelets.component.UIRepeat.process(UIRepeat.java:333)
>     at com.sun.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:
> 617)
>     at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:
> 248)
>     at 
> org
> .jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:
> 213)
>     at org.jboss.seam.pdf.ui.ITextComponent.encode(ITextComponent.java:
> 248)
>     at 
> org
> .jboss.seam.pdf.ui.ITextComponent.encodeChildren(ITextComponent.java:
> 213)
>     at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
>     at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
>     at 
> com
> .sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:
> 592)
>     at 
> org
> .ajax4jsf
> .application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:
> 108)
>     at 
> org
> .ajax4jsf
> .application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
>     at 
> com
> .sun
> .faces
> .lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
>     at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:
> 251)
>     at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:
> 144)
>     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
>     at sun.reflect.GeneratedMethodAccessor621.invoke(Unknown Source)
>     at 
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at org.apache.catalina.security.SecurityUtil
> $1.run(SecurityUtil.java:244)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
>     at 
> org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:
> 276)
>     at 
> org
> .apache
> .catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
>     at 
> org
> .apache
> .catalina
> .core
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
> 283)
>     at org.apache.catalina.core.ApplicationFilterChain.access
> $000(ApplicationFilterChain.java:56)
>     at org.apache.catalina.core.ApplicationFilterChain
> $1.run(ApplicationFilterChain.java:189)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at 
> org
> .apache
> .catalina
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
>     at org.jboss.seam.servlet.SeamFilter
> $FilterChainImpl.doFilter(SeamFilter.java:83)
>     at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:
> 85)
>     at org.jboss.seam.servlet.SeamFilter
> $FilterChainImpl.doFilter(SeamFilter.java:69)
>     at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:
> 64)
>     at org.jboss.seam.servlet.SeamFilter
> $FilterChainImpl.doFilter(SeamFilter.java:69)
>     at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
>     at org.jboss.seam.servlet.SeamFilter
> $FilterChainImpl.doFilter(SeamFilter.java:69)
>     at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:
> 154)
>     at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
>     at 
> org
> .ajax4jsf
> .webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
>     at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
>     at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
>     at org.jboss.seam.servlet.SeamFilter
> $FilterChainImpl.doFilter(SeamFilter.java:69)
>     at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
>     at org.jboss.seam.servlet.SeamFilter
> $FilterChainImpl.doFilter(SeamFilter.java:69)
>     at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
>     at sun.reflect.GeneratedMethodAccessor1504.invoke(Unknown Source)
>     at 
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at org.apache.catalina.security.SecurityUtil
> $1.run(SecurityUtil.java:244)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
>     at 
> org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:
> 276)
>     at 
> org
> .apache
> .catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:218)
>     at 
> org
> .apache
> .catalina
> .core
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
> 230)
>     at org.apache.catalina.core.ApplicationFilterChain.access
> $000(ApplicationFilterChain.java:56)
>     at org.apache.catalina.core.ApplicationFilterChain
> $1.run(ApplicationFilterChain.java:189)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at 
> org
> .apache
> .catalina
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
>     at 
> org
> .jboss
> .web
> .tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>     at sun.reflect.GeneratedMethodAccessor620.invoke(Unknown Source)
>     at 
> sun
> .reflect
> .DelegatingMethodAccessorImpl
> .invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:585)
>     at org.apache.catalina.security.SecurityUtil
> $1.run(SecurityUtil.java:244)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
>     at 
> org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:
> 276)
>     at 
> org
> .apache
> .catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:218)
>     at 
> org
> .apache
> .catalina
> .core
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
> 230)
>     at org.apache.catalina.core.ApplicationFilterChain.access
> $000(ApplicationFilterChain.java:56)
>     at org.apache.catalina.core.ApplicationFilterChain
> $1.run(ApplicationFilterChain.java:189)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at 
> org
> .apache
> .catalina
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
>     at 
> org
> .apache
> .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
> 230)
>     at 
> org
> .apache
> .catalina.core.StandardContextValve.invoke(StandardContextValve.java:
> 175)
>     at 
> org
> .jboss
> .web
> .tomcat
> .security
> .SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
>     at 
> org
> .apache
> .catalina
> .authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
>     at 
> org
> .jboss
> .web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
>     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:
> 157)
>     at 
> org
> .apache
> .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
> 109)
>     at 
> org
> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
> 262)
>     at 
> org
> .apache.coyote.http11.Http11Processor.process(Http11Processor.java:
> 844)
>     at org.apache.coyote.http11.Http11Protocol
> $Http11ConnectionHandler.process(Http11Protocol.java:583)
>     at org.apache.tomcat.util.net.JIoEndpoint
> $Worker.run(JIoEndpoint.java:446)
>     at java.lang.Thread.run(Thread.java:
> 595)_______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

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