Forum Home » Fuse Distributions » Fuse ESB

Thread: camel-quickfix (2.6.0.fuse-01-09) not working

 
This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 7 - Last Post: Apr 27, 2011 7:39 AM Last Post By: davsclaus
vsathyamurthy

Posts: 4
Registered: 04/25/11
camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 25, 2011 6:50 PM
 
  Click to reply to this thread Reply
Hello Folks,

I am trying to run camel-quickfix with my example bundle. However I could not make it working. Any help would be ,uch appreciated.

264 Active [ ] [ ] 60 wrap_mvn_org.slf4j_slf4j-log4j13_1.0.1 (0)
294 Active [ ] [ ] 60 wrap_mvn_org.quickfixj.jmx_quickfixj-core_1.5.0 (0)
326 Active [ ] [ ] 60 wrap_mvn_org.hamcrest_hamcrest-core_1.2.1 (0)
327 Active [ ] [ ] 60 wrap_mvn_org.apache.mina_mina-core_1.1.7 (0)
328 Active [ ] [ ] 60 wrap_mvn_org.quickfixj_quickfixj-all_1.5.0 (0)
329 Active [ ] [ ] 60 wrap_mvn_junit_junit_4.8.2 (0)
345 Active [ ] [ ] 60 camel-quickfix (2.6.0.fuse-01-09)
347 Resolved [ ] [ ] 60 fixmsg (0.0.1.SNAPSHOT)
karaf@root> start 347
karaf@root> Exception in thread "SpringOsgiExtenderThread-10" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quickfix' defined in URL bundleentry://347.fwk2550265/META-INF/spring/fix-context.xml: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class or
g.apache.camel.component.quickfixj.QuickfixjComponent
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.camel.component.quickfixj.QuickfixjComponent
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
... 15 more

The below is my pom.xml of example for using quickfix component:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>fix.test</groupId>
<artifactId>fixmsg</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>fixmsg</name>
<description>Fix Message testing.</description>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<servicemix.osgi.import>
org.apache.camel.component.quickfixj,org.apache.camel.component.quickfixj.converter,org.apache.camel.component.quickfixj*,
*
</servicemix.osgi.import>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quickfix</artifactId>
<version>2.6.0-fuse-01-09</version>
<type>bundle</type>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Import-Package>org.apache.activemq.camel.component,org.apache.camel,org.apache.camel.component,org.apache.camel.component.jms,org.apache.camel.model,,org.apache.camel.spring,org.springframework.context,org.springframework.context.support,org.apache.camel.component.quickfixj,org.apache.camel.component.quickfixj.converter</Import-Package>
<Implementation-Title>Fix Message Test Implementaion</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

My Spring context:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
You under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<!-- lets configure the Camel ActiveMQ to use the ActiveMQ broker declared above -->
<bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>

<!-- quickfix component -->
<bean id="quickfix" class="org.apache.camel.component.quickfixj.QuickfixjComponent">
<property name="engineSettings">
<util:map>
<entry key="quickfix:fixmsg" value-ref="quickfixjSettings"/>
</util:map>
</property>
</bean>

<!-- quickfix settings -->
<bean id="quickfixjSettings"
class="org.apache.camel.component.quickfixj.QuickfixjSettingsFactory">
<property name="defaultSettings">
<util:map>
<entry key="SocketConnectProtocol" value="VM_PIPE"/>
<entry key="SocketAcceptProtocol" value="VM_PIPE"/>
<entry key="UseDataDictionary" value="N"/>
</util:map>
</property>
<property name="sessionSettings">
<util:map>
<entry key="FIX.4.2:INITIATOR->ACCEPTOR">
<util:map>
<entry key="ConnectionType" value="initiator"/>
<entry key="SocketConnectHost" value="testhost.com"/>
<entry key="SocketConnectPort" value="8919"/>
</util:map>
</entry>
<entry key="FIX.4.2:ACCEPTOR->INITIATOR">
<util:map>
<entry key="ConnectionType" value="acceptor"/>
<entry key="SocketAcceptPort" value="8919"/>
</util:map>
</entry>
</util:map>
</property>
</bean>

<!-- lets configure the Camel ActiveMQ to use the ActiveMQ broker declared above -->
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="jms:queue:fix" />
<!-- bean method in charge to transform message into a QuickFix.Message --><!--
<bean ref="fixService" method="createFixMessage"/>
--><!-- Quickfix engine who will send the FIX messages to the gateway -->
<to uri="quickfix:META-INF/client.cfg"/>
</route>

<route>
<!-- QuickFix engine who will receive the message from FIX gateway -->
<from uri="quickfix:META-INF/server.cfg"/>
<!-- bean method parsing the QuickFix.Message -->
<!--<bean ref="fixService" method="parseFixMessage"/>
--><to uri="jms:queue:fix"/>
</route>
</camelContext>

