Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camel-Infinispan consumer doesn't work #2344

Closed
oscerd opened this issue Mar 18, 2021 · 16 comments
Closed

Camel-Infinispan consumer doesn't work #2344

oscerd opened this issue Mar 18, 2021 · 16 comments
Labels
bug Something isn't working
Milestone

Comments

@oscerd
Copy link
Contributor

oscerd commented Mar 18, 2021

While trying to create a kamelet source for Infinispan I found out the consumer doesn't work if the Infinispan cluster is secured.

        from("infinispan://mycache?autowiredEnabled=false&hosts=localhost&username=admin&password=password&securityRealm=default&secure=true&saslMechanism=RAW(DIGEST-MD5)&securityServerName=infinispan&eventTypes=CLIENT_CACHE_ENTRY_CREATED")
                .to("log:example");

This gives the following exception

[INFO] --- quarkus-maven-plugin:1.12.0.Final:dev (default-cli) @ camel-quarkus-examples-infinispan-log-main ---
Listening for transport dt_socket at address: 5005
2021-03-18 08:43:16,182 INFO  [io.quarkus] (Quarkus Main Thread) camel-quarkus-examples-infinispan-log-main 1.6.0-SNAPSHOT on JVM (powered by Quarkus 1.12.0.Final) started in 0.169s. 
2021-03-18 08:43:16,184 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-03-18 08:43:16,184 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [camel-core, camel-infinispan, camel-log, camel-main, camel-support-common, cdi, infinispan-client]
2021-03-18 08:43:16,218 INFO  [org.apa.cam.mai.BaseMainSupport] (Quarkus Main Thread) Auto-configuration summary
2021-03-18 08:43:16,219 INFO  [org.apa.cam.mai.BaseMainSupport] (Quarkus Main Thread)     camel.main.durationHitExitCode=15
2021-03-18 08:43:16,219 INFO  [org.apa.cam.mai.BaseMainSupport] (Quarkus Main Thread)     camel.component.log.exchangeFormatter.showBodyType=false
2021-03-18 08:43:16,219 INFO  [org.apa.cam.mai.BaseMainSupport] (Quarkus Main Thread)     camel.component.log.exchangeFormatter.showExchangePattern=false
2021-03-18 08:43:16,219 INFO  [org.apa.cam.mai.BaseMainSupport] (Quarkus Main Thread)     camel.component.log.exchangeFormatter=#class:org.apache.camel.support.processor.DefaultExchangeFormatter
2021-03-18 08:43:16,376 INFO  [org.inf.HOTROD] (Quarkus Main Thread) ISPN004021: Infinispan version: Infinispan 'Lockdown' 12.0.0.Final
2021-03-18 08:43:16,385 INFO  [org.inf.HOTROD] (HotRod-client-async-pool-1-1) ISPN004006: Server sent new topology view (id=1, age=0) containing 1 addresses: [127.0.0.1:11222]
2021-03-18 08:43:16,401 WARN  [org.inf.HOTROD] (HotRod-client-async-pool-1-1) ISPN004005: Error received from the server: java.lang.SecurityException: ISPN006017: Unauthorized 'PUT' operation
2021-03-18 08:43:16,407 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (Quarkus Main Thread) Failed to start application: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[From[infinispan://mycache?autowiredEnabled=fal... because of Failed to resolve endpoint: infinispan://mycache?autowiredEnabled=false&eventTypes=CLIENT_CACHE_ENTRY_CREATED&hosts=localhost&password=xxxxxx&saslMechanism=RAW(DIGEST-MD5)&secure=true&securityRealm=default&securityServerName=infinispan&username=admin due to: Cannot auto create component: infinispan
	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:80)
	at org.apache.camel.quarkus.core.FastCamelContext.startRouteDefinitions(FastCamelContext.java:919)
	at org.apache.camel.quarkus.core.FastCamelContext.startRouteDefinitions(FastCamelContext.java:656)
	at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2756)
	at org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:537)
	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
	at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2475)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2492)
	at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:86)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:131)
	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
	at org.apache.camel.quarkus.main.CamelMainApplication.run(CamelMainApplication.java:27)
	at org.apache.camel.quarkus.main.CamelMainApplication_ClientProxy.run(CamelMainApplication_ClientProxy.zig:129)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:122)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at org.acme.timer.Main.main(Main.java:28)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:134)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: infinispan://mycache?autowiredEnabled=false&eventTypes=CLIENT_CACHE_ENTRY_CREATED&hosts=localhost&password=xxxxxx&saslMechanism=RAW(DIGEST-MD5)&secure=true&securityRealm=default&securityServerName=infinispan&username=admin due to: Cannot auto create component: infinispan
	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:954)
	at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:831)
	at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:58)
	at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:177)
	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:94)
	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:74)
	... 24 more
Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create component: infinispan
	at org.apache.camel.impl.engine.AbstractCamelContext.getComponent(AbstractCamelContext.java:606)
	at org.apache.camel.impl.engine.AbstractCamelContext.getComponent(AbstractCamelContext.java:561)
	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:912)
	... 29 more
Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create component: infinispan
	at org.apache.camel.impl.engine.AbstractCamelContext.initComponent(AbstractCamelContext.java:671)
	at org.apache.camel.impl.engine.AbstractCamelContext.access$100(AbstractCamelContext.java:186)
	at org.apache.camel.impl.engine.AbstractCamelContext$3.apply(AbstractCamelContext.java:590)
	at org.apache.camel.impl.engine.AbstractCamelContext$3.apply(AbstractCamelContext.java:586)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
	at org.apache.camel.impl.engine.AbstractCamelContext.getComponent(AbstractCamelContext.java:586)
	... 31 more
