camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack401 <hding...@yahoo.com>
Subject Re: Camel Jasypt doesn't work in camel:sslContextParameters in Eclipse
Date Thu, 23 Jun 2016 20:34:01 GMT
Hello all,

Sorry that the URL I included in the initial email was altered by my yahoo
webmail. I didn't notice this bad formatted url until I looked at my own
post on the webpage. 

I am still having issues to access the properties in the
camel:sslContextParameters in Eclipse environment. For example:

	<camel:sslContextParameters id="sslCP"
xmlns="http://camel.apache.org/schema/spring">
		<camel:trustManagers>
			<camel:keyStore resource="{{ssl.truststore}}"
password="{{ssl.truststore.pwd}}"/>
		</camel:trustManagers>
		<camel:keyManagers keyPassword="{{ssl.key.pwd}}">
			<camel:keyStore resource="{{ssl.keystore}}"
password="{{ssl.keystore.pwd}}"/>
		</camel:keyManagers>
                 ....
	</camel:sslContextParameters> 

	<bean id="jasypt"
class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
		<property name="password" value="password"/>
	</bean>

and the sslContextParameters is referred by a http4 bean:

	<bean id="my-http4" class="org.apache.camel.component.http4.HttpComponent">
	   <property name="sslContextParameters" ref="sslCP/>
	</bean>

In the CamelContext define the property file:
		<propertyPlaceholder id="properties" location="file:propertyfile"
propertiesParserRef="jasypt"/>


In the propertyfile, we have the entries:

ssl.truststore.pwd=ENC(a/WFDRvc7S74nUUlxJyc2DYNxNRLsfJa)
...

In the Run configurations I have the goal  "camel:run". When I clicked "Run"
button, I got the following error:

....
Caused by: java.io.IOException: Keystore was tampered with, or password was
incorrect
	at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:772)
	at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
	at java.security.KeyStore.load(KeyStore.java:1214)
	at
org.apache.camel.util.jsse.KeyStoreParameters.createKeyStore(KeyStoreParameters.java:175)
	at
org.apache.camel.util.jsse.TrustManagersParameters.createTrustManagers(TrustManagersParameters.java:94)
	at
org.apache.camel.util.jsse.SSLContextParameters.createSSLContext(SSLContextParameters.java:257)
	at
org.apache.camel.component.http4.HttpComponent.createConnectionRegistry(HttpComponent.java:314)
	at
org.apache.camel.component.http4.HttpComponent.createEndpoint(HttpComponent.java:257)
	at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:114)
	at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:558)
	... 42 more

Three observations:

1) The same problem will happen when run it with maven command line too. It
seems that for some unknown reason, the maven probably didn't see the Jasypt
before the camel:sslContextParameters.  

2)  If I use the encrypted properties inside the <camelContext>, the Jasypt
worked fine because I can see it was un-encrypted in my log :

<setHeader headerName="PrintPassword">
<simple>${properties:ssl.truststore.pwd}</simple>
</setHeader>

3)  This same issue doesn't happen in the Karaf. The properties in the 
camel:sslContextParameters can be decrypted by Jasypt. 

The Camel version I am using is 2.15.3 and the Karaf version is 2.4.3.   The
Eclipse is Version: Kepler Release. Build id: 20130614-0229. Apache Maven
3.1.0 ( on Windows XP ). I know the OS is old but the same issue happened on
a co-worker PC with Windows 7 too.  

Could somebody shade some lights on this issue?

Thanks for your help in advance.

========= See detailed error below ============
...
[ain.main()] MainSupport                              INFO  Apache Camel
2.15.3 stopping
[ERROR] *************************************
[ERROR] 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:488)
	at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route xxxx 
<<< in route: Route(yyyyy)... because of Failed to resolve endpoint:
my-http4.... due to: Keystore was tampered with, or password was incorrect
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1619)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:123)
	at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:334)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
	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:216)
	at org.apache.camel.spring.Main.doStart(Main.java:156)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.main.MainSupport.run(MainSupport.java:150)
	at org.apache.camel.main.MainSupport.run(MainSupport.java:354)
	at org.apache.camel.spring.Main.main(Main.java:89)
	... 6 more
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route xxxx  <<< in route: Route(yyyyy)... because of Failed to resolve
endpoint: my-http4//.... due to: Keystore was tampered with, or password was
incorrect
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1028)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:185)
	at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:841)
	at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2911)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2634)
	at
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167)
	at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2483)
	at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2479)
	at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2502)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2479)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2448)
	at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:255)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121)
	... 20 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: my-http4://....due to: Keystore was tampered with, or
password was incorrect
	at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:578)
	at
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:79)
	at
org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:200)
	at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:107)
	at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:113)
	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.makeProcessor(ProcessorDefinition.java:505)
	at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:217)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1025)
	... 33 more
Caused by: java.io.IOException: Keystore was tampered with, or password was
incorrect
	at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:772)
	at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
	at java.security.KeyStore.load(KeyStore.java:1214)
	at
org.apache.camel.util.jsse.KeyStoreParameters.createKeyStore(KeyStoreParameters.java:175)
	at
org.apache.camel.util.jsse.TrustManagersParameters.createTrustManagers(TrustManagersParameters.java:94)
	at
org.apache.camel.util.jsse.SSLContextParameters.createSSLContext(SSLContextParameters.java:257)
	at
org.apache.camel.component.http4.HttpComponent.createConnectionRegistry(HttpComponent.java:314)
	at
org.apache.camel.component.http4.HttpComponent.createEndpoint(HttpComponent.java:257)
	at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:114)
	at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:558)
	... 42 more
Caused by: java.security.UnrecoverableKeyException: Password verification
failed
	at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:770)
	... 51 more
[ERROR] *************************************
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 9.656s
[INFO] Finished at: Thu Jun 23 14:31:11 CDT 2016
[INFO] Final Memory: 35M/85M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.camel:camel-maven-plugin:2.15.3:run (default-cli) on project
zzzz: null: MojoExecutionException: InvocationTargetException:
org.apache.camel.FailedToCreateRouteException: ,... because of Failed to
resolve endpoint: my-http4://localhost:... due to: Keystore was tampered
with, or password was incorrect: Password verification failed -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jasypt-doesn-t-work-in-camel-sslContextParameters-in-Eclipse-tp5784304p5784352.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message