netty-http @Produce / ProducerTemplate

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

netty-http @Produce / ProducerTemplate

iandi2011-online@yahoo.com.INVALID
 Hello,
 

according to https://camel.apache.org/components/latest/netty-http-component.html  this should work : netty-http:http://0.0.0.0:8080[?options]

 
In my camel 3.2 spring-boot test environment I try this :

   <dependency>
       <groupId>org.apache.camel.springboot</groupId>
       <artifactId>camel-netty-http-starter</artifactId>
   </dependency>

 
@Produce(value="netty-http:<a href="http://localhost:8765/foo?encoders=#objectEncoder&decoders=#objectDecoder">http://localhost:8765/foo?encoders=#objectEncoder&decoders=#objectDecoder")
private ProducerTemplate template;
 

with this result :
 

2020-04-29 16:02:31.006 ERROR nbo00018456 --- [main] o.s.t.c.TestContextManager               : Caught exception while allowing TestExecutionListener [org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@4ddbbdf8] to prepare test instance [de.muenchen.dept.eai.dms.consumer.DepartmentClientTest@56dfab87]

org.apache.camel.spring.GenericBeansException: Error post processing bean: de.muenchen.dept.eai.dms.consumer.DepartmentClientTest.ORIGINAL; nested exception is org.apache.camel.NoSuchEndpointException: No endpoint could be found for: http://localhost:8765/dms1, please check your classpath contains the needed Camel component jar.
       at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:168)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788)

       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:407)
       at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:120)
       at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
       at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43)
       at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:244)
       at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
       at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
       at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
       at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)

       at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)

       at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
       at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
       at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
       at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
       at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
       at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
       at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
       at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
       at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
       at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
       at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:43)
       at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
       at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
       at java.util.Iterator.forEachRemaining(Iterator.java:116)
       at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
       at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
       at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
       at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
       at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
       at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
       at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
       at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:82)
       at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:73)
       at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
       at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
       at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
       at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
       at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:137)
      at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:89)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)

Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: http://localhost:8765/dms1, please check your classpath contains the needed Camel component jar.
       at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:880)
       at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:764)
       at org.apache.camel.impl.engine.DefaultProducerTemplate.doInit(DefaultProducerTemplate.java:800)
       at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
       at org.apache.camel.support.service.ServiceHelper.initService(ServiceHelper.java:55)
       at org.apache.camel.impl.engine.AbstractCamelContext.internalAddService(AbstractCamelContext.java:1458)
       at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1403)
       at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1398)
       at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1393)
       at org.apache.camel.spring.CamelBeanPostProcessor$1$1.startService(CamelBeanPostProcessor.java:139)
       at org.apache.camel.impl.engine.CamelPostProcessorHelper.createInjectionProducerTemplate(CamelPostProcessorHelper.java:410)
       at org.apache.camel.impl.engine.CamelPostProcessorHelper.getInjectionValue(CamelPostProcessorHelper.java:230)
       at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.injectField(DefaultCamelBeanPostProcessor.java:233)
       at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.lambda$injectFields$0(DefaultCamelBeanPostProcessor.java:211)
       at org.apache.camel.util.ReflectionHelper.doWithFields(ReflectionHelper.java:108)
       at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.injectFields(DefaultCamelBeanPostProcessor.java:184)
       at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:95)
       at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:162)
       ... 49 more

 

Is this a bug or or not ?

 

These two works well :

@Produce(value="netty:tcp://localhost:8765?encoders=#objectEncoder&decoders=#objectDecoder")
private ProducerTemplate template;