Caused by: org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for messageId=4 returned server error (status=0x85): java.lang.SecurityException: ISPN006017: Unauthorized 'PUT' operation
	at org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:333)
	at org.infinispan.client.hotrod.impl.protocol.Codec20.readHeader(Codec20.java:172)
	at org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder.decode(HeaderDecoder.java:139)
	at org.infinispan.client.hotrod.impl.transport.netty.HintedReplayingDecoder.callDecode(HintedReplayingDecoder.java:94)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	... 1 more

2021-03-18 08:43:16,409 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for messageId=4 returned server error (status=0x85): java.lang.SecurityException: ISPN006017: Unauthorized 'PUT' operation
	at org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:333)
	at org.infinispan.client.hotrod.impl.protocol.Codec20.readHeader(Codec20.java:172)
	at org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder.decode(HeaderDecoder.java:139)
	at org.infinispan.client.hotrod.impl.transport.netty.HintedReplayingDecoder.callDecode(HintedReplayingDecoder.java:94)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

2021-03-18 08:43:16,445 INFO  [io.quarkus] (Quarkus Main Thread) camel-quarkus-examples-infinispan-log-main stopped in 0.035s

How to set up the Infinispan cluster for this purpose (version is 12.0.0.Final)

Download the zip distribution and unzip it somewhere.

Start the server

