如何解决 - 在计划中没有找到组件:bean-validator,在karaf中?

时间:2017-06-16 22:42:46

标签: apache-camel bean-validation apache-karaf karaf

我试图在karaf 3.0.0中部署我的应用程序。安装我的软件包时,一切看起来都很好: bundle:install mvn:br.com.celsoagra/ldap-service/1.0.5-SNAPSHOT,但是当我尝试启动我的捆绑时,我收到以下错误:

org.apache.karaf.shell.console.MultiException: Error executing command on bundles:
        Unable to execute command on bundle 398: Activator start error in bundle ldap-service [398].
        at org.apache.karaf.shell.console.MultiException.throwIf(MultiException.java:92)
        at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:58)
        at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:50)
        at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:41)
        at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33)[27:org.apache.karaf.shell.console:3.0.8]
        at Proxy4f4d2f47_3eb5_4335_972a_1b1e71de30b7.execute(Unknown Source)[:]
        at Proxy4f4d2f47_3eb5_4335_972a_1b1e71de30b7.execute(Unknown Source)[:]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[27:org.apache.karaf.shell.console:3.0.8]
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
        at org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:210)
        at org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$1.runConsole(ShellFactoryImpl.java:158)[57:org.apache.karaf.shell.ssh:3.0.8]
        at org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$1$1.run(ShellFactoryImpl.java:133)
        at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_131]
        at org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:57)[28:org.apache.karaf.jaas.modules:3.0.8]
        at org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$1.run(ShellFactoryImpl.java:129)[57:org.apache.karaf.shell.ssh:3.0.8]
Caused by: java.lang.Exception: Unable to execute command on bundle 398: Activator start error in bundle ldap-service [398].
        at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:55)
        ... 20 more
Caused by: org.osgi.framework.BundleException: Activator start error in bundle ldap-service [398].
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2196)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
        at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:27)
        at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:53)
        ... 20 more
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route _processUser at: >>> To[bean-validator://x?validationProviderResolver=#myValidationProviderResolver] <<< in route: Route(_processUser)[[From[direct:insertUser]] -> [On... because of Failed to resolve endpoint: bean-validator://x?validationProviderResolver=%23myValidationProviderResolver due to: No component found with scheme: bean-validator
        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1071)
        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
        at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:1008)
        at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3397)
        at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3128)
        at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:182)
        at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2957)
        at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2953)
        at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2976)
        at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2953)
        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2920)
        at org.apache.camel.main.Main.doStart(Main.java:129)
        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at org.apache.camel.main.MainSupport.run(MainSupport.java:138)
        at pe.gov.br.ati.Activator.start(Activator.java:18)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)
        ... 25 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: bean-validator://x?validationProviderResolver=%23myValidationProviderResolver due to: No component found with scheme: bean-validator
        at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:628)
        at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:79)
        at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:211)
        at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
        at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114)
        at org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:62)
        at org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:56)
        at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:545)
        at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:506)
        at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:222)
        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1068)
        ... 42 more

以下是我的代码的一部分:

我的camel-context.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:osgi="http://www.springframework.org/schema/osgi"
    xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="     http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd     http://www.springframework.org/schema/osgi     http://www.springframework.org/schema/osgi/spring-osgi.xsd     http://www.springframework.org/schema/osgi-compendium     http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd         http://www.springframework.org/schema/context                       http://www.springframework.org/schema/context/spring-context-3.0.xsd                       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
    <osgix:cm-properties id="params.blueprint" persistent-id="params"/>
    <bean class="pe.gov.br.ati.CamelRoute" id="javaCamelRoute"/>
    <bean
        class="pe.gov.br.ati.service.HibernateValidationProviderResolver" id="myValidationProviderResolver"/>
    <camel:camelContext id="camelContext-ldap" trace="true" xmlns="http://camel.apache.org/schema/spring">
        <camel:routeBuilder ref="javaCamelRoute"/>
        <restConfiguration bindingMode="auto" component="restlet" port="8080"/>
    </camel:camelContext>
