Bramha Naidu,

If you're not polling XML files, you should use a marshaller to translate your file into XML and back again. Because it treats your file as XML, you are getting the exception: 'content not allowed in prolog'. Have you tried adding the XML snippet in my previous post to your poller and writer components to set a flat file marshaller?

Gert



[EMAIL PROTECTED] wrote:

Gert,

I am not polling any xml file. I am polling plaintext file.

This is an output in JBOSS console for earlier attachment.

*Output:*

17:31:08,545 INFO [AutoDeploymentService] Directory: deploy: Archive changed: processing FP-SA-1.0-SNAPSHOT.jar ...

17:31:09,279 INFO [XBeanXmlBeanDefinitionReader] Loading XML bean definitions from file [D:\Jboss-4.0.5.GA\server\default\servicemix\service-assemblies\FP-SA\version_10\sus\servicemix-lwcontainer\FP-LW-SU\servicemix.xml]

17:31:09,638 INFO [FileSystemXmlApplicationContext] Bean factory for application context [servicemix]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [jbi,rfilter]; root of BeanFactory hierarchy

17:31:09,638 INFO [FileSystemXmlApplicationContext] 2 beans defined in application context [servicemix]

17:31:09,638 INFO [FileSystemXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [EMAIL PROTECTED]

17:31:09,670 INFO [FileSystemXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [EMAIL PROTECTED]

17:31:09,670 INFO [DefaultListableBeanFactory] Pre-instantiating singletons infactory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [jbi,rfilter]; root of BeanFactory hierarchy]

17:31:11,435 INFO [XBeanXmlBeanDefinitionReader] Loading XML bean definitions from file [D:\Jboss-4.0.5.GA\server\default\servicemix\service-assemblies\FP-SA\version_10\sus\servicemix-jsr181\FP-JSR-SU\xbean.xml]

17:31:11,482 INFO [FileSystemXmlApplicationContext] Bean factory for application context [xbean]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans org.apache.servicemix.jsr181.Jsr181Endpoint]; root of BeanFactory hierarchy

17:31:11,498 INFO [FileSystemXmlApplicationContext] 1 beans defined in application context [xbean]