</beans>

Edited by: vsathyamurthy on Apr 25, 2011 6:50 PM

Edited by: vsathyamurthy on Apr 25, 2011 6:52 PM

ffang

Posts: 1,320
Registered: 12/24/07
Re: camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 26, 2011 12:16 AM   in response to: vsathyamurthy in response to: vsathyamurthy
 
  Click to reply to this thread Reply
Hi,

Could you post here the output of

osgi:headers 347

seems your customer bundle didn't import necessary package.

Freeman
vsathyamurthy

Posts: 4
Registered: 04/25/11
Re: camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 26, 2011 3:30 PM   in response to: ffang in response to: ffang
 
  Click to reply to this thread Reply
Hello Freeman,

Here is the headers for 347.

fixmsg (347)

Manifest-Version = 1.0
Bnd-LastModified = 1303755206376
Tool = Bnd-0.0.238
Built-By = e513788
Implementation-Version = 0.0.1-SNAPSHOT
Build-Jdk = 1.5.0_22
Implementation-Title = Fix Message Test Implementaion
Created-By = Apache Maven Bundle Plugin

Bundle-Name = fixmsg
Bundle-Description = Fix Message testing.
Bundle-SymbolicName = fix.test.fixmsg
Bundle-Version = 0.0.1.SNAPSHOT
Bundle-ManifestVersion = 2

Import-Package =
org.apache.activemq.camel.component,
org.apache.camel,
org.apache.camel.component,
org.apache.camel.component.jms,
org.apache.camel.component.quickfixj;version=2.6.0.fuse-01-09,
org.apache.camel.component.quickfixj.converter;version=2.6.0.fuse-01-09,
org.apache.camel.model,
org.apache.camel.spring,
org.springframework.context,
org.springframework.context.support
Export-Package =
fix.test.fixmsg
njiang

Posts: 572
Registered: 09/17/07
Re: camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 26, 2011 12:27 AM   in response to: vsathyamurthy in response to: vsathyamurthy
 
  Click to reply to this thread Reply
Hi,

It looks like your are using the wrap bundle, did you have a change to use the servicemix wrap one "org.apache.servicemix.bundles/org.apache.servicemix.bundles.quickfix/1.5.0_1"

Willem
vsathyamurthy

Posts: 4
Registered: 04/25/11
Re: camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 26, 2011 3:31 PM   in response to: njiang in response to: njiang
 
  Click to reply to this thread Reply
How to do servicemix wrap and what it is different from requilar wrap?

thanks
Venkat
ffang

Posts: 1,320
Registered: 12/24/07
Re: camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 27, 2011 12:55 AM   in response to: vsathyamurthy in response to: vsathyamurthy
 
  Click to reply to this thread Reply
Hi,

Servicemix wrapped bundle OSGi-fied those jars which aren't OSGi friendly, through adding some OSGi metadata.

You can do similar with wrap command, but simply use wrap only add some very basic OSGi metadata, in some complicated case, it's not enough, you have to append extra OSGi metadata directive file to the wrap command, which isn't a easy thing for end user.
Also, although you can use wrap command in development time, we don't recemmond that way during production run time, you should use the way provided by servicemix wrapped bundle.

Freeman
vsathyamurthy

Posts: 4
Registered: 04/25/11
Re: camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 26, 2011 4:25 PM   in response to: njiang in response to: njiang
 
  Click to reply to this thread Reply
I tried apache servicemix quickfixj-all, and then install camel-quickfix features. no luck.

348 Active [ ] [ ] 60 Apache ServiceMix :: Bundles :: quickfixj-all (1.5.0.1)
349 Active [ ] [ ] 60 camel-quickfix (2.6.0.fuse-01-09)
350 Resolved [ ] [ ] 60 fixmsg (0.0.1.SNAPSHOT)
karaf@root> start 350
karaf@root> Exception in thread "SpringOsgiExtenderThread-16" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quickfix' defined in URL bundleentry://350.fwk2550265/META-INF/spring/fix-context.xml: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class or
g.apache.camel.component.quickfixj.QuickfixjComponent
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.camel.component.quickfixj.QuickfixjComponent
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
... 15 more

thanks
Venkat
davsclaus

Posts: 1,893
Registered: 10/14/08
Re: camel-quickfix (2.6.0.fuse-01-09) not working
Posted: Apr 27, 2011 7:39 AM   in response to: vsathyamurthy in response to: vsathyamurthy
 
  Click to reply to this thread Reply
Hi

I have created a ticket at Apache to include an unit test in OSGi for QuickFix
https://issues.apache.org/jira/browse/CAMEL-3904

Some frameworks are not too OSGi friendly so it can be a bit tricky to get it working. I guess QuickFix may be one of them.