IDempiere Service Integration - adempiere

I need to call Idempiere Business Modules (ex. Creating Purchase Order process) , not tables via a web services, Is there any way to do this without going through the source code of Idempiere, I don't want to use RESTful methods that will deal with tables directly

You are probably referring to improvements on iDempiere's Web Services where composite (master-detail) and CRUD actions are now possible. Complete description at the project wiki: http://wiki.idempiere.org/en/NF1.0_Web_Services_Improvements
Below I paste results of https://test.idempiere.org/ADInterface/services
Available SOAP services:
CompositeService
compositeOperation
Endpoint address: http://test.idempiere.org/ADInterface/services/compositeInterface
WSDL : {http://idempiere.org/ADInterface/1_0}compositeInterface
Target namespace: http://idempiere.org/ADInterface/1_0
ModelADService
setDocAction
createUpdateData
getList
readData
createData
runProcess
queryData
deleteData
updateData
Endpoint address: http://test.idempiere.org/ADInterface/services/ModelADService
WSDL : {http://idempiere.org/ADInterface/1_0}ModelADService
Target namespace: http://idempiere.org/ADInterface/1_0
Available RESTful services:
Endpoint address: http://test.idempiere.org/ADInterface/services/rest
WADL : http://test.idempiere.org/ADInterface/services/rest?_wadl

You can use create a provide service interface from org.adempiere.base plugin, invoke this service inside your code and invoke the constructor for class MOrder extends X_C_Order and for class MOrderLine extends X_C_OrderLine.
Here you have the example from IProcessFactory (you can create your factory like ICreateOrderFactory , or just IInsertFactory ( for a generic factory constructor you can set the table id ) :
This is a interface declaration
public interface IProcessFactory {
/**
* Create new process instance
* #param className
* #return new process instance
*/
public ProcessCall newProcessInstance(String className);
}
This is a evocation method
public class ProcessFactory implements IProcessFactory {
#Override
public ProcessCall newProcessInstance(String className) {
if (className.equals("com.com.nexus.webservice.client.process.IntegratorWS"))
return new IntegratorWS();
else
return null;
}
}
Now you need to create .xml of this factory like that : (pay attention in provided interface)
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.nexus.integrator.ProcessFactory">
<implementation class="com.nexus.webservice.client.process.ProcessFactory"/>
<property name="service.ranking" type="Integer" value="5"/>
<service>
<provide interface="org.adempiere.base.IProcessFactory"/>
</service>
</scr:component>
To use this in OSGI architecture, you need to configure your MANIFEST file to import this
Service-Component: ( I always use osgi-inf directory for my factories xml)
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.nexus.webservice.client
Bundle-SymbolicName: com.nexus.webservice.client;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Macrosoftware
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.adempiere.base
Service-Component: OSGI-INF/ProcessFactory.xml
Import-Package: org.osgi.framework
You can do this , or you can use composite webservice .
I consider the second most safe and effective method

Related

osgi service: reference on active service not satisfied

I have an unsatisfied osgi service:
ls 142
Components in bundle A:
ID State Component Name Located in bundle
90 Unsatisfied ServiceA A(bid=142)
The reference to ServiceB is unsatisfied:
comp 90
Component[
name = ServiceA
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = false
implementation = ServiceA
state = Unsatisfied
properties =
serviceFactory = false
serviceInterface = [ServiceA]
references = {
Reference[name = ServiceB, interface = ServiceB, policy = static, cardinality = 1..1, target = null, bind = setServiceB, unbind = unsetServiceB]
}
located in bundle = B_2.12.0.qualifier [142]
]
Dynamic information :
*The component is NOT satisfied
The following references are not satisfied:
Reference[name = ServiceB, interface = ServiceB, policy = static, cardinality = 1..1, target = null, bind = setServiceB, unbind = unsetServiceB]
Component configurations :
Configuration properties:
component.name = ServiceA
component.id = 136
objectClass = String[ServiceA]
Instances:
Nevertheless, ServiceB is active:
ls 52
Components in bundle B:
ID State Component Name Located in bundle
14 Active ServiceB B(bid=52)
So why is the reference from ServiceA to ServiceB unsatisfied? A restart of bundle A (stop and start) doesn't help. Configuring the reference on a working ServiceC in bundle C makes ServiceC unsatisfied.
Update: ServiceB has been registered
The result of the "services" command in the osgi console contains the following nipped:
{ServiceB}={service.id=180}
Registered by bundle: Z_2.12.0.qualifier [123]
No bundles using service.
Additional information: configuration, initialization and registration of ServiceA and ServiceB
ServiceB is basically an apache cxf web service, that's implementing an interface. This interface has been generated out of a wsdl. The ServiceB is registered programmatically. ServiceA has a reference to the generated interface. This pattern works perfectly with another web service (lets say ServiceC and ServiceD).
And if it helps: This pattern even worked between ServiceA and ServiceB until we upgraded apache cxf. I didn't provide this information before because I feared it would make this problem too complicated 😕.
Update: configuration of the component ServiceB
There are two parts considering the configuration: The xml file and the registration. The xml file contains the implementation class "WebServiceConfigImpl", a provided interface "WebServiceConfig" and some properties. One of the properties is the webservice "ServiceB" - the name under that the service is registered programmatically later in the start procedure.
xml file:
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" name="ServiceB">
<implementation class="WebServiceConfigImpl"/>
<service>
<provide interface="WebServiceConfig"/>
</service>
<property name="webservice" type="String" value="ServiceB"/>
<property name="address" type="String" value="${adresse}"/>
<property name="username" type="String" value="${benutzer}"/>
<property name="password" type="String" value="${passwort}"/>
(...)
two references to other osgi services for resolving the web service configuration
</scr:component>
registration:
We are using our own org.osgi.util.tracker.ServiceTracker for this. This ServiceTracker is opened in the Activator of bundle Z. It calls the constructor of ServiceTracker with "WebServiceConfig" as parameter, so this ServiceTracker is notified if a Service providing the interface "WebServiceConfig" has been registered. Our implementation of the SeriveTracker now reads the property "webservice" and publishs the osgi service under this name:
context.registerService(serviceName, service, null);
After that, the service is available and activated in the osgi console.
Update: accessing ServiceB
After the registration through our ServiceTracker, ServiceB is available through the osgi console AND by source code:
ServiceTracker st = new ServiceTracker(bundleContext, "ServiceB", null);
st.open();
st.getService();
Update: accessing ServiceB 2
ServiceB is accessible via source code in bundle Z. But it cannot be accessed via source code from bundle A. Then the service object is null.
I found a workaround to get programmatically access to ServiceB:
ServiceTracker st = new ServiceTracker(context, ServiceB.class.getName(), null);
st.open(true);
st.getService()
The boolean parameter in the open method makes the difference.
Unfortunatelly I wasn't able to answer the question why some bundles have "direct" access to the ServiceB (no parameter in the open method needed) and some need the "true" parameter.

How to Configure a Spring Boot CXF Configuration with more that one service wsdl

I have the challenge that I have a WSDL file with more that one service definiton inside
----- Customer WSDL file, can not change it ----
<service name="DocumentOperationService">
<port name="DocumentOperationPort" binding="tns:DocumentOperationBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL" />
</port>
</service>
<service name="PermissionEvaluatorService">
<port name="PermissionEvaluatorPort" binding="tns:PermissionEvaluatorBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL" />
</port>
</service>
<service name="ConfigurationResolverService">
<port name="ConfigurationResolverPort" binding="tns:ConfigurationResolverBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL" />
</port>
</service>
------
How can I configure the Spring Configuration Class
import org.springframework.context.annotation.Configuration;
#Configuration
public class WebServiceConfiguration {
...
#Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), dmsPortService());
// CXF JAX-WS implementation relies on the correct ServiceName as QName-Object with
// the name-Attribute´s text <wsdl:service name="Weather"> and the targetNamespace
// "http://www.codecentric.de/namespace/weatherservice/"
// Also the WSDLLocation must be set
endpoint.setServiceName(dmsOperationService().getServiceName());
endpoint.setWsdlLocation(dmsOperationService().getWSDLDocumentLocation().toString());
// endpoint.setWsdlLocation("classpath:/service-api-definition/journalexportservice.wsdl");
endpoint.publish("/DocumentOperation");
return endpoint;
}
#Bean
public DocumentOperationService dmsOperationService() {
// Needed for correct ServiceName & WSDLLocation to publish contract first incl. original WSDL
return new DocumentOperationService();
}
That all 3 Services are loaded.
In the moment I can only load one Service, I could not find any example how this could be done.
I triad with 3 config files, but then only the last is active, and how to configure 3 services in the same config file I could not figure out.
You might want to take a look at this tutorial describing your exact use case with exactly your stack.
In short:
Your Configuration Bean needs to provide a ServletRegistrationBean with a cxfServlet, a SpringBus and an Endpoint. (Pretty much like your posted code. Juding from the comments it might even be from this very tutorial)
Your Endpoint should point to the overall wdsl location
Then you need to implement a Service that encomapsses all of your intended webservices
In this service you need one method per webservice

How to implement multiple SFDC Outbound Message receivers in the same Spring service?

For each Outbound Message, Salesforce provides a full self-contained WSDL.
Implementing a Spring service for a single one is easy, using jaxws-maven-plugin to generate the classes and #Endpoint, #PayloadRoot, etc to bind the endpoint.
However, multiple Outbound Messages all share the same QNs (for example http://soap.sforce.com/2005/09/outbound:notifications or urn:sobject.enterprise.soap.sforce.com:sObject) for different structures and type hierarchies.
I know how to map the same XML names to different handlers based on URL path.
I know how to use a separate package for the generated classes with a bindings file:
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
wsdlLocation="../wsdl/SFDC_Contact_Outbound_Msg.wsdl"
version="2.0">
<jaxb:bindings node="//xs:schema[#targetNamespace='http://soap.sforce.com/2005/09/outbound']">
<jaxb:schemaBindings>
<jaxb:package name="com.sforce.soap.outbound.contact"/>
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings node="//xs:schema[#targetNamespace='urn:sobject.enterprise.soap.sforce.com']">
<jaxb:schemaBindings>
<jaxb:package name="com.sforce.soap.enterprise.sobject.contact"/>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxws:bindings>
However, when trying to initialise the Jaxb2Marshaller from the generated code, it still cannot handle the XML conflicts:
[WARN] [main] 09:40:45.687 AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'marshaller' defined in class path resource [WebServiceConfig.class]:
Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException:
Unknown JAXB exception; nested exception is com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 6 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{urn:sobject.enterprise.soap.sforce.com}sObject". Use #XmlType.name and #XmlType.namespace to assign different names to them.
...
I do not want to add any more manual steps when the SDFC-generated WSDL changes, other than dropping in the new files.
Is there a way to change the namespaces in package-info.java without changing the source WSDL?
Is there a way to easily (i.e. not with a separate #Bean method for each) create a separate marshaller for each package that could all then be added to the DefaultMethodEndpointAdapter?
Is there another way to implement all these Outbound Message receivers?
Is there a way to change the namespaces?
If you did they wouldn't match the namespaces in the actuall message, so it wouldn't be unmarshallable.
Is there a way to easily create a separate marshaller for each package?
Well, here's a way to do it.
#PostConstruct
public void marshallers() throws IOException {
List<String> types = Arrays.stream(applicationContext.getResources("classpath:com/sforce/soap/outbound/*"))
.map(Resource::getFilename)
.collect(Collectors.toList());
for (String type : types) {
String beanName = "marshallingPayloadMethodProcessor_" + type;
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setPackagesToScan(
"com.sforce.soap.outbound." + type,
"com.sforce.soap.enterprise.sobject." + type
);
try {
marshaller.afterPropertiesSet();
} catch (Exception ex) {
throw new BeanInitializationException("Could not initialize bean " + beanName, ex);
}
MarshallingPayloadMethodProcessor processor = new MarshallingPayloadMethodProcessor(marshaller);
beanFactory.registerSingleton(beanName, processor);
}
Couple of caveats on this:
If deploying via a jar, then classpath directories don't exist, so will need an alternate way to get the package names.
registerSingleton appears to break some application contexts - causing unrelated beans to be no longer be found. I have no idea why this is.

OSGI Declarative Service prints nothing

Dear talented programmers!
I have been working with OSGI framework and was trying to applied Declarative Service in my program, but it printed nothing on the screen.
My program is simple, just have one interface, one class implements it and one class consume the interface as the client.
- The Interface is:
package test.osdids.date;
public interface IDateService {
String getDate();
}
- The class implements Interface as the Service is:
package test.osdids.date.service;
import java.util.Calendar;
import test.osdids.date.IDateService;
public class DateService implements IDateService {
#Override
public String getDate() {
String date = Calendar.getInstance().getTime().toString();
return date;
}
}
The XML to registered the service is:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="test.osdids.date.service">
<implementation class="test.osdids.date.service.DateService" />
<service>
<provide interface="test.osdids.date.IDateService" />
</service>
</scr:component>
The Manifest file of the service is:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TESTOSDIDSDATESERVICE
Bundle-SymbolicName: TESTOSDIDSDATESERVICE
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Service-Component: OSGI-INF/DateBridge.xml
Export-Package: test.osdids.date
Bundle-ActivationPolicy: lazy
- And now, this is the class which will consume the service as the client and prints out the result ( This class was located in other plug-in project, different from the former plug-in project which stored the interface and the implementation class above):
package test.osdids.date.consumer;
import test.osdids.date.IDateService;
public class DateConsumer {
private IDateService dateService;
public synchronized void setService(IDateService dateService) {
this.dateService = dateService;
System.out
.println("The Date Service has been registered successfully!");
System.out.println("The current time is: " + dateService.getDate());
}
public synchronized void unsetService(IDateService dateService) {
System.out
.println("The Date Service has been unregistered successfully!");
}
public void activate() {
System.out.println("Test again...");
System.out.println("The current time is: " + dateService.getDate());
}
public void deactivate() {
System.out.println("Stop the service!");
}
}
- This is the XML file to consume and bind the service of consumer class:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="test.osdids.date.consumer" activate="activate"
deactivate="deactivate" enabled="true" immediate="true">
<implementation class="test.osdids.date.consumer.DateConsumer" />
<reference bind="setService" cardinality="1..1"
interface="test.osdids.date.IDateService" name="IDateService" policy="static"
unbind="unsetService" />
</scr:component>
- This is the manifest file:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TESTOSDIDSDATECONSUMER
Bundle-SymbolicName: TESTOSDIDSDATECONSUMER
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: TESTOSDIDSDATESERVICE;bundle-version="1.0.0"
Service-Component: OSGI-INF/DateBridgeConsumer.xml
Import-Package: test.osdids.date
Bundle-ActivationPolicy: lazy
- And here is the result on the screen:
osgi>
(Nothing happened)
But when I use jUnit test to test the method activate() in class DateConsumer, it worked. However, when I tried to run the plug-in project by OSGI framework, nothing happened.
I hope that someone who knows this problem and help me.
Thanks a lot in advance!
I got the answer, just launch the bundle consumer by Eclipse framework (product), not by OSGI framework, then the bundles will work smoothly

Spring Configuration of Custom Apache Camel Data Format

I am using Apache Camel 2.9.2 and Spring 3.0.6.RELEASE. I am trying to use a custom DataFormat to marshal and unmarshal Camel messages. I want to configure my custom DataFormat into one of my routes using Spring.
Apache Camel's documentation states that in order to hook up my custom Data Format to a route in Spring I simply need to declare my custom DataFormat as a bean and reference it inside of my Spring route like so:
<marshal>
<custom ref="myCustomDataFormat"/>
</marshal>
http://camel.apache.org/custom-dataformat.html
So I have the following setup:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
<bean id="myCustomDataFormat" class="com.test.CustomDataFormat"/>
<!-- Camel Context -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file:C:/test?initialDelay=4000&delay=1000"/>
<marshal>
<custom ref="myCustomDataFormat"/>
</marshal>
<to uri="file:C:/test2"/>
</route>
</camelContext>
</beans>
But when I try to start Camel, I get the following nasty error:
org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'com.test.CustomDataFormat' to required type 'org.apache.camel.model.DataFormatDefinition'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.test.CustomDataFormat] to required type [org.apache.camel.model.DataFormatDefinition]: no matching editors or conversion strategy found
My Data Format is defined as follows:
package com.test;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
public class CustomDataFormat implements DataFormat {
/* (non-Javadoc)
* #see org.apache.camel.spi.DataFormat#marshal(org.apache.camel.Exchange, java.lang.Object, java.io.OutputStream)
*/
#Override
public void marshal(Exchange exchange, Object graph, OutputStream stream)
throws Exception {
System.out.println("Marshal");
byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, graph);
stream.write(bytes);
}
/* (non-Javadoc)
* #see org.apache.camel.spi.DataFormat#unmarshal(org.apache.camel.Exchange, java.io.InputStream)
*/
#Override
public Object unmarshal(Exchange exchange, InputStream stream)
throws Exception {
System.out.println("Unmarshal");
byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, stream);
return bytes;
}
}
I know that my CustomDataFormat implementation is correct because I created the following test route in Java and it worked flawlessly
package com.test;
import org.apache.camel.spring.SpringRouteBuilder;
public class TestFormatRoute extends SpringRouteBuilder {
/* (non-Javadoc)
* #see org.apache.camel.builder.RouteBuilder#configure()
*/
#Override
public void configure() throws Exception {
from("file:C:/test?initialDelay=4000&delay=1000").unmarshal(new CustomDataFormat()).to("file:C:/test2");
}
}
What am I missing?
Thanks
Update
After letting Camel completely start up after receiving this error I found to my disbelief that my custom data format actually does work in the route that I created. I'm not sure what process is attempting to parse my custom data format and failing but it is apparently not the same process parsing the data format to put into my route.
This solves the functional requirement of the data format, but it does not explain why I am receiving this error.
I have also confirmed that it was not the name of my data format (CustomDataFormat) that was causing the issue. Renaming my DataFormat to a unique name (MerlinDataFormat) did not fix the error.
I still would like to know why I am receiving this error since large blocks of ugly red errors in my console and log files aren't exactly appealing.
Thanks again.
It turned out to be a pretty simple solution (and one that I admit should have been easy to see). There are actually two ways to go about solving this issue, one of them using only spring and one of them requiring an additional java class.
Solution 1
Create a new class extending DataFormatDefinition which has the same properties as your custom DataFormat. Override the configureDataFormat() method to set all of the properties of the underlying DataFormat. Add constructor(s) to set the underlying DataFormat as an instance of your CustomDataFormat. Now you should be able to create an instance of your DataFormatDefinition in spring and reference it when marshaling or unmarshaling.
Solution 2 (Quick & Dirty)
In spring, create a new DataFormatDefinition bean and set it's dataFormat property as a reference to your DataFormat spring bean. Now you should be able to reference your DataFormatDefinition bean when marshaling or unmarshaling.
Not really sure what's wrong with your example, it seems just fine. Can you post your code for the data format? Are you implementing org.apache.camel.spi.DataFormat correctly?
I just set up this example with Camel 2.9.2 and it works like a charm. The Custom data format is the one from Camel documentation/source code.
<bean id="mySweetDf" class="com.example.MySweetDf"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file:C:/temp/test?initialDelay=4000&delay=1000"/>
<marshal>
<custom ref="mySweetDf"/>
</marshal>
<convertBodyTo type="java.lang.String"/>
<to uri="file:C:/temp/test2"/>
</route>
</camelContext>
data format java file:
package com.example;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
public class MySweetDf implements DataFormat {
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, graph);
String body = reverseBytes(bytes);
stream.write(body.getBytes());
}
public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, stream);
String body = reverseBytes(bytes);
return body;
}
private String reverseBytes(byte[] data) {
StringBuilder sb = new StringBuilder(data.length);
for (int i = data.length - 1; i >= 0; i--) {
char ch = (char) data[i];
sb.append(ch);
}
return sb.toString();
}
}
UPDATE
Just tried you code. Seems to work as well. Created a fresh camel 2.9.2 project via mvn archetype 168: remote -> org.apache.camel.archetypes:camel-archetype-spring (Creates a new Camel project with added Spring DSL support.). This does only include camel-core and camel-spring dependencies, nothing else.
Then replaced camel-context.xml with your xml and added your data format code in the java directory. A run with "mvn camel:run" copied the file and printed "marshal" in the log.
[pache.camel.spring.Main.main()] SpringCamelContext INFO Route: route1 started and consuming from: Endpoint[file://C:/test?delay=1000&initialDelay=4000]
[pache.camel.spring.Main.main()] SpringCamelContext INFO Total 1 routes, of which 1 is started.
[pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.9.2 (CamelContext: camel-1) started in 0.808 seconds
Marshal
Are you sure you have all dependencies setup correctly and not some .jar file that messes things up with Data formats?
UPDATE2
Okay, I think I have an idea what it is:
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/dataformat/CustomDataFormat.html
Camel already have a class named as your data format. You should try rename it to something else. CustomDataFormat extends org.apache.camel.model.DataFormatDefinition which is referred to in your error. Java should handle this, since it's two different namespaces, but there might be some issue in your project setup that causes this conflict. Try to rename the data format and see if that solves the problem.
I too was facing the same issue with camel 2.10.0. If you provide the ref with an instance of type org.apache.camel.model.DataFormatDefinition everything works fine!! I can see two classes for xmljson conversion --> XmlJsonDataFormat implementing both DataFormat and DataFormatDefinition.
I solved the same issue that I too was facing.
Implemented a class extending DataFormatDefintion - which in it's configureDataFormat method sets injectable properties for the class that extends DataFormat (in your case this is CustomDataFormat).
I used XmlJson conversion as a template to solve.

Resources