> $INFINISPAN_HOME/bin/server.sh
bin/server.sh 
18:07:32,435 INFO  (main) [BOOT] JVM OpenJDK 64-Bit Server VM AdoptOpenJDK 11.0.7+10
18:07:32,441 INFO  (main) [BOOT] JVM arguments = [-server, -Xlog:gc*:file=/home/oscerd/playground/infinispan-server-12.0.0.Final/server/log/gc.log:time,uptimemillis:filecount=5,filesize=3M, -Xms64m, -Xmx512m, -XX:MetaspaceSize=64M, -Djava.net.preferIPv4Stack=true, -Djava.awt.headless=true, -Dvisualvm.display.name=infinispan-server, -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager, -Dinfinispan.server.home.path=/home/oscerd/playground/infinispan-server-12.0.0.Final, -classpath, :/home/oscerd/playground/infinispan-server-12.0.0.Final/boot/infinispan-server-runtime-12.0.0.Final-loader.jar, org.infinispan.server.loader.Loader, org.infinispan.server.Bootstrap]
18:07:32,441 INFO  (main) [BOOT] PID = 21270
18:07:32,466 INFO  (main) [org.infinispan.SERVER] ISPN080000: Infinispan Server starting
18:07:32,466 INFO  (main) [org.infinispan.SERVER] ISPN080017: Server configuration: infinispan.xml
18:07:32,466 INFO  (main) [org.infinispan.SERVER] ISPN080032: Logging configuration: /home/oscerd/playground/infinispan-server-12.0.0.Final/server/conf/log4j2.xml
18:07:32,823 INFO  (main) [org.infinispan.SERVER] ISPN080027: Loaded extension 'query-dsl-filter-converter-factory'
18:07:32,823 INFO  (main) [org.infinispan.SERVER] ISPN080027: Loaded extension 'continuous-query-filter-converter-factory'
18:07:32,825 INFO  (main) [org.infinispan.SERVER] ISPN080027: Loaded extension 'iteration-filter-converter-factory'
18:07:32,825 INFO  (main) [org.infinispan.SERVER] ISPN080027: Loaded extension 'jdk.nashorn.api.scripting.NashornScriptEngineFactory'
18:07:33,172 INFO  (main) [org.infinispan.CONTAINER] ISPN000556: Starting user marshaller 'org.infinispan.commons.marshall.ImmutableProtoStreamMarshaller'
18:07:33,262 WARN  (main) [org.infinispan.PERSISTENCE] ISPN000554: jboss-marshalling is deprecated and planned for removal
18:07:33,545 INFO  (main) [org.infinispan.query.remote.impl.ProtobufMetadataManagerImpl] ISPN028019: Registering protostream serialization context initializer: org.infinispan.query.core.stats.impl.PersistenceContextInitializerImpl
18:07:33,547 INFO  (main) [org.infinispan.CONTAINER] ISPN000128: Infinispan version: Infinispan 'Lockdown' 12.0.0.Final
18:07:33,687 INFO  (main) [org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack tcp
18:07:35,796 INFO  (main) [org.jgroups.protocols.pbcast.GMS] ghost-43669: no members discovered after 2002 ms: creating cluster as coordinator
18:07:35,832 INFO  (main) [org.infinispan.CLUSTER] ISPN000094: Received new cluster view for channel cluster: [ghost-43669|0] (1) [ghost-43669]
18:07:35,843 INFO  (main) [org.infinispan.CLUSTER] ISPN000079: Channel cluster local address is ghost-43669, physical addresses are [10.36.115.182:7800]
18:07:35,878 INFO  (main) [org.infinispan.CONTAINER] ISPN000390: Persisted state, version=12.0.0.Final timestamp=2021-03-01T17:07:35.875687Z
18:07:36,081 INFO  (main) [org.jboss.threads] JBoss Threads version 2.3.3.Final
18:07:36,150 INFO  (main) [org.infinispan.CONTAINER] ISPN000104: Using EmbeddedTransactionManager
18:07:36,447 INFO  (main) [org.infinispan.server.core.RequestTracer] OpenTracing integration is disabled
18:07:36,510 INFO  (ForkJoinPool.commonPool-worker-3) [org.infinispan.SERVER] ISPN080018: Started connector HotRod (internal)
18:07:36,601 INFO  (main) [org.infinispan.SERVER] ISPN080018: Started connector REST (internal)
18:07:36,762 INFO  (main) [org.infinispan.SERVER] ISPN080004: Connector SINGLE_PORT (default) listening on 127.0.0.1:11222
18:07:36,762 INFO  (main) [org.infinispan.SERVER] ISPN080034: Server 'ghost-43669' listening on http://127.0.0.1:11222
18:07:36,763 INFO  (main) [org.infinispan.SERVER] ISPN080001: Infinispan Server 12.0.0.Final started in 4296ms

Create user

> $INFINISPAN_HOME/bin/cli.sh user create admin -p "password"
> $INFINISPAN_HOME/bin/cli.sh
[disconnected]> connect
Username: admin
Password: ********
[ghost-35169@cluster//containers/default]> create cache --template=org.infinispan.DIST_SYNC mycache
[ghost-35169@cluster//containers/default]> describe caches/mycache
{
  "distributed-cache" : {
    "mode" : "SYNC",
    "remote-timeout" : 17500,
    "state-transfer" : {
      "timeout" : 60000
    },
    "locking" : {
      "concurrency-level" : 1000,
      "acquire-timeout" : 15000,
      "striping" : false
    },
    "statistics" : true
  }
}

Stop the server.

It's important to add encoding to your cache configuration, otherwise consuming events won't work.
You'll need to:

  • Edit $INFINISPAN_HOME/server/data/caches.xml

and add the encoding section in the configuration

<?xml version="1.0" ?>

<infinispan xmlns="urn:infinispan:config:12.0">
    <cache-container>
        <distributed-cache mode="SYNC" remote-timeout="17500" name="mycache" statistics="true">
            <encoding>
                <key media-type="text/plain; charset=UTF-8"/>
                <value media-type="text/plain; charset=UTF-8"/>
            </encoding>
            <locking concurrency-level="1000" acquire-timeout="15000" striping="false"/>
            <state-transfer timeout="60000"/>
        </distributed-cache>
    </cache-container></infinispan>

Restart the server.

The extension will fail immediately. The same configuration with the plain camel component seems to work fine.

I used the camel-quarkus-examples as base.

Here is the example on my fork.

oscerd/camel-quarkus-examples@cce809b

@ppalaga
Copy link
Contributor

ppalaga commented Mar 18, 2021

Thanks for the detailed reproducer, @oscerd ! It sounds like it is failing also in JVM mode?

@oscerd
Copy link
Contributor Author

oscerd commented Mar 18, 2021

Yes, both native and jvm

@ppalaga ppalaga added the bug Something isn't working label Mar 18, 2021
@jamesnetherton
Copy link
Contributor

I had a quick look at this. The problem seems to be that the endpoint autowiredEnabled URI option has no effect. AutowiredLifecycleStrategy kicks in when onComponentAdd runs and is checking CamelContext.isAutowiredEnabled().

Camel is trying to do autowiring on cacheContainer and it finds the unconfigured Quarkus RemoteCacheManager via the registry lookup (I.e the one created by the Quarkus Infinispan extension). The bean initialisation from Arc then triggers the exception you saw.

The workaround for the standalone example project would be to set property camel.context.autowired-enabled = false and the RemoteCacheManager setup will be done by Camel. Or let Quarkus handle the configuration by setting the properties mentioned here. I guess neither is possible via the Kamelet definition though?

@oscerd
Copy link
Contributor Author

oscerd commented Mar 22, 2021

Yes, I don't think it can be done with kamelet.

@jamesnetherton
Copy link
Contributor

I think this has exposed a little bug because if I tweak InfinispanTest and add a config property camel.component.infinispan.autowired-enabled=false, then it seems to be ignored:

2021-03-22 10:33:22,169 INFO  [org.apa.cam.imp.eng.AutowiredLifecycleStrategy] (main) Autowired property: cacheContainer on component: infinispan as exactly one instance of type: org.infinispan.client.hotrod.RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager) found in the registry
2021-03-22 10:33:22,180 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Auto-configuration summary
2021-03-22 10:33:22,181 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     camel.component.infinispan.autowiredEnabled=false

I can open a Camel ticket.

@oscerd
Copy link
Contributor Author

oscerd commented Apr 12, 2021

This seems to fail even with camel-k 1.4.0-SNAPSHOT, quarkus 1.8.1 and camel 3.9.0

2021-04-12 14:24:11,224 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
2021-04-12 14:24:11,230 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: file:/home/oscerd/workspace/miscellanea/camel-k-examples-collection/infinispan.yaml?language=yaml
2021-04-12 14:24:11,573 INFO  [org.inf.HOTROD] (main) ISPN004021: Infinispan version: Infinispan 'Lockdown' 12.0.1.Final
2021-04-12 14:24:11,582 INFO  [org.inf.HOTROD] (HotRod-client-async-pool-1-1) ISPN004006: Server sent new topology view (id=1, age=0) containing 1 addresses: [127.0.0.1:11222]
2021-04-12 14:24:11,617 WARN  [org.inf.HOTROD] (HotRod-client-async-pool-1-1) ISPN004005: Error received from the server: java.lang.SecurityException: ISPN006017: Unauthorized 'PUT' operation
2021-04-12 14:24:11,626 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (main) Failed to start application: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[From[infinispan:{{cacheName}}?autowiredEnabled... because of Failed to resolve endpoint: infinispan://mycache?autowiredEnabled=false&eventTypes=CLIENT_CACHE_ENTRY_MODIFIED&hosts=localhost&password=xxxxxx&saslMechanism=DIGEST-MD5&secure=true&securityRealm=default&securityServerName=infinispan&username=admin due to: Cannot auto create component: infinispan
	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:80)
	at org.apache.camel.quarkus.core.FastCamelContext.startRouteDefinitions(FastCamelContext.java:949)
	at org.apache.camel.quarkus.core.FastCamelContext.startRouteDefinitions(FastCamelContext.java:670)
	at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2771)
	at org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:546)
	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
	at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2490)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2507)
	at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:94)
	at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:139)
	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:608)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:100)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:48)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: infinispan://mycache?autowiredEnabled=false&eventTypes=CLIENT_CACHE_ENTRY_MODIFIED&hosts=localhost&password=xxxxxx&saslMechanism=DIGEST-MD5&secure=true&securityRealm=default&securityServerName=infinispan&username=admin due to: Cannot auto create component: infinispan
	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:963)
	at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:845)
	at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:58)
	at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:177)
	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:94)
	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:74)
	... 28 more
Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create component: infinispan
	at org.apache.camel.impl.engine.AbstractCamelContext.getComponent(AbstractCamelContext.java:620)
	at org.apache.camel.impl.engine.AbstractCamelContext.getComponent(AbstractCamelContext.java:575)
	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:921)
	... 33 more
