aldettinger opened a new issue, #6838:
URL: https://github.com/apache/camel-quarkus/issues/6838
### Bug description
When trying to user a Quarkus LangChain4j AI service by interface type as
below:
```
@RegisterAiService
@ApplicationScoped
public interface MyAiService {
@UserMessage("My Prompt")
@Handler
String chat(String question);
}
...
@Override
public void configure() {
from("...")
.bean(MyAiService.class);
}
```
Then, the stack trace below is produced:
```
java.lang.RuntimeException: java.lang.RuntimeException: Failed to start
quarkus
at
io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:628)
at
io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:712)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at
io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:305)
at
io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:241)
at
io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:595)
at
io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:645)
... 1 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
org.apache.camel.FailedToCreateRouteException: Failed to create route route2
at: >>>
Bean[org.apache.camel.quarkus.component.langchain.it.AiServiceResolvedByInterface]
<<< in route: Route(route2)[From[direct:ai-service-should-be-resolvable-by...
because of The bean is an interface type: interface
org.apache.camel.quarkus.component.langchain.it.AiServiceResolvedByInterface.
Interfaces are only supported to lookup in the Camel registry for a single
instance of such type. Otherwise the bean must be a class type.
at
org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:49)
at
io.quarkus.deployment.steps.CamelBootstrapProcessor$boot548544167.deploy_0(Unknown
Source)
at
io.quarkus.deployment.steps.CamelBootstrapProcessor$boot548544167.deploy(Unknown
Source)
... 8 more
Caused by: java.lang.RuntimeException:
org.apache.camel.FailedToCreateRouteException: Failed to create route route2
at: >>>
Bean[org.apache.camel.quarkus.component.langchain.it.AiServiceResolvedByInterface]
<<< in route: Route(route2)[From[direct:ai-service-should-be-resolvable-by...
because of The bean is an interface type: interface
org.apache.camel.quarkus.component.langchain.it.AiServiceResolvedByInterface.
Interfaces are only supported to lookup in the Camel registry for a single
instance of such type. Otherwise the bean must be a class type.
at
org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:65)
at
org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:47)
... 10 more
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route2 at: >>>
Bean[org.apache.camel.quarkus.component.langchain.it.AiServiceResolvedByInterface]
<<< in route: Route(route2)[From[direct:ai-service-should-be-resolvable-by...
because of The bean is an interface type: interface
org.apache.camel.quarkus.component.langchain.it.AiServiceResolvedByInterface.
Interfaces are only supported to lookup in the Camel registry for a single
instance of such type. Otherwise the bean must be a class type.
at
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:235)
at
org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:86)
at
org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:726)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:592)
at
org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2433)
at
org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:195)
at
org.apache.camel.support.service.BaseService.init(BaseService.java:85)
at
org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2068)
at
org.apache.camel.support.service.BaseService.start(BaseService.java:115)
at
org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2087)
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:211)
at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:91)
at
org.apache.camel.support.service.BaseService.start(BaseService.java:123)
at
org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:137)
at
org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
... 11 more
Caused by: java.lang.IllegalArgumentException: The bean is an interface
type: interface
org.apache.camel.quarkus.component.langchain.it.AiServiceResolvedByInterface.
Interfaces are only supported to lookup in the Camel registry for a single
instance of such type. Otherwise the bean must be a class type.
at
org.apache.camel.component.bean.DefaultBeanProcessorFactory.createBeanProcessor(DefaultBeanProcessorFactory.java:161)
at
org.apache.camel.reifier.BeanReifier.createProcessor(BeanReifier.java:49)
at
org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:893)
at
org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:629)
at
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:231)
... 26 more
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]