ProducerTemplate template = getContext().createProducerTemplate();
template.sendBody("netty-http:<a href="http://localhost:8765/dms?encoders=#objectEncoder&decoders=#objectDecoder">http://localhost:8765/dms?encoders=#objectEncoder&decoders=#objectDecoder", new String("Hello"));
 

Regards

 
Reply | Threaded
Open this post in threaded view
|

Re: netty-http @Produce / ProducerTemplate

Claus Ibsen-2
Hi

Ah okay, can you create a JIRA ticket so we wont forget.

On Wed, Apr 29, 2020 at 5:53 PM [hidden email]
<[hidden email]> wrote:

>
>  Hello,
>
>
> according to https://camel.apache.org/components/latest/netty-http-component.html  this should work : netty-http:http://0.0.0.0:8080[?options]
>
>
> In my camel 3.2 spring-boot test environment I try this :
>
>    <dependency>
>        <groupId>org.apache.camel.springboot</groupId>
>        <artifactId>camel-netty-http-starter</artifactId>
>    </dependency>
>
>
> @Produce(value="netty-http:<a href="http://localhost:8765/foo?encoders=#objectEncoder&decoders=#objectDecoder">http://localhost:8765/foo?encoders=#objectEncoder&decoders=#objectDecoder")
> private ProducerTemplate template;
>
>
> with this result :
>
>
> 2020-04-29 16:02:31.006 ERROR nbo00018456 --- [main] o.s.t.c.TestContextManager               : Caught exception while allowing TestExecutionListener [org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@4ddbbdf8] to prepare test instance [de.muenchen.dept.eai.dms.consumer.DepartmentClientTest@56dfab87]
>
> org.apache.camel.spring.GenericBeansException: Error post processing bean: de.muenchen.dept.eai.dms.consumer.DepartmentClientTest.ORIGINAL; nested exception is org.apache.camel.NoSuchEndpointException: No endpoint could be found for: http://localhost:8765/dms1, please check your classpath contains the needed Camel component jar.
>        at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:168)
>        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416)
>        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788)
>
>        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:407)
>        at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:120)
>        at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
>        at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43)
>        at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:244)
>        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
>        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
>        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
>
>        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
>
>        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
>        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
>        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
>        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
>        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
>        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
>        at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
>        at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
>        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
>        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
>        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
>        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
>        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
>        at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:43)
>        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
>        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
>        at java.util.Iterator.forEachRemaining(Iterator.java:116)
>        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
>        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
>        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
>        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
>        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
>        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
>        at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:82)
>        at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:73)
>        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
>        at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
>        at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
>        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
>        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:137)
>       at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:89)
>        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
>        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
>        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
>        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
>        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
>
> Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: http://localhost:8765/dms1, please check your classpath contains the needed Camel component jar.
>        at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:880)
>        at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:764)
>        at org.apache.camel.impl.engine.DefaultProducerTemplate.doInit(DefaultProducerTemplate.java:800)
>        at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
>        at org.apache.camel.support.service.ServiceHelper.initService(ServiceHelper.java:55)
>        at org.apache.camel.impl.engine.AbstractCamelContext.internalAddService(AbstractCamelContext.java:1458)
>        at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1403)
>        at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1398)
>        at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1393)
>        at org.apache.camel.spring.CamelBeanPostProcessor$1$1.startService(CamelBeanPostProcessor.java:139)
>        at org.apache.camel.impl.engine.CamelPostProcessorHelper.createInjectionProducerTemplate(CamelPostProcessorHelper.java:410)
>        at org.apache.camel.impl.engine.CamelPostProcessorHelper.getInjectionValue(CamelPostProcessorHelper.java:230)
>        at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.injectField(DefaultCamelBeanPostProcessor.java:233)
>        at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.lambda$injectFields$0(DefaultCamelBeanPostProcessor.java:211)
>        at org.apache.camel.util.ReflectionHelper.doWithFields(ReflectionHelper.java:108)
>        at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.injectFields(DefaultCamelBeanPostProcessor.java:184)
>        at org.apache.camel.impl.engine.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:95)
>        at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:162)
>        ... 49 more
>
>
>
> Is this a bug or or not ?
>
>
>
> These two works well :
>
> @Produce(value="netty:tcp://localhost:8765?encoders=#objectEncoder&decoders=#objectDecoder")
> private ProducerTemplate template;
>
>
> ProducerTemplate template = getContext().createProducerTemplate();
> template.sendBody("netty-http:<a href="http://localhost:8765/dms?encoders=#objectEncoder&decoders=#objectDecoder">http://localhost:8765/dms?encoders=#objectEncoder&decoders=#objectDecoder", new String("Hello"));
>
>
> Regards
>
>



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2