camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prueegg <patrick.ruee...@raiffeisen.ch>
Subject Access XSD (Resources) in from an OSGI bundle
Date Mon, 01 Oct 2012 14:55:59 GMT
Hi I have the problem, that I cannot configure a route with a validator.

The route is configured in an OSGI-Bundle which should run on an Virgo
Server.
The Route Definition is:
from(getRouteStartUri()).to("validator:classpath:resources/Msg_template.xsd").to(getRouteEndUri());

But alway get the following exception:
/[2012-10-01 16:40:06.433] region-dm-9                  <AG0000E>
Application context creation failure for bundle
'ch.raiffeisen.dialba.masse.broker.bridge.service.business' version
'0.1.0.201210011436'. org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route route1
at: >>> To[validator:classpath:resources/Msg_template.xsd] <<< in route:
Route[[From[raiq:RAIQ_TO_DIALBA]] -> [To[validator:classpath... because of
Failed to resolve endpoint: validator://classpath:resources/Msg_template.xsd
due to: Cannot find resource in classpath for URI:
resources/Msg_template.xsd
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1221)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
	at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
	at
org.eclipse.gemini.blueprint.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:221)
	at
org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:328)
	at
org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at
org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)
	at
org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
	at
org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route1 at: >>> To[validator:classpath:resources/Msg_template.xsd] <<<
in route: Route[[From[raiq:RAIQ_TO_DIALBA]] -> [To[validator:classpath...
because of Failed to resolve endpoint:
validator://classpath:resources/Msg_template.xsd due to: Cannot find
resource in classpath for URI: resources/Msg_template.xsd
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:855)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:168)
	at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:709)
	at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1733)
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1525)
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1420)
	at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:179)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1388)
	at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:228)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:118)
	... 13 common frames omitted
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: validator://classpath:resources/Msg_template.xsd due to:
Cannot find resource in classpath for URI: resources/Msg_template.xsd
	at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:455)
	at
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:48)
	at
org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:183)
	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:61)
	at
org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:55)
	at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:440)
	at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:178)
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:852)
	... 23 common frames omitted
Caused by: java.io.FileNotFoundException: Cannot find resource in classpath
for URI: resources/Msg_template.xsd
	at
org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsInputStream(ResourceHelper.java:89)
	at
org.apache.camel.component.validator.ValidatorComponent.createEndpoint(ValidatorComponent.java:44)
	at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:91)
	at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:437)
	... 32 common frames omitted/


I checked the availability of th xsd with the following code in the same
configure() methode of my RouteBuilder()
InputStream is =
this.getClass().getClassLoader().getResourceAsStream("resources/Msg_template.xsd");

It works. So the resource is in the classpath.

The manifest files looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ch.raiffeisen.dialba.masse.broker.bridge.service.business
Bundle-SymbolicName:
ch.raiffeisen.dialba.masse.broker.bridge.service.business
Bundle-Version: 0.1.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
 org.apache.camel.camel-core;bundle-version="2.9.2",
 org.apache.camel.camel-spring;bundle-version="2.9.2",
 org.apache.camel.camel-jms;bundle-version="2.9.2",
 org.apache.activemq.activemq-core;bundle-version="[5.5.1,5.6)",
 org.springframework.beans;bundle-version="[3.0.5,3.1)",
 ch.raiffeisen.dialba.masse.broker.domain,
 ch.raiffeisen.dialba.masse.broker.common
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .,resources/
Import-Package: org.slf4j;version="[1.6.0,1.7)"

Do you have any idea what I've done wrong?

Patrick

PS: I think it is not related to 
https://issues.apache.org/jira/browse/CAMEL-5321
<https://issues.apache.org/jira/browse/CAMEL-5321>  . If I upgrade to
Version 2.10.1 the problem is still the same.



--
View this message in context: http://camel.465427.n5.nabble.com/Access-XSD-Resources-in-from-an-OSGI-bundle-tp5720312.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message