17:31:11,498 INFO [FileSystemXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [EMAIL PROTECTED]

17:31:11,498 INFO [FileSystemXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [EMAIL PROTECTED]

17:31:11,498 INFO [DefaultListableBeanFactory] Pre-instantiating singletons infactory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [org.apache.servicemix.jsr181.Jsr181Endpoint]; parent: [EMAIL PROTECTED]

17:31:12,638 INFO [XBeanXmlBeanDefinitionReader] Loading XML bean definitions from file [D:\Jboss-4.0.5.GA\server\default\servicemix\service-assemblies\FP-SA\version_10\sus\servicemix-http\FP-HTTP-SU\xbean.xml]

17:31:12,670 INFO [FileSystemXmlApplicationContext] Bean factory for application context [xbean]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [org.apache.servicemix.http.HttpEndpoint]; root of BeanFactory hierarchy

17:31:12,670 INFO [FileSystemXmlApplicationContext] 1 beans defined in application context [xbean]

17:31:12,670 INFO [FileSystemXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [EMAIL PROTECTED]

17:31:12,670 INFO [FileSystemXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [EMAIL PROTECTED]

17:31:12,670 INFO [DefaultListableBeanFactory] Pre-instantiating singletons infactory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [org.apache.servicemix.http.HttpEndpoint]; root of BeanFactory hierarchy]

17:31:13,263 INFO [DescriptorFactory] Validation error on file:/D:/Jboss-4.0.5.GA/server/default/servicemix/service-assemblies/FP-SA/version_10/sus/servicemix-http/FP-HTTP-SU/META-INF/jbi.xml: org.xml.sax.SAXParseException: cvc-complex-type.4: Attribute 'interface-name' must appear on element 'consumes'.

17:31:13,357 INFO [ServiceAssemblyLifeCycle] Starting service assembly: FP-SA

17:31:13,420 INFO [ServiceUnitLifeCycle] Initializing service unit: FP-LW-SU

17:31:13,420 INFO [ServiceUnitLifeCycle] Initializing service unit: FP-JSR-SU

17:31:13,420 INFO [ServiceUnitLifeCycle] Initializing service unit: FP-HTTP-SU

17:31:13,420 INFO [ServiceUnitLifeCycle] Starting service unit: FP-LW-SU

17:31:13,420 INFO [ComponentMBeanImpl] Initializing component: fileSender

17:31:13,482 INFO [ComponentMBeanImpl] Starting component: fileSender

17:31:13,482 INFO [ComponentMBeanImpl] Initializing component: filePoller

17:31:13,513 INFO [ComponentMBeanImpl] Starting component: filePoller

17:31:13,513 INFO [ServiceUnitLifeCycle] Starting service unit: FP-JSR-SU

17:31:13,513 INFO [ServiceUnitLifeCycle] Starting service unit: FP-HTTP-SU

17:31:13,529 INFO [AutoDeploymentService] Directory: deploy: Finished installation of archive: FP-SA-1.0-SNAPSHOT.jar

17:31:13,670 ERROR [STDERR] [Fatal Error] mysqltest.txt:1:1: Content is not allowed in prolog.

17:31:18,529 ERROR [STDERR] [Fatal Error] mysqltest.txt:1:1: Content is not allowed in prolog.

Thanks&Regards

Brahma Naidu

-----Original Message-----
From: Gert Vanthienen [mailto:[EMAIL PROTECTED]
Sent: Monday, June 11, 2007 5:21 PM
To: [email protected]
Cc: Aelem, Bramha Naidu (Cognizant)
Subject: Re: Reg:servicemix-lw container

Brahma Naidu,

I know that there is no directory property, you can safely refer to a

directory from the file property of the poller (replace

d:/filefolder/testfile.txt by d:/filefolder).

Secondly, let me repeat myself: Does the file you're polling contain XML?

If it doesn't contain XML, you should add this to both your poller and

your writer components

    <property name="marshaler">

        <bean

class="org.apache.servicemix.components.util.SimpleFlatFileMarshaler"/>

    </property>

Do you get any exceptions on your console?  Those might also hold useful

information...

Regards,

Gert

P.S.  Could you send your mails to servicemix-users as well, so others

can try to solve the same problem using the mail archives?

[EMAIL PROTECTED] wrote:

> Hi Gert,

>
> The Filepoller class doesn't contain any directory property.

> But FileWriter contain the directory property.

>
> Attachment is the servicemix.xml for servicemix-lwcontainer. Please go

> through the attachment and tell me how to set the endpoint in filepoller

> and filesender in servicemix.xml.

>
> Please help me.

>
> Thanks&Regards

> Brahma Naidu

> >
> -----Original Message-----

> From: Gert Vanthienen [mailto:[EMAIL PROTECTED]

> Sent: Monday, June 11, 2007 4:22 PM

> To: [email protected]

> Cc: Aelem, Bramha Naidu (Cognizant)

> Subject: Re: Reg:servicemix-lw container

>
> Bramha Naidu,

>
> There is no directory property on the FilePoller, but you can specify a

> directory instead of a file on the file property.

>
> Does the file you are polling contain XML? If not, you should specify

> another marshaler (e.g.

> org.apache.servicemix.components.util.SimpleFlatFileMarshaler) on both

> the poller and sender endpoint. Otherwise, you will get parser

> exceptions when the sender is trying to parse the message while writing

> it to disk. Doesn't your console show exceptions?

>
> Gert

> > >
>> Hi Gert,

>>
>> I am using the class org.apache.servicemix.components.file.FilePoller

>> for polling for a particular file. This class does not allow me to use

>> > >
>> a directory property. So when I use file property to locate the file,

>> it is working fine.

>>
>> <sm:activationSpec componentName="filePoller"

>> service="pollfile:filePoller"

>>
> destinationService="pollfile:fileSender">

>
>> <sm:component>

>>
>> <bean class="org.apache.servicemix.components.file.FilePoller">

>>
>> <property name="file" value="D:/FileFolder/Testfile.txt"/>

>>
>> <property name="period" value="5000"/>

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

>>
>> <property name="filter">

>>
>> <ref bean="filter"/>

>>
>> </property>

>>
>> </bean>

>>
>> </sm:component>

>>
>> </sm:activationSpec>

>>
>> But the problem is with the file sender component. I am using

>> org.apache.servicemix.components.file.FileWriter to write the file to

>> a location. But I am getting a file with 0kb at the destination

>>
> folder.

>
>> Please help.

>>
>> The sender component is written as below:

>>
>> <sm:activationSpec componentName="fileSender"

>> service="pollfile:fileSender">

>>
>> <sm:component>

>>
>> <bean class="org.apache.servicemix.components.file.FileWriter">

>>
>> <property name="directory" value="D:/dest" />

>>
>> <property name="marshaler">

>>
>> <bean

>>
> class="org.apache.servicemix.components.util.DefaultFileMarshaler">

>
>> <!--<property name="useMessageContent" value="false"/>-->

>>
>> <property name="fileName">

>>
>> <bean

>>
> class="org.apache.servicemix.expression.JaxenStringXPathExpression">

>
>> <constructor-arg value="concat('sample_', /sample/@id, '.txt')" />

>>
>> </bean>

>>
>> </property>

>>
>> </bean>

>>
>> </property>

>>
>> </bean>

>>
>> </sm:component>

>>
>> </sm:activationSpec>

>>
>> Thanks&Regards

>>
>> Brahma Naidu

>>
>> -----Original Message-----

>> From: Gert Vanthienen [mailto:[EMAIL PROTECTED]

>> Sent: Monday, June 11, 2007 2:46 PM

>> To: [email protected]

>> Cc: Aelem, Bramha Naidu (Cognizant)

>> Subject: Re: Reg:servicemix-lw container

>>
>> L.S.,

>>
>> Continuing this on the users mailing list...

>>
>> First of all, I would recommend you to use the new JBI component

>>
>> (servicemix-file) for polling and sending files. Look at

>>
>> http://incubator.apache.org/servicemix/servicemix-file.html for more

>>
>> information on that one.

>>
>> For the lightweight example you have here:

>>
>> - You should make the file attribute in the poller refer to a

>>
> directory

>
>> instead of a file.

>>
>> - If you want to transfer something other than XML files, you should

>>
> be

>
>> using a Marshaler to do so (e.g. ServiceMix's SimpleFlatFileMarshaler

>>
> or

>
>> one you build yourself)

>>
>> Regards,

>>
>> Gert

>>
>> [EMAIL PROTECTED] wrote:

>> >>
>>> Hi Gert,

>>>
>>> Could you please help me in servicemix-lwcontainer?

>>>
>>> I am copying file from source to destination using filepoller and

>>>
>>> filesender components. But it's copying file from source with zero

>>>
>>> bytes. How to resolve this error.

>>>
>>> My servicemix.xml looks like this:

>>>
>>> <beans xmlns:sm="http://servicemix.apache.org/config/1.0";

>>>
>>> xmlns:pollfile="http://pollfile.cts.com/pollFile";>

>>>
>>> <classpath>

>>>
>>> <location>.</location>

>>>
>>> <location>lib/servicemix-components-3.1-incubating.jar</location>

>>>
>>> <location>lib/oro-2.0.8.jar</location>

>>>
>>> </classpath>

>>>
>>> <sm:serviceunit id="jbi">

>>>
>>> <sm:activationSpecs>

>>>
>>> *<!-- Look for files in the source directory -->*

>>>
>>> * *

>>>
>>> <sm:activationSpec componentName="filePoller"

>>>
>>> service="pollfile:filePoller"

>>>
> destinationService="pollfile:fileSender">

>
>>> <sm:component>

>>>
>>> <bean class="org.apache.servicemix.components.file.FilePoller">

>>>
>>> <property name="file" value="D:/MySQLTest/mysqltest.txt" />

>>>
>>> <property name="period" value="5000" />

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

>>>
>>> <property name="filter" ref="rfilter" />

>>>
>>> </bean>

>>>
>>> </sm:component>

>>>
>>> </sm:activationSpec>

>>>
>>> *<!-- Write files to the destination directory -->*

>>>
>>> * *

>>>
>>> <sm:activationSpec componentName="fileSender"

>>>
>>> service="pollfile:fileSender">

>>>
>>> <sm:component>

>>>
>>> <bean class="org.apache.servicemix.components.file.FileWriter">

>>>
>>> <property name="directory" value="D:/dest/" />

>>>
>>> <property name="marshaler">

>>>
>>> <bean

>>>
> class="org.apache.servicemix.components.util.DefaultFileMarshaler">

>
>>> * <!--*

>>>
>>> *<property name="fileName">*

>>>
>>> * <bean

>>>
> class="org.apache.servicemix.jbi.JaxenStringXPathExpression">*

>
>>> * <constructor-arg value="concat('sample_', /sample/@id, '.txt')"

>>>
> />*

>
>>> * </bean>*

>>>
>>> * </property>*

>>>
>>> * *--* >*

>>>
>>> </bean>

>>>
>>> </property>

>>>
>>> </bean>

>>>
>>> </sm:component>

>>>
>>> </sm:activationSpec>

>>>
>>> </sm:activationSpecs>

>>>
>>> </sm:serviceunit>

>>>
>>> <bean id="rfilter" class="org.apache.oro.io.GlobFilenameFilter">

>>>
>>> <constructor-arg value="*.txt"/>

>>>
>>> </bean>

>>>
>>> </beans>

>>>
>>> I commented some portion in the destination part with that it's

>>>
>>> copying file from source to destination with 0 bytes.

>>>
>>> Could you please help me in this problem?

>>>
>>> How to copy exact file form source directory to destination

>>>
> directory?

>
>>> *Thanks&Regards*

>>>
>>> *Bramha Naidu Aelem*

>>>
>>> This e-mail and any files transmitted with it are for the sole use

>>>
> of

>
>>> the intended recipient(s) and may contain confidential and

>>>
> privileged

>
>>> information.

>>>
>>> If you are not the intended recipient, please contact the sender by

>>>
>>> reply e-mail and destroy all copies of the original message.

>>>
>>> Any unauthorized review, use, disclosure, dissemination, forwarding,

>>>
>>> printing or copying of this email or any action taken in reliance on

>>>
>>> this e-mail is strictly

>>>
>>> prohibited and may be unlawful.

>>>
>> This e-mail and any files transmitted with it are for the sole use of

>> the intended recipient(s) and may contain confidential and privileged

>> information.

>> If you are not the intended recipient, please contact the sender by

>> reply e-mail and destroy all copies of the original message.

>> Any unauthorized review, use, disclosure, dissemination, forwarding,

>> printing or copying of this email or any action taken in reliance on

>> this e-mail is strictly

>> prohibited and may be unlawful.

>> >> > > > > This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.

> If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

> Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly

> prohibited and may be unlawful.

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.


Reply via email to