</beans>

我的CamelRoute.java文件

public class CamelRoute extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        // ...
        from("direct:insertUser").log("log ${body}")
            [....]
            .to("bean-validator://x?validationProviderResolver=#myValidationProviderResolver") 
        // ...
    }
}

这是我的捆绑列表的一部分

karaf@root()> list
START LEVEL 100 , List Threshold: 50
 ID | State     | Lvl | Version              | Name                                                               
------------------------------------------------------------------------------------------------------------------
117 | Active    |  50 | 1.1.0.Final          | Bean Validation API                                                
121 | Active    |  50 | 5.2.4.Final          | Hibernate Validator Engine                                         
123 | Active    |  50 | 2.18.1               | camel-bean-validator                                               
372 | Active    |  80 | 4.0.4.Final          | hibernate-commons-annotations                                      
373 | Active    | 100 | 4.3.6.Final          | hibernate-core                                                     
374 | Active    | 100 | 4.3.6.Final          | hibernate-entitymanager                                            
375 | Active    | 100 | 4.3.6.Final          | hibernate-osgi                                                     

编辑:

现在一切正常! 我刚刚安装了camel-bean-validator,然后{@ 1}},正如@Claus所说。

所以,我的bundle list现在有不同版本的hibernate bean验证器:

hibernate-validator

但是现在,我收到了一个新错误

karaf@root(camel)> list
START LEVEL 100 , List Threshold: 50
 ID | State     | Lvl | Version              | Name                                                               
------------------------------------------------------------------------------------------------------------------
 70 | Active    |  50 | 2.18.1               | camel-core                                                         
 71 | Active    |  50 | 2.18.1               | camel-catalog                                                      
 72 | Active    |  50 | 2.18.1               | camel-commands-core                                                
 73 | Active    |  50 | 2.8.3                | Jackson-core                                                       
 74 | Active    |  50 | 2.8.3                | jackson-databind                                                   
 75 | Active    |  50 | 2.8.3                | Jackson-annotations                                                
 76 | Active    |  50 | 2.8.3                | Jackson module: JAXB-annotations                                   
 77 | Active    |  50 | 2.18.1               | camel-jackson                                                      
 78 | Active    |  50 | 2.1.0                | json-path                                                          
 79 | Active    |  50 | 2.2.1                | json-smart                                                         
 80 | Active    |  50 | 1.1                  | accessors-smart                                                    
 81 | Active    |  50 | 2.7.0                | Gson                                                               
 82 | Active    |  50 | 2.18.1               | camel-jsonpath                                                     
 83 | Active    |  80 | 2.18.1               | camel-karaf-commands                                               
 84 | Active    |  50 | 4.4.4                | Apache Apache HttpCore OSGi bundle                                 
 85 | Active    |  50 | 4.5.2                | Apache Apache HttpClient OSGi bundle                               
 86 | Active    |  50 | 3.1.0                | Java Servlet API                                                   
 87 | Active    |  50 | 2.18.1               | camel-http-common                                                  
 88 | Active    |  50 | 2.18.1               | camel-http4                                                        
 89 | Active    |  50 | 1.10.0               | Apache Commons Codec                                               
 90 | Active    |  50 | 2.3.6.v20160126-1627 | org.restlet                                                        
 91 | Active    |  50 | 2.3.6.v20160126-1627 | org.restlet.ext.httpclient                                         
 92 | Active    |  50 | 2.18.1               | camel-restlet                                                      
 93 | Active    |  50 | 1.1.0.Final          | Bean Validation API                                                
 97 | Active    |  50 | 5.2.4.Final          | Hibernate Validator Engine                                         
 99 | Active    |  50 | 2.18.1               | camel-bean-validator                                               
103 | Active    |  80 | 5.0.3.Final          | Hibernate Validator Engine                                         
...

1 个答案:

答案 0 :(得分:1)

你需要先安装camel-bean-validator,你可以通过Karaf shell来做到这一点

feature:install camel-bean-validator