Caused by: org.apache.camel.RuntimeCamelException: Cannot auto create component: infinispan
	at org.apache.camel.impl.engine.AbstractCamelContext.initComponent(AbstractCamelContext.java:685)
	at org.apache.camel.impl.engine.AbstractCamelContext.access$100(AbstractCamelContext.java:191)
	at org.apache.camel.impl.engine.AbstractCamelContext$3.apply(AbstractCamelContext.java:604)
	at org.apache.camel.impl.engine.AbstractCamelContext$3.apply(AbstractCamelContext.java:600)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
	at org.apache.camel.impl.engine.AbstractCamelContext.getComponent(AbstractCamelContext.java:600)
	... 35 more
Caused by: org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for messageId=4 returned server error (status=0x85): java.lang.SecurityException: ISPN006017: Unauthorized 'PUT' operation
	at org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:333)
	at org.infinispan.client.hotrod.impl.protocol.Codec20.readHeader(Codec20.java:172)
	at org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder.decode(HeaderDecoder.java:139)
	at org.infinispan.client.hotrod.impl.transport.netty.HintedReplayingDecoder.callDecode(HintedReplayingDecoder.java:94)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

2021-04-12 14:24:11,652 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for messageId=4 returned server error (status=0x85): java.lang.SecurityException: ISPN006017: Unauthorized 'PUT' operation
	at org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:333)
	at org.infinispan.client.hotrod.impl.protocol.Codec20.readHeader(Codec20.java:172)
	at org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder.decode(HeaderDecoder.java:139)
	at org.infinispan.client.hotrod.impl.transport.netty.HintedReplayingDecoder.callDecode(HintedReplayingDecoder.java:94)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)


