1 Reply Latest reply on Jun 25, 2012 1:29 AM by Tomohisa igarashi

    Problems with Java Object validator

    Eduardo de Vera Toquero Newbie

      I am trying the @Validator with java objects and I have run into the following problem when running the attached test:

       

      {code}

      23:56:24,442 INFO  [weld.Version] WELD-000900 1.1.0 (Final)

      23:56:24,481 INFO  [weld.Bootstrap] WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.

      23:56:24,860 WARN  [util.InterceptionTypeRegistry] Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled

      23:56:24,860 WARN  [util.InterceptionTypeRegistry] Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled

      23:56:25,219 INFO  [converter.AnnotationTypeConverterLoader] Found 3 packages with 15 @Converter classes to load

      23:56:25,242 INFO  [converter.DefaultTypeConverter] Loaded 170 core type converters (total 170 type converters)

      23:56:25,249 INFO  [converter.AnnotationTypeConverterLoader] Loaded 4 @Converter classes

      23:56:25,360 INFO  [converter.AnnotationTypeConverterLoader] Found 1 packages with 3 @Converter classes to load

      23:56:25,375 INFO  [converter.DefaultTypeConverter] Loaded additional 34 type converters (total 204 type converters) in 0.130 seconds

      23:56:25,431 INFO  [impl.DefaultCamelContext] Apache Camel 2.9.2 (CamelContext: camel-2) is starting

      23:56:25,432 INFO  [management.ManagementStrategyFactory] JMX enabled. Using ManagedManagementStrategy.

      23:56:25,488 INFO  [management.DefaultManagementLifecycleStrategy] StatisticsLevel at All so enabling load performance statistics

      23:56:25,542 INFO  [converter.AnnotationTypeConverterLoader] Found 3 packages with 15 @Converter classes to load

      23:56:25,551 INFO  [converter.DefaultTypeConverter] Loaded 170 core type converters (total 170 type converters)

      23:56:25,553 INFO  [converter.AnnotationTypeConverterLoader] Loaded 4 @Converter classes

      23:56:25,634 INFO  [converter.AnnotationTypeConverterLoader] Found 1 packages with 3 @Converter classes to load

      23:56:25,637 INFO  [converter.DefaultTypeConverter] Loaded additional 34 type converters (total 204 type converters) in 0.086 seconds

      23:56:25,656 INFO  [impl.DefaultCamelContext] Total 0 routes, of which 0 is started.

      23:56:25,656 INFO  [impl.DefaultCamelContext] Apache Camel 2.9.2 (CamelContext: camel-2) started in 0.225 seconds

      23:56:25,845 INFO  [impl.DefaultCamelContext] Route: route1 started and consuming from: Endpoint[switchyard://ServiceA?namespace=urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT]

      23:56:25,912 INFO  [route1] From serviceA

      23:56:25,921 ERROR [processor.DefaultErrorHandler] Failed delivery for (MessageId: ID-macbookpro-62038-1340574985081-1-1 on ExchangeId: ID-macbookpro-62038-1340574985081-1-2). Exhausted after delivery attempt: 1 caught: org.switchyard.exception.SwitchYardException: Error converting from 'com.example.switchyard.switchyard_example.BeanA' to 'boolean'.  Transformer 'org.switchyard.component.camel.transformer.CamelTransformer' returned null.

      org.switchyard.exception.SwitchYardException: Error converting from 'com.example.switchyard.switchyard_example.BeanA' to 'boolean'.  Transformer 'org.switchyard.component.camel.transformer.CamelTransformer' returned null.

                at org.switchyard.internal.DefaultMessage.getContent(DefaultMessage.java:118)

                at org.switchyard.handlers.ValidateHandler.applyValidator(ValidateHandler.java:111)

                at org.switchyard.handlers.ValidateHandler.handleMessage(ValidateHandler.java:69)

                at org.switchyard.internal.DefaultHandlerChain.handleMessage(DefaultHandlerChain.java:148)

                at org.switchyard.internal.DefaultHandlerChain.handle(DefaultHandlerChain.java:121)

                at org.switchyard.internal.LocalDispatcher.dispatch(LocalExchangeBus.java:72)

                at org.switchyard.internal.ExchangeImpl.sendInternal(ExchangeImpl.java:267)

                at org.switchyard.internal.ExchangeImpl.send(ExchangeImpl.java:184)

                at org.switchyard.component.camel.SwitchYardProducer.process(SwitchYardProducer.java:89)

                at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)

                at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)

                at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:333)

                at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:223)

                at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)

                at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)

                at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)

                at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)

                at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50)

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

                at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)

                at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)

                at org.switchyard.component.camel.SwitchYardConsumer.invokeCamelProcessor(SwitchYardConsumer.java:92)

                at org.switchyard.component.camel.SwitchYardConsumer.handleMessage(SwitchYardConsumer.java:63)

                at org.switchyard.internal.DefaultHandlerChain.handleMessage(DefaultHandlerChain.java:148)

                at org.switchyard.internal.DefaultHandlerChain.handle(DefaultHandlerChain.java:121)

                at org.switchyard.internal.LocalDispatcher.dispatch(LocalExchangeBus.java:72)

                at org.switchyard.internal.ExchangeImpl.sendInternal(ExchangeImpl.java:267)

                at org.switchyard.internal.ExchangeImpl.send(ExchangeImpl.java:184)

                at org.switchyard.test.Invoker.sendInOnly(Invoker.java:202)

                at com.example.switchyard.switchyard_example.MyServiceTest.testService(MyServiceTest.java:29)

                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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)

                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)

                at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

                at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)

                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

                at org.switchyard.test.SwitchYardRunner.run(SwitchYardRunner.java:78)

                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)

      23:56:25,925 ERROR [internal.DefaultHandlerChain] org.switchyard.HandlerException was thrown by handler(provider): org.switchyard.exception.SwitchYardException: Error converting from 'com.example.switchyard.switchyard_example.BeanA' to 'boolean'.  Transformer 'org.switchyard.component.camel.transformer.CamelTransformer' returned null. --- Caused by org.switchyard.exception.SwitchYardException: Error converting from 'com.example.switchyard.switchyard_example.BeanA' to 'boolean'.  Transformer 'org.switchyard.component.camel.transformer.CamelTransformer' returned null.

      {code}

       

      It looks as if the validator was taken as a @Transformer as I see an attempt from Camel to tranform from the BeanA to the boolean returned by the validator.

       

      Attached are the sources of the project.