Error creating style SignatureButtonBox. selected: false prefix: throws exception - codenameone

Upon instansiation of SignatureComponent,
SignatureComponent custSignature = new SignatureComponent();
Throws:
[EDT] 0:1:21,183 - Error creating style SignatureButtonBox. selected: false prefix:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
[EDT] 0:1:21,183 - Exception: java.lang.ClassCastException - java.lang.Integer cannot be cast to java.lang.String
I have refreshed all CN1 libs, clean compiles.
Thoughts?

Related

How do I debug errors like this in Codenameone?

I have an app that works well on the simulator. I did an Android build and installed on a device. Now , several functionalities don't work. The debug log I receive contain several errors of this sort
[EDT] 0:23:31,275 - Exception in Ziemozi version 1.0
[EDT] 0:23:31,275 - OS and
[EDT] 0:23:31,275 - Error java.lang.NullPointerException: Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
[EDT] 0:23:31,276 - Current Form null
[EDT] 0:23:31,276 - Exception: java.lang.NullPointerException - Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.codename1.ab.l.n(int)' on a null object reference
at com.codename1.g.j.a(InfiniteScrollAdapter.java:156)
at com.codename1.g.j.a(InfiniteScrollAdapter.java:143)
at com.codename1.ab.aa.t(InfiniteContainer.java:177)
at com.codename1.ab.aa$5.run(InfiniteContainer.java:193)
at com.codename1.ab.r.n(Display.java:1298)
at com.codename1.ab.r.l(Display.java:1242)
at com.codename1.ab.r.k(Display.java:1130)
at com.codename1.ab.ao.run(RunnableWrapper.java:120)
at com.codename1.impl.b$1.run(CodenameOneThread.java:60)
How do I debug this or how does it arise so I can fix it?
This happens when one of the components returned from InfiniteContainer is null. E.g. you did something like:
public Component[] fetchComponents(int index, int amount);
// ...
return cmps;
}
cmps is a valid array that's bigger than 0 but one of its elements is null.

Codename One - Play a sound

The following code works fine in the Simulator, I hear the audio:
try {
Media m = MediaManager.createMedia((Display.getInstance().getResourceAsStream(getClass(), "/notification_sound_bell.mp3")), "audio/mpeg");
m.play();
} catch (IOException err) {
Log.e(err);
}
But it doesn't work at all on real Android devices. What's wrong?
On the generated apk, the "notification_sound_bell.mp3" file is placed in /res/raw folder.
On an Android 4.x device I get:
[EDT] 0:0:0,118 - Codename One revisions: 3b20edadec808867afc2b19774268b66890616ad
[EDT] 0:0:0,129 - Exception: java.lang.NullPointerException - null
java.lang.NullPointerException at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:856) [EDT] 0:0:0,214 - Exception
in Alert every five minutes version 1.0 [EDT] 0:0:0,215 - OS and [EDT]
0:0:0,215 - Error java.lang.NullPointerException [EDT] 0:0:0,216 -
Current Form null [EDT] 0:0:0,217 - Exception:
java.lang.NullPointerException - null java.lang.NullPointerException
at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:856)
On an Android 7.x device I get:
[EDT] 0:0:20,186 - Codename One revisions:
3b20edadec808867afc2b19774268b66890616ad
[EDT] 0:0:20,191 - Exception: java.lang.NullPointerException - Attempt
to invoke virtual method 'int java.io.InputStream.read(byte[], int,
int)' on a null object reference java.lang.NullPointerException:
Attempt to invoke virtual method 'int java.io.InputStream.read(byte[],
int, int)' on a null object reference at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:762) [EDT] 0:0:20,198 - Exception
in Alert every five minutes version 1.0 [EDT] 0:0:20,199 - OS and
[EDT] 0:0:20,201 - Error java.lang.NullPointerException: Attempt to
invoke virtual method 'int java.io.InputStream.read(byte[], int, int)'
on a null object reference [EDT] 0:0:20,202 - Current Form null [EDT]
0:0:20,204 - Exception: java.lang.NullPointerException - Attempt to
invoke virtual method 'int java.io.InputStream.read(byte[], int, int)'
on a null object reference java.lang.NullPointerException: Attempt to
invoke virtual method 'int java.io.InputStream.read(byte[], int, int)'
on a null object reference at
com.codename1.impl.android.AndroidImplementation.createMedia(AndroidImplementation.java:2802)
at com.codename1.ui.Display.createMedia(Display.java:2998) at
com.codename1.media.MediaManager.createMedia(MediaManager.java:125)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:94)
at
it.galgani.app.fiveMinutesAlert.MyApplication.start(MyApplication.java:66)
at
it.galgani.app.fiveMinutesAlert.MyApplicationStub.run(MyApplicationStub.java:140)
at com.codename1.ui.Display.processSerialCalls(Display.java:1116) at
com.codename1.ui.Display.mainEDTLoop(Display.java:911) at
com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at
com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:762)
It seems our system has a special treatment to the notification_sound prefix in a file name on Android for usage with background notification sounds on Android. Just rename the file to something else and it should work as expected.

Use Camel recipientList got ClassCastException

I'm trying to use Apache Camel to dynamically specify destination when program running. After changing the recipientList parameter to List of Endpoint will encounter a ClassCastException.
Could anyone who can help to advice if I have missed something?
Thanks a lot.
from("jms:queue:jms/XXXQ").recipientList(header("recipientList"));
List<Endpoint> eps = new ArrayList<Endpoint>();
CxfEndpoint endpoint = exchange.getContext().getEndpoint("cxf:bean:configServiceEndpoint", CxfEndpoint.class);
endpoint.setAddress(URL);
endpoint.setWsdlURL(WSDL);
eps.add(endpoint);
CxfProducer cp = (CxfProducer) endpoint.createProducer();
cp.start();
exchange.getIn().setHeader("recipientList", eps);
<cxf:cxfEndpoint id="configServiceEndpoint" address="${CXFTestSupport.URL}" wsdlURL="${CXFTestSupport.WSDL}" serviceClass="com.company.client.ClientService">
</cxf:cxfEndpoint>
The exception as the following:
2017-05-16 09:24:16,100 13100 WARN org.apache.camel.component.jms.EndpointMessageListener - Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - java.lang.ClassCastException: org.apache.camel.component.cxf.CxfSpringEndpoint incompatible with java.lang.String]
org.apache.camel.RuntimeCamelException: java.lang.ClassCastException: org.apache.camel.component.cxf.CxfSpringEndpoint incompatible with java.lang.String
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1619)
at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:186)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:107)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:699)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:637)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:605)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:308)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:246)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1144)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1136)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1033)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1157)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:627)
at java.lang.Thread.run(Thread.java:809)
Caused by: java.lang.ClassCastException: org.apache.camel.component.cxf.CxfSpringEndpoint incompatible with java.lang.String
at org.apache.cxf.transport.http.Headers.transferProtocolHeadersToURLConnection(Headers.java:358)
at org.apache.cxf.transport.http.Headers.setProtocolHeadersInConnection(Headers.java:310)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setProtocolHeaders(URLConnectionHTTPConduit.java:222)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1288)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1267)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:210)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
at org.apache.cxf.io.AbstractThresholdOutputStream.unBuffer(AbstractThresholdOutputStream.java:89)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:63)
at org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:80)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:51)
at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100)
at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:241)
at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:253)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:215)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:174)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:418)
at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:116)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at org.apache.camel.builder.NoErrorHandlerBuilder$1.process(NoErrorHandlerBuilder.java:40)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:798)
at org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:83)
at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:304)
at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:289)
at java.util.concurrent.FutureTask.run(FutureTask.java:274)
... 3 more
2017-05-16 09:24:16,100 13100 WARN org.apache.camel.component.jms.EndpointMessageListener - Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - java.lang.ClassCastException: org.apache.camel.component.cxf.CxfSpringEndpoint incompatible with java.lang.String]
org.apache.camel.RuntimeCamelException: java.lang.ClassCastException: org.apache.camel.component.cxf.CxfSpringEndpoint incompatible with java.lang.String
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1619)
at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:186)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:107)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:699)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:637)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:605)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:308)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:246)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1144)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1136)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1033)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1157)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:627)
at java.lang.Thread.run(Thread.java:809)
Caused by: java.lang.ClassCastException: org.apache.camel.component.cxf.CxfSpringEndpoint incompatible with java.lang.String
at org.apache.cxf.transport.http.Headers.transferProtocolHeadersToURLConnection(Headers.java:358)
at org.apache.cxf.transport.http.Headers.setProtocolHeadersInConnection(Headers.java:310)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.setProtocolHeaders(URLConnectionHTTPConduit.java:222)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1288)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1267)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.onFirstWrite(URLConnectionHTTPConduit.java:210)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
at org.apache.cxf.io.AbstractThresholdOutputStream.unBuffer(AbstractThresholdOutputStream.java:89)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:63)
at org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:80)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:51)
at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100)
at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:241)
at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:253)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:215)
at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor$SAAJOutEndingInterceptor.handleMessage(SAAJOutInterceptor.java:174)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:418)
at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:116)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at org.apache.camel.builder.NoErrorHandlerBuilder$1.process(NoErrorHandlerBuilder.java:40)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:798)
at org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:83)
at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:304)
at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:289)
at java.util.concurrent.FutureTask.run(FutureTask.java:274)
... 3 more
You are putting
List<Endpoint>
to the recipientList header but according to the documentation (http://camel.apache.org/recipient-list.html, "Dynamic Recipient List" -> "Iteratable value") Endpoint objects cannot be used:
The dynamic list of recipients that are defined in the header must be
iterable such as:
java.util.Collection
java.util.Iterator
arrays
org.w3c.dom.NodeList
a single String with values separated by comma
any other type will be regarded as a single value

How to make non-Localizable SplashScreen in WPF

I'm just adding internationalization to my next WPF application, and have followed the instructions here.
I then noticed that there would be a fair amount of duplication in the satellite DLL, so marked the images that won't be localized in the .csproj as
<Localizable>False</Localizable>
Unfortunately, one of my resources is used in a SplashScreen thus:
SplashScreen ss = new SplashScreen("Images/splash.png");
ss.Show(false);
And this throws an exception when the Show call is executed. Here's the exception output
A first chance exception of type 'System.IO.IOException' occurred in WindowsBase.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'System.RuntimeType.CreateInstanceImpl'
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance'
A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
Step into: Stepping over method without symbols 'System.Windows.Markup.WpfXamlLoader.Load'
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'The invocation of the constructor on type 'MainWindow' that matches the specified binding constraints threw an exception.' Line number '4' and line position '9'.
When I remove the False line it works again.
Is there any way to load the resource I want, which is stored in test.unlocalizable.g.resources?

Fuse ESB: Bundle with mina cannot be deployed in ServiceMix

I'm trying to use apache mina with camel on fuse esb. I'm facing to a deployement issue.
Here is my route :
<beans xmlns...
<bean id="myCodec" class="test.net.mina.codec.MyMinaCodec" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="mina:tcp://localhost:3100?sync=false&codec=#myCodec" />
<to uri="activemq://Test.IncomingMsg" />
</route>
</camelContext>
</beans>
Bellow is the stacktrace got from the servicemix console :
Exception in thread "SpringOsgiExtenderThread-18" org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route8: Route[[From[mina:tcp://localhost:3100?sync=false&codec=#myCo... because of Failed to resolve endpoint: mina://tcp://localhost:3100?codec=%23myCodec&sync=false due to: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec#8073d3
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1149)
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:110)
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.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
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:132)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route8: Route[[From[mina:tcp://localhost:3100?sync=false&codec=#myCo... because of Failed to resolve endpoint: mina://tcp://localhost:3100?codec=%23myCodec&sync=false due to: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec#8073d3
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:170)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:698)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1679)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1464)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1356)
at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:169)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1324)
at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:213)
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:108)
... 10 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: mina://tcp://localhost:3100?codec=%23myCodec&sync=false due to: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec#8073d3
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:444)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:48)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:180)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:110)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:116)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:88)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:798)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:165)
... 20 more
Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: codec as there isn't a setter method with same type: test.net.mina.codec.MyMinaCodec nor type conversion possible: No type converter available to convert from type: test.net.mina.codec.MyMinaCodec to the required type: org.apache.mina.filter.codec.ProtocolCodecFactory with value test.net.mina.codec.MyMinaCodec#8073d3
at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:341)
at org.apache.camel.util.EndpointHelper.setReferenceProperties(EndpointHelper.java:250)
at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:199)
at org.apache.camel.component.mina.MinaComponent.createEndpoint(MinaComponent.java:92)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:426)
... 28 more
And here is my codec factory :
public class MyMinaCodec implements ProtocolCodecFactory {
public ProtocolDecoder getDecoder(IoSession session) throws Exception {
return new MyMinaDecoder();
}
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return new MyMinaEncoder();
}
}
Any idea of what I'm doing wrong here? Thanks for your help
Ok, its my bad! I forgot to specify the required bundle inside pom.xml for maven :
<Require-Bundle>org.apache.servicemix.bundles.mina</Require-Bundle>

Resources