Using MINA from RouteBuilder Causing Exception in Karaf

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using MINA from RouteBuilder Causing Exception in Karaf

peter.berkman
Running in Karaf.  Using blueprint to kickstart, then Java DSL.

I'm getting exceptions from the "from" endpoint which is MINA.

Can you let me know what I'm doing wrong here...

The code looks like this (note, everything works perfect if I set the from to "file:..." which is the only way I figured out it was something wrong with mina....

    Mina2Component minaComp = new Mina2Component();

   @Override
    public void configure() throws Exception {
    	
    	        minaComp.setCamelContext((CamelContext) getContext());

    		routeName = icfg.getSetting("instance.name", null);
    		
    		if (routeName == null) {
    		
    			throw new NGMSException("No instances defined");
    		}
    		
    		routeName = NGMSConstants.ROUTE_PREFIX + routeName;
    		
    		String targetQName = icfg.getSetting("map.queue.name", HL7MapGroup.QUEUE_IN);

    		Mina2Configuration minaCfg = new Mina2Configuration();
    		minaCfg.setProtocol("tcp");
    		minaCfg.setCodec(HL7ParserFactory.getCodec());
    		minaCfg.setHost(icfg.getSetting("listener.address", "0.0.0.0"));
    		minaCfg.setPort(Integer.parseInt(icfg.getSetting("listener.port", "8001")));
    		minaCfg.setSync(true);
    		minaCfg.setLazySessionCreation(true);

    		LOG.debug("Defining route [{}] with target queue [{}]", routeName, targetQName);

    		route = from(minaComp.createEndpoint(minaCfg)).id(routeName).routePolicy(PolicyFactory.getThrottle())
		    			.unmarshal(HL7ParserFactory.getFormatDef())
		    			.process(TrackerFactory.getRecv())
		    			.process(JournallerFactory.getJournaller())
		    			.process(HooksFactory.getPostAdapterHook())
		    			.to(NGMSConstants.QUEUE_PREFIX + targetQName);
    		


And, the blueprint.xml for this bundle:

<blueprint	xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
			xsi:schemaLocation="
  http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
  http://www.osgi.org/xmlns/blueprint-ext/v1.1.0 https://svn.apache.org/repos/asf/aries/tags/blueprint-0.3.1/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext.xsd  
  http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
  http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
  http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
  http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
  ">
  
    <bean id="routeBuilder" class="com.nextgate.ms.component.bundle.listener.hl7mllp.HL7MLLPRouteBuilder" />
    
    <camelContext id="nextgate-ngms-listener-HL7v2MLLP" xmlns="http://camel.apache.org/schema/blueprint">
        <!--  
        <routeBuilder ref="routeBuilder" />
        -->
        <package>com.nextgate.ms.component.bundle.listener.hl7mllp</package>
    </camelContext>	
</blueprint>


The farely unhelpful exception is:

2013-11-08 16:14:48,049 | WARN  | l Console Thread | BeanRecipe                       | s.blueprint.container.BeanRecipe  851 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Object to be destroyed is not an instance of UnwrapperedBeanHolder, type: null
2013-11-08 16:14:48,049 | ERROR | l Console Thread | BlueprintContainerImpl           | container.BlueprintContainerImpl  393 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Unable to start blueprint container for bundle com.nextgate.ms.components.bundles.ngms-listener-hl7v2-mllpngms-listener-hl7v2-mllp-10289
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean .camelBlueprint.factory.nextgate-ngms-listener-HL7v2MLLP
	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:714)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_37]
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_37]
	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:746)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:783)[281:org.apache.camel.camel-blueprint:2.10.2]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:515)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:353)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:259)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:222)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[11:org.apache.aries.util:1.1.0]
	at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1923)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.karaf.shell.osgi.InstallBundle.doExecute(InstallBundle.java:51)[24:org.apache.karaf.shell.osgi:2.3.3]
	at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.karaf.shell.console.jline.Console.run(Console.java:173)[14:org.apache.karaf.shell.console:2.3.3]
	at java.lang.Thread.run(Thread.java:662)[:1.6.0_37]
