Hi guys,
I am newbie in this kind of things, but I am facing some difficults to use
Smooks 1.4 an d Drools 5.2. It seams that MVEL2 present in the drools 5.2
distribution is not compatible with Smooks 1.4.
Did anybody have similar problems ?
If a have a separate project, which uses Smooks 1.4, my program is able to
read a CSV file and convert it to Java Bean List, in fact, a Java List.
However, If I use the same structure to read information from a CSV file and
insert hem into a Drools Rule Engine, I got the error right below: Does
anybody know how I can fix that ?
This is my smooks configuration file:
<?xml version="1.0"?>
<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.3.xsd"
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.3.xsd">
<params>
<param name="stream.filter.type">SAX</param>
</params>
<csv:reader
fields="alarmName,Ne,board,serialNumber,slot,subrack,startDate,startTime,endDate,endTime"
skipLines="1"/>
<jb:bean beanId="transformedProps"
class="java.util.HashMap"
createOnElement="csv-record">
<jb:value property="@alarmName"
data="csv-record/alarmName" />
<jb:value property="@Ne" data="csv-record/Ne" />
<jb:value property="@board"
data="csv-record/board"/>
<jb:value property="@serialNumber"
data="csv-record/serialNumber"/>
<jb:value property="@slot" data="csv-record/slot"/>
<jb:value property="@subrack"
data="csv-record/subrack"/>
<jb:value property="@startDate"
data="csv-record/startDate"/>
<jb:value property="@startTime"
data="csv-record/startTime"/>
<jb:value property="@endDate"
data="csv-record/endDate"/>
<jb:value property="@endTime"
data="csv-record/endTime"/>
</jb:bean>
<jb:bean beanId="ListOfalarms" class="java.util.ArrayList"
createOnElement="csv-set">
<jb:wiring beanIdRef="alarms" />
</jb:bean>
<jb:bean beanId="alarms"
class="br.com.lavoisierfarias.correlator.model.Alarm"
createOnElement="csv-record">
<jb:value property="alarmName"
data="csv-record/alarmName"/>
<jb:value property="Ne" data="csv-record/ne"/>
<jb:value property="board" data="csv-record/board"/>
<jb:value property="serialNumber"
data="csv-record/serialNumber"/>
<jb:value property="slot" data="csv-record/slot"/>
<jb:value property="subrack"
data="csv-record/subrack"/>
<jb:wiring property="alarm" beanIdRef="Alarm" />
<jb:expression property="startDate"
execOnElement="csv-record">
startDate = transformedProps["startDate"] + " " +
transformedProps["startTime"];
new java.text.SimpleDateFormat("dd/MM/yyyy
HH:mm:ss").parse(startDate)
</jb:expression>
<jb:value property="endDate" decoder="Date"
data="csv-record/endDate">
<jb:decodeParam
name="format">dd/MM/yyyy</jb:decodeParam>
</jb:value>
<jb:value property="endTime" decoder="Date"
data="csv-record/endTime">
<jb:decodeParam name="format">HH:mm:ss</jb:decodeParam>
</jb:value>
</jb:bean>
</smooks-resource-list>
This is an example of the file that has to bew parsed:
*
alarmName,Ne,board,serialNumber,slot,subrack,startDate,startTime,endDate,endTime
*
Tempo de resposta excedido
(sc),SCSBS_SBSDWDM012,SPVL-4#2702,SPVL-4#2702,11,1,01/05/2011,09:01:43,01/05/2011,09:02:29
Tempo de resposta excedido
(sc),SCSBS_SBSDWDM012,SPVL-4#2702,SPVL-4#2702,11,1,01/05/2011,09:01:43,01/05/2011,09:02:29
Tempo de resposta excedido
(sc),SCSBS_SBSDWDM012,SPVL-4#2702,SPVL-4#2702,11,1,01/05/2011,09:01:43,01/05/2011,09:02:29
Erro that I got:
org.milyn.cdr.SmooksConfigurationException: Error invoking @Initialize
method 'initialize' on class 'org.milyn.javabean.BeanInstancePopulator'.
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:457)
at
org.milyn.cdr.annotation.Configurator.initialise(Configurator.java:439)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:91)
at org.milyn.cdr.annotation.Configurator.configure(Configurator.java:66)
at
org.milyn.delivery.JavaContentHandlerFactory.create(JavaContentHandlerFactory.java:63)
at
org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.addCDU(ContentDeliveryConfigBuilder.java:623)
at
org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyCDUStrategy(ContentDeliveryConfigBuilder.java:548)
at
org.milyn.delivery.ContentDeliveryConfigBuilder$ContentHandlerExtractionStrategy.applyStrategy(ContentDeliveryConfigBuilder.java:536)
at
org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.iterate(ContentDeliveryConfigBuilder.java:711)
at
org.milyn.delivery.ContentDeliveryConfigBuilder$SmooksResourceConfigurationTableIterator.access$300(ContentDeliveryConfigBuilder.java:690)
at
org.milyn.delivery.ContentDeliveryConfigBuilder.extractContentHandlers(ContentDeliveryConfigBuilder.java:484)
at
org.milyn.delivery.ContentDeliveryConfigBuilder.load(ContentDeliveryConfigBuilder.java:349)
at
org.milyn.delivery.ContentDeliveryConfigBuilder.getConfig(ContentDeliveryConfigBuilder.java:146)
at
org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:91)
at
org.milyn.container.standalone.StandaloneExecutionContext.<init>(StandaloneExecutionContext.java:65)
at org.milyn.Smooks.createExecutionContext(Smooks.java:411)
at org.milyn.Smooks.createExecutionContext(Smooks.java:374)
at
br.com.lavoisierfarias.correlator.readers.CSVSmookReader.runSmooksTransform(CSVSmookReader.java:52)
at
br.com.lavoisierfarias.correlator.readers.CSVSmookReader.getAlarmList(CSVSmookReader.java:99)
at
br.com.lavoisierfarias.correlator.AlarmTest.testLoadAlarmsFromSmookFile(AlarmTest.java:277)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: [Error: unterminated '[']
[Near : {... startDate = transformedProps["startDate"] ....}]
^
[Line: 1, Column: 13]
at
org.mvel2.compiler.PropertyVerifier.getCollectionProperty(PropertyVerifier.java:361)
at
org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:123)
at
org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:390)
at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:283)
at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2137)
at org.mvel2.ast.AssignmentNode.<init>(AssignmentNode.java:66)
at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:797)
at
org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:135)
at
org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:69)
at org.mvel2.MVEL.compileExpression(MVEL.java:808)
at org.mvel2.MVEL.compileExpression(MVEL.java:818)
at org.mvel2.MVEL.compileExpression(MVEL.java:721)
at
org.milyn.expression.MVELExpressionEvaluator.setExpression(MVELExpressionEvaluator.java:55)
at
org.milyn.javabean.BeanInstancePopulator.initialize(BeanInstancePopulator.java:240)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.milyn.cdr.annotation.Configurator.invoke(Configurator.java:453)
... 45 more
Unhandled Exception
--
*Abraços,
Lavoisier José Leite Farias*
Skype: lavoisierfarias
Celular: 019-8122-1177
Twitter:
http://twitter.com/LavoisierFarias