Camel KeyStore配置,从classpath读取.jks文件的问题

时间:2017-03-07 14:38:17

标签: java spring-security apache-camel ssl-certificate

使用Camel版本:2.17.1

<camel:sslContextParameters
      id="sslContextParameters">
    <camel:keyManagers
        keyPassword="pass123">
      <camel:keyStore
          resource="KeyStore.jks"
          password="pass123"/>
    </camel:keyManagers>
  </camel:sslContextParameters>

我在加载时遇到以下异常:

java.io.FileNotFoundException: KeyStore.jks (The system cannot find the file specified)

是性质,还是有任何解决方法?

更多追踪:

 Error occurred while running main from: org.apache.camel.spring.Main
[ERROR] 
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:458)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.camel.RuntimeCamelException: java.io.FileNotFoundException: KeyStore.jks (The system cannot find the file specified)
	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1690)
	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:138)
	at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:340)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:855)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
	at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:213)
	at org.apache.camel.spring.Main.doStart(Main.java:153)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.main.MainSupport.run(MainSupport.java:138)
	at org.apache.camel.main.MainSupport.run(MainSupport.java:390)
	at org.apache.camel.spring.Main.main(Main.java:86)
	... 6 more
Caused by: java.io.FileNotFoundException: KeyStore.jks (The system cannot find the file specified)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:146)
	at java.io.FileInputStream.<init>(FileInputStream.java:101)
	at org.restlet.engine.ssl.DefaultSslContextFactory.createSslContext(DefaultSslContextFactory.java:309)
	at org.restlet.engine.connector.HttpsServerHelper.start(HttpsServerHelper.java:92)
	at org.restlet.Server.start(Server.java:579)
	at org.apache.camel.component.restlet.RestletComponent.addServerIfNecessary(RestletComponent.java:388)
	at org.apache.camel.component.restlet.RestletComponent.connect(RestletComponent.java:174)
	at org.apache.camel.component.restlet.RestletEndpoint.connect(RestletEndpoint.java:116)
	at org.apache.camel.component.restlet.RestletConsumer.doStart(RestletConsumer.java:112)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3269)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3563)
	at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3499)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3429)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3197)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3053)
	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2848)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2844)
	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2867)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2844)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2813)
	at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:270)
	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:136)
	... 21 more

0 个答案:

没有答案