Caused by: java.lang.VerifyError: (class: com/nextgate/ms/component/bundle/listener/hl7mllp/HL7MLLPRouteBuilder, method: configure signature: ()V) Incompatible argument to function
	at java.lang.Class.getDeclaredConstructors0(Native Method)[:1.6.0_37]
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)[:1.6.0_37]
	at java.lang.Class.getConstructor0(Class.java:2699)[:1.6.0_37]
	at java.lang.Class.newInstance0(Class.java:326)[:1.6.0_37]
	at java.lang.Class.newInstance(Class.java:308)[:1.6.0_37]
	at org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1165)
	at org.apache.camel.util.ReflectionInjector.newInstance(ReflectionInjector.java:32)
	at org.apache.camel.impl.DefaultInjector.newInstance(DefaultInjector.java:45)
	at org.apache.camel.blueprint.PackageScanRouteBuilderFinder.instantiateBuilder(PackageScanRouteBuilderFinder.java:110)
	at org.apache.camel.blueprint.PackageScanRouteBuilderFinder.appendBuilders(PackageScanRouteBuilderFinder.java:72)
	at org.apache.camel.blueprint.CamelContextFactoryBean.findRouteBuildersByPackageScan(CamelContextFactoryBean.java:265)
	at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.findRouteBuilders(AbstractCamelContextFactoryBean.java:671)
	at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:275)
	at org.apache.camel.blueprint.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:279)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_37]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_37]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_37]
	at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_37]
	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)
	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)
	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)
	... 40 more
2013-11-08 16:14:48,054 | DEBUG | l Console Thread | lpngms-listener-hl7v2-mllp-10289 | ?                                   ? | 346 - com.nextgate.ms.components.bundles.ngms-listener-hl7v2-mllpngms-listener-hl7v2-mllp-10289 - 1.0.0.SNAPSHOT | BundleEvent STARTED - com.nextgate.ms.components.bundles.ngms-listener-hl7v2-mllpngms-listener-hl7v2-mllp-10289
Reply | Threaded
Open this post in threaded view
|

Re: Using MINA from RouteBuilder Causing Exception in Karaf

peter.berkman
A little further, but now I'm really stuck...  How can a component's Endpoint not implement createEndpointUri()?

2013-11-08 23:12:59,790 | INFO  | l Console Thread | BlueprintCamelContext            | e.camel.impl.DefaultCamelContext 1656 | 278 - org.apache.camel.camel-core - 2.10.2 | Apache Camel 2.10.2 (CamelContext: nextgate-ngms-listener-HL7v2MLLP) is shutdown in 0.001 seconds. Uptime not started.
2013-11-08 23:12:59,790 | ERROR | l Console Thread | BlueprintContainerImpl           | container.BlueprintContainerImpl  393 | 7 - org.apache.aries.blueprint.core - 1.1.0 | Unable to start blueprint container for bundle com.nextgate.ms.components.bundles.ngms-listener-hl7v2-mllpngms-listener-hl7v2-mllp-10289
java.lang.IllegalArgumentException: endpointUri is not specified and org.apache.camel.component.mina2.Mina2Endpoint does not implement createEndpointUri() to create a default value
	at org.apache.camel.impl.DefaultEndpoint.getEndpointUri(DefaultEndpoint.java:151)[278:org.apache.camel.camel-core:2.10.2]
	at org.apache.camel.model.FromDefinition.getUri(FromDefinition.java:85)[278:org.apache.camel.camel-core:2.10.2]
	at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.findInputComponents(CamelNamespaceHandler.java:818)[281:org.apache.camel.camel-blueprint:2.10.2]
	at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:790)[281:org.apache.camel.camel-blueprint:2.10.2]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:515)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:353)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:259)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:222)[7:org.apache.aries.blueprint.core:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[11:org.apache.aries.util:1.1.0]
	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[11:org.apache.aries.util:1.1.0]
	at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1923)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)[org.apache.felix.framework-4.0.3.jar:]
	at org.apache.karaf.shell.osgi.InstallBundle.doExecute(InstallBundle.java:51)[24:org.apache.karaf.shell.osgi:2.3.3]
	at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.3]
	at org.apache.karaf.shell.console.jline.Console.run(Console.java:173)[14:org.apache.karaf.shell.console:2.3.3]
	at java.lang.Thread.run(Thread.java:662)[:1.6.0_37]