10 Replies Latest reply on Sep 18, 2012 12:44 PM by David Ward

    Do you need to have the context and message.content  already set with the facts in guvnor to repeat the same in switchyard configurations?

    Japheth Odonya Newbie

      I have a switchayard rule service configuration that looks like this

       

       

      In the xml

       

      <component name="TradeRules">

                                    <implementation.rules xmlns="urn:switchyard-component-rules:config:1.0"

                                              agent="true" clock="REALTIME" eventProcessing="CLOUD"

                                              multithreadEvaluation="false">

                                              <action name="send" type="FIRE_ALL_RULES" />

                                              <resource location="META-INF/ChangeSet.xml" type="CHANGE_SET" />

                                     </implementation.rules>

                                    <service name="TradeRules">

                                              <interface.java interface="com.magick.magicktrader.trade.TradeRules" />

                                    </service>

                          </component>

       

      and then

      for the annotation

       

      @Rules(value=TradeRules.class, facts={

                          @Mapping(expression="context['tradeOrder']", expressionType=ExpressionType.MVEL, contextScope=Scope.OUT),

                    @Mapping(expression="message.content.tick")

      }

      )

      public interface TradeRules extends Trade {

                @Override

                @FireAllRules

                public void send(TradeOrder tradeOrder);

      }

       

       

       

      I am using both because,

       

      1) I could not set the resource type in the annotation, they is no way of providing the resource type attribute in the annotation, you can only specify location which I provide the changeset , but if you leave out the type attribute, switchyard provides xml as the default type while I needed to set CHANGE_SET, this works well in xml

      2) It seemed like when I set facts using xml , my expressions were being ignored.

       

      Now, the main issue is , when I set up my configs as above, on deploying to jboss, I get the error,

       

      13:02:46,896 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-5) WELD-000119 Not generating any bean definitions from com.magick.magicktrader.trade.TradeRules because of underlying class loading error

      13:02:46,897 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-5) catching: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class com.magick.magicktrader.trade.TradeRules

                at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:167) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.weld.bootstrap.BeanDeployer.loadWeldClass(BeanDeployer.java:108) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:79) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_10]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_10]

                at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_10]

      Caused by: java.lang.TypeNotPresentException: Type org.switchyard.component.common.rules.Mapping not present

                at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:98) [rt.jar:1.6.0_10]

                at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:107) [rt.jar:1.6.0_10]

                at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:370) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:181) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseAnnotationArray(AnnotationParser.java:694) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:466) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:286) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69) [rt.jar:1.6.0_10]

                at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52) [rt.jar:1.6.0_10]

                at java.lang.Class.initAnnotationsIfNecessary(Class.java:3072) [rt.jar:1.6.0_10]

                at java.lang.Class.getAnnotations(Class.java:3052) [rt.jar:1.6.0_10]

                at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:119) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:59) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:50) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)

                at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)

                at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)

                at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)

                at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)

                at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:163) [weld-core-1.1.6.Final.jar:2012-03-21 18:52]

                ... 12 more

      Caused by: java.lang.ClassNotFoundException: org.switchyard.component.common.rules.Mapping from [Module "deployment.magicktrader.jar:main" from Service Module Loader]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [rt.jar:1.6.0_10]

                at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_10]

                at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_10]

                at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:95) [rt.jar:1.6.0_10]

                ... 33 more

       

      Initially this error used to come when I could not get the drules resources, I think it could be the same here, but them what is wrong with this configuration? The surprising thing is if I remove facts and use globals, everything works fine, but I need to use facts to get out data from the rule execution.

       

      Note: I updated my switchyard using maven -U clean install  -- courtesy of Keith Babo, that is when my version was old and I needed to get up to date.

       

      Thanks in advance.