@oscerd
Copy link
Contributor Author

oscerd commented Apr 12, 2021

Not completely sure, it could be related to this: apache/camel-k#2203

@jamesnetherton
Copy link
Contributor

I'll try to take another look at it. It may be that the autowiredEnabled=false URI option is not working properly, so the unconfigured Quarkus Infinispan bits are still being discovered by the component some how...

@oscerd
Copy link
Contributor Author

oscerd commented Apr 13, 2021

This happens through kamelet on camel-k, so it may be related to the reported camel-k issue. Let me see if it works with the fix @lburgazzoli is doing. I don't want you to waste your time.

@oscerd
Copy link
Contributor Author

oscerd commented Apr 15, 2021

even with the fix, the error is the same, while running the same example with camel-k 1.4.0-SNAPSHOT or camel-k staging 1.4.0

@jamesnetherton
Copy link
Contributor

I had another quick look. It is indeed still broken.

I think it's related to the order in which things happen. AutowiredLifecycleStrategy.onComponentAdd seems to run before the component or endpoint configuration is done. So disabling autowiring at the component or endpoint level is ignored (with camel-main).

@jamesnetherton
Copy link
Contributor

Created another Camel ticket:

https://issues.apache.org/jira/browse/CAMEL-16527.

@davsclaus
Copy link
Contributor

davsclaus commented Apr 19, 2021

You can turn it off on context level (as workaround)
camel.main.autowired-enabled = false

@ppalaga
Copy link
Contributor

ppalaga commented Jun 29, 2021

Filed quarkusio/quarkus#18232

@ppalaga ppalaga added this to the 2.1.0 milestone Jun 29, 2021
@jamesnetherton
Copy link
Contributor

Created a follow up to the original closed issue quarkusio/quarkus#18517.

@jamesnetherton jamesnetherton modified the milestones: 2.1.0, 2.2.0 Jul 20, 2021
@jamesnetherton
Copy link
Contributor

This is fixed in Quarkus 2.2.x. If you don't provide any quarkus.infinispan properties, then the clieant bean does not get produced to override the one managed by Camel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants