[mule-user] The transformer does not support source type "[B".

4 views
Skip to first unread message

samspot

unread,
Feb 5, 2007, 12:33:14 PM2/5/07
to us...@mule.codehaus.org

Hi, I am new to mule and still working on getting a fairly basic setup going.
I'm wrote a FileToString transformer and when I use it i get the following:

1. The transformer "FileToString" does not support source type "[B".
Endpoint is "file://in?transformers=FileToString"
(org.mule.umo.transformer.TransformerException)
org.mule.transformers.AbstractTransformer:227
(http://mule.codehaus.org/docs/apidocs/org/mule/umo/transformer/TransformerException.html)

I looked around and I haven't been able to figure out what "[B" is. Here
are some more snippets from my config for reference (my code is based on the
cookbook recipe
http://mule.mulesource.org/wiki/display/MULE/File+Delivery+Receipt+via+SMTP):

<transformers>
<transformer name="FileToString"
className="edu.duke.dcri.FileToString"
returnClass="java.lang.String"/>
</transformers>

<endpoint-identifiers>
<endpoint-identifier name="ServiceInbound"
value="file://in?transformers=FileToString" />
</endpoint-identifiers>

<connector name="myFileConnector"
className="org.mule.providers.file.FileConnector">
<properties>
<property name="moveToDirectory" value="out" />
<property name="moveToPattern"
value="${SYSTIME}_${ORIGINALNAME}" />
</properties>
</connector>

--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8810902
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Andrew Perepelytsya

unread,
Feb 5, 2007, 1:10:12 PM2/5/07
to us...@mule.codehaus.org
Use the Search, Luke :) Read the Java docs and this thread:

http://www.nabble.com/String---on-PayloadFilter---org.apache.commons.beanutils.ConversionExcep-t2432899.html#a6784153

Andrew

On 2/5/07, samspot <sam...@gmail.com> wrote:

Hi, I am new to mule and still working on getting a fairly basic setup going.
I'm wrote a FileToString transformer and when I use it i get the following:

1. The transformer "FileToString" does not support source type "[B".
Endpoint is "file://in?transformers=FileToString"
(org.mule.umo.transformer.TransformerException)
  org.mule.transformers.AbstractTransformer:227

samspot

unread,
Feb 5, 2007, 1:21:40 PM2/5/07
to us...@mule.codehaus.org

Andrew Perepelytsya wrote:
>
> Use the Search, Luke :) Read the Java docs and this thread:
>
> http://www.nabble.com/String---on-PayloadFilter---org.apache.commons.beanutils.ConversionExcep-t2432899.html#a6784153
>
> Andrew
>
>

Maybe I'm just dense, but I don't see how the link you provided is relevant
to my problem. I tried searching for the Error string and "[B" and I didn't
see anything. The javadoc for TransformerException doesn't give any info
about "[B" either.

At first i thought [B might be code for file or something. Here is the
stack trace:

Root Exception stack trace:
org.mule.umo.transformer.TransformerException: The transformer


"FileToString" does not support source type "[B". Endpoint is
"file://in?transformers=FileToString"

at
org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:227)
at org.mule.impl.MuleEvent.getTransformedMessage(MuleEvent.java:356)
at
org.mule.impl.MuleEventContext.getTransformedMessage(MuleEventContext.java:93)
at org.mule.model.DynamicEntryPoint.invoke(DynamicEntryPoint.java:104)
at
org.mule.impl.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:202)
at org.mule.impl.InterceptorsInvoker.execute(InterceptorsInvoker.java:47)
at org.mule.impl.model.DefaultMuleProxy.run(DefaultMuleProxy.java:475)
at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528)
at java.lang.Thread.run(Thread.java:595)

--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8811851

Andrew Perepelytsya

unread,
Feb 5, 2007, 1:31:34 PM2/5/07
to us...@mule.codehaus.org
Please follow the JavaDoc link in the thread. JVM has different syntax for 'array of X class' syntax, which I pointed to. In your case the class of the object is [B, which is an array of bytes. Just use this for configuring your transformer.

If you want to use the java.io.File object instead of its contents as a byte array, you should override the connector to be using the NoActionTransformer, examples are available in the Cookbook, AFAIR.

Andrew

On 2/5/07, samspot <sam...@gmail.com> wrote:

samspot

unread,
Feb 5, 2007, 2:35:02 PM2/5/07
to us...@mule.codehaus.org

Andrew Perepelytsya wrote:
>
> If you want to use the java.io.File object instead of its contents as a
> byte
> array, you should override the connector to be using the
> NoActionTransformer, examples are available in the Cookbook, AFAIR.
>

I did it this way and I'm still getting the byte array. I modified my
transformer to accept a byte array instead of a file.

public class FileToString extends AbstractTransformer {

protected final Log logger = LogFactory.getLog(getClass());

public FileToString(){
super();
// this.registerSourceType(File.class);
this.registerSourceType(byte[].class);
}

public Object doTransform(Object src, String encoding) throws
TransformerException {
String s = "test string";
logger.info("doTransform called");
return s;
}
}

The way i understand Mule, this transformer should get invoked and my class
should receive "test string" for processing. However the class throws a
ComponentException complaining that Message payload is of type: [B. My log
files show that doTransform is being invoked.

Thanks for all your help.
--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8813242

Andrew Perepelytsya

unread,
Feb 5, 2007, 2:47:37 PM2/5/07
to us...@mule.codehaus.org
Please provide complete logs.

Andrew

samspot

unread,
Feb 5, 2007, 3:53:11 PM2/5/07
to us...@mule.codehaus.org

I managed to get it to give me a File object, though the transformer is still
not converting it. Here is a complete log from startup.

http://www.nabble.com/file/6262/mule-file-2-db.log mule-file-2-db.log
--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8814605

mpablo

unread,
Feb 5, 2007, 10:27:50 PM2/5/07
to us...@mule.codehaus.org

did you try using the FileToString that already comes with the file provider?
(org.mule.providers.file.transformers.FileToString)

You can take a look at the code here
http://fisheye.codehaus.org/browse/mule/trunk/mule/transports/file/src/main/java/org/mule/providers/file/transformers/FileToString.java?r=trunk

-p

samspot wrote:
>
> I managed to get it to give me a File object, though the transformer is
> still not converting it. Here is a complete log from startup.
>
> http://www.nabble.com/file/6262/mule-file-2-db.log mule-file-2-db.log
>

--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8819926

samspot

unread,
Feb 6, 2007, 10:30:36 AM2/6/07
to us...@mule.codehaus.org

Thanks for the tip on the builtin class. I must be configuring my
transformers incorrectly because i get the same error from the log file with
that transformer (Message payload is of type: java.io.File).

Would someone mind taking a look at my config file? I'm not sure what i'm
doing wrong, the transformer setup doesn't seem complicated.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mule-configuration PUBLIC "-//SymphonySoft //DTD
mule-configuration XML V1.0//EN"

"http://www.symphonysoft.com/dtds/mule/mule-configuration.dtd">

<mule-configuration id="File-2-DB" version="1.0">

<description>
Test for moving contents of a file to a database table
</description>

<container-context
className='org.mule.extras.spring.SpringContainerContext'>
<properties>
<property name='configFile'
value='conf\applicationContext.xml' />
</properties>
</container-context>

<connector name="myFileConnector"
className="org.mule.providers.file.FileConnector">
<properties>

<property name="autoDelete" value="false" />


<property name="moveToDirectory" value="out" />
<property name="moveToPattern"
value="${SYSTIME}_${ORIGINALNAME}" />

<map name="serviceOverrides">
<property name="inbound.transformer"
value="org.mule.transformers.NoActionTransformer" />
</map>
</properties>
</connector>

<endpoint-identifiers>
<endpoint-identifier name="ServiceInbound" value="file://in" />
</endpoint-identifiers>

<transformers>
<transformer name="FileToStringCustom"


className="edu.duke.dcri.FileToString"
returnClass="java.lang.String" />

<transformer name="FileToString"
className="org.mule.providers.file.transformers.FileToString"
returnClass="java.lang.String" />
</transformers>

<mule-descriptor name="WriterUMO"
implementation="edu.duke.dcri.Writer">
<inbound-router>
<endpoint address="ServiceInbound"
transformers="FileToString" />
</inbound-router>
</mule-descriptor>
</mule-configuration>

--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8828000

mpablo

unread,
Feb 6, 2007, 9:18:42 PM2/6/07
to us...@mule.codehaus.org

from the log you posted earlier:

org.mule.umo.ComponentException: Failed to invoke edu.duke.dcri.Writer.
Component that caused exception is: WriterUMO. Message payload is of type:
java.io.File

Caused by: java.lang.NullPointerException
at edu.duke.dcri.Writer.write(Writer.java:19)
Caused by: java.lang.NullPointerException
at edu.duke.dcri.Writer.write(Writer.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.mule.model.DynamicEntryPoint.invokeCurrent(DynamicEntryPoint.java:257)
at org.mule.model.DynamicEntryPoint.invoke(DynamicEntryPoint.java:168)
at
org.mule.impl.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:202)
... 6 more
ERROR 2007-02-05 13:50:59,116 [WriterUMO.2]
org.mule.impl.DefaultComponentExceptionStrategy:
********************************************************************************
Message : Failed to invoke edu.duke.dcri.Writer. Component
that caused exception is: WriterUMO. Message payload is of type:
java.io.File
Type : org.mule.umo.ComponentException
Code : MULE_ERROR-79999
JavaDoc :
http://mule.codehaus.org/docs/apidocs/org/mule/umo/ComponentException.html
Payload : C:\eclipse\default_workspace\Mule
File-2-DB\out\1170708659085_test1.txt
********************************************************************************


This is not a problem with the transformer. It's a problem with the
edu.duke.dcri.Writer Component. More specifically a null pointer in the
write method.

--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8838691

samspot

unread,
Feb 7, 2007, 11:45:03 AM2/7/07
to us...@mule.codehaus.org

mpablo wrote:
>
>
> This is not a problem with the transformer. It's a problem with the
> edu.duke.dcri.Writer Component. More specifically a null pointer in the
> write method.
>
>

Thank you, i had not considered that since my unit test worked and i was
distracted by the payload message. After a bunch of digging around i
figured out the problem

When you use a spring bean you can't do:
<mule-descriptor name="WriterUMO"
implementation="foo.bar.writer">
...

You have to do:
<mule-descriptor name="WriterUMO"
implementation="writer">
...

Thanks!
--
View this message in context: http://www.nabble.com/The-transformer-does-not-support-source-type-%22-B%22.-tf3175715.html#a8849084

Reply all
Reply to author
Forward
0 new messages