You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by steff aka sid <sr...@brockhaus-gruppe.de> on 2008/02/27 15:45:05 UTC

Http Upload Tutorial

Hello,
I am new to servicemix and I've a problem with the http upload tutorial. I
can deploy the SA file an all is fine. But when I select a file an upload
it. I got following error message on the servicemix console:

ERROR - BeanComponent                  - Error processing exchange InOut[
  id: ID:127.0.1.1-1185b214ac4-43:0
  status: Active
  role: provider
  service: {http://brockhaus-gruppe.de/ex}httphandler
  endpoint: handlerEndpoint
  in: <?xml version="1.0" encoding="UTF-8"?><payload/>
]
java.lang.NullPointerException
        at javax.activation.MimeType.parse(MimeType.java:99)
        at javax.activation.MimeType.<init>(MimeType.java:65)
        at javax.activation.DataHandler.getBaseType(DataHandler.java:637)
        at
javax.activation.DataHandler.getDataContentHandler(DataHandler.java:598)
        at javax.activation.DataHandler.writeTo(DataHandler.java:315)
        at
org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:152)
        at
org.apache.servicemix.jbi.HandlerBean.onMessageExchange(HandlerBean.java:56)
        at
org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:235)
        at
org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
        at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

The browser shows me the following:

<error>
java.lang.NullPointerException
	at javax.activation.MimeType.parse(MimeType.java:99)
	at javax.activation.MimeType.<init>(MimeType.java:65)
	at javax.activation.DataHandler.getBaseType(DataHandler.java:637)
	at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:598)
	at javax.activation.DataHandler.writeTo(DataHandler.java:315)
	at
org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:152)
	at
org.apache.servicemix.jbi.HandlerBean.onMessageExchange(HandlerBean.java:56)
	at
org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:235)
	at org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
	at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
	at java.lang.Thread.run(Thread.java:595)
</error>


I've searched for related problems but haven't found anything...

Anyone an idea? Could it be that there is a special MimeType required or
something like that?

Regards
/Steffen
-- 
View this message in context: http://www.nabble.com/Http-Upload-Tutorial-tp15714716s12049p15714716.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Http Upload Tutorial

Posted by Lars Heinemann <la...@compart.net>.
Ren,

if this is really the case, then feel free to update the tutorial page to help other users not to run into this issue.

Any contribution is welcome.

Regards,
Lars




Ren Sydney schrieb:
> There is actually one error in the HandlerBean.java provided on the tutorial
> page. Go to this file and locate the bit
>
> <code>
>  /**
>     * handles the incoming provider messages
>     * 
>     * @param exchange
>     * @throws MessagingException
>     */
>     private void onProviderExchange(MessageExchange exchange) throws
> MessagingException {
>         ...
>         ...
>         if (attNames.size()==1) {
>             if (it.hasNext()) {
>                 try {
>                     File file = new File(it.next().toString());
>                     fileName = file.getName();
>                     content = in.getAttachment(file.getAbsolutePath());
>         ...
>         ...
>     }
> </code>
>
> Change file.getAbsolutePath() to file.getName()
>
> Then it should work! Enjoy
>
> Good luck.
>
>
> steff aka sid wrote:
>   
>> Hello,
>> I am new to servicemix and I've a problem with the http upload tutorial. I
>> can deploy the SA file an all is fine. But when I select a file an upload
>> it. I got following error message on the servicemix console:
>>
>> ERROR - BeanComponent                  - Error processing exchange InOut[
>>   id: ID:127.0.1.1-1185b214ac4-43:0
>>   status: Active
>>   role: provider
>>   service: {http://brockhaus-gruppe.de/ex}httphandler
>>   endpoint: handlerEndpoint
>>   in: <?xml version="1.0" encoding="UTF-8"?><payload/>
>> ]
>> java.lang.NullPointerException
>>         at javax.activation.MimeType.parse(MimeType.java:99)
>>         at javax.activation.MimeType.<init>(MimeType.java:65)
>>         at javax.activation.DataHandler.getBaseType(DataHandler.java:637)
>>         at
>> javax.activation.DataHandler.getDataContentHandler(DataHandler.java:598)
>>         at javax.activation.DataHandler.writeTo(DataHandler.java:315)
>>         at
>> org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:152)
>>         at
>> org.apache.servicemix.jbi.HandlerBean.onMessageExchange(HandlerBean.java:56)
>>         at
>> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:235)
>>         at
>> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
>>         at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
>>         at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
>>         at
>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>>         at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>         at java.lang.Thread.run(Thread.java:595)
>>
>> The browser shows me the following:
>>
>> <error>
>> java.lang.NullPointerException
>> 	at javax.activation.MimeType.parse(MimeType.java:99)
>> 	at javax.activation.MimeType.<init>(MimeType.java:65)
>> 	at javax.activation.DataHandler.getBaseType(DataHandler.java:637)
>> 	at
>> javax.activation.DataHandler.getDataContentHandler(DataHandler.java:598)
>> 	at javax.activation.DataHandler.writeTo(DataHandler.java:315)
>> 	at
>> org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:152)
>> 	at
>> org.apache.servicemix.jbi.HandlerBean.onMessageExchange(HandlerBean.java:56)
>> 	at
>> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:235)
>> 	at org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
>> 	at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
>> 	at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
>> 	at
>> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>> 	at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>> 	at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>> 	at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>> 	at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>> 	at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>> 	at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>> 	at java.lang.Thread.run(Thread.java:595)
>> </error>
>>
>>
>> I've searched for related problems but haven't found anything...
>>
>> Anyone an idea? Could it be that there is a special MimeType required or
>> something like that?
>>
>> Regards
>> /Steffen
>>
>>     
>
>   

Re: Http Upload Tutorial

Posted by Ren Sydney <re...@gmail.com>.
There is actually one error in the HandlerBean.java provided on the tutorial
page. Go to this file and locate the bit

<code>
 /**
    * handles the incoming provider messages
    * 
    * @param exchange
    * @throws MessagingException
    */
    private void onProviderExchange(MessageExchange exchange) throws
MessagingException {
        ...
        ...
        if (attNames.size()==1) {
            if (it.hasNext()) {
                try {
                    File file = new File(it.next().toString());
                    fileName = file.getName();
                    content = in.getAttachment(file.getAbsolutePath());
        ...
        ...
    }
</code>

Change file.getAbsolutePath() to file.getName()

Then it should work! Enjoy

Good luck.


steff aka sid wrote:
> 
> Hello,
> I am new to servicemix and I've a problem with the http upload tutorial. I
> can deploy the SA file an all is fine. But when I select a file an upload
> it. I got following error message on the servicemix console:
> 
> ERROR - BeanComponent                  - Error processing exchange InOut[
>   id: ID:127.0.1.1-1185b214ac4-43:0
>   status: Active
>   role: provider
>   service: {http://brockhaus-gruppe.de/ex}httphandler
>   endpoint: handlerEndpoint
>   in: <?xml version="1.0" encoding="UTF-8"?><payload/>
> ]
> java.lang.NullPointerException
>         at javax.activation.MimeType.parse(MimeType.java:99)
>         at javax.activation.MimeType.<init>(MimeType.java:65)
>         at javax.activation.DataHandler.getBaseType(DataHandler.java:637)
>         at
> javax.activation.DataHandler.getDataContentHandler(DataHandler.java:598)
>         at javax.activation.DataHandler.writeTo(DataHandler.java:315)
>         at
> org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:152)
>         at
> org.apache.servicemix.jbi.HandlerBean.onMessageExchange(HandlerBean.java:56)
>         at
> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:235)
>         at
> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
>         at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
>         at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
>         at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>         at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> 
> The browser shows me the following:
> 
> <error>
> java.lang.NullPointerException
> 	at javax.activation.MimeType.parse(MimeType.java:99)
> 	at javax.activation.MimeType.<init>(MimeType.java:65)
> 	at javax.activation.DataHandler.getBaseType(DataHandler.java:637)
> 	at
> javax.activation.DataHandler.getDataContentHandler(DataHandler.java:598)
> 	at javax.activation.DataHandler.writeTo(DataHandler.java:315)
> 	at
> org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:152)
> 	at
> org.apache.servicemix.jbi.HandlerBean.onMessageExchange(HandlerBean.java:56)
> 	at
> org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:235)
> 	at org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:211)
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
> 	at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
> 	at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
> 	at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
> 	at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
> 	at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:595)
> </error>
> 
> 
> I've searched for related problems but haven't found anything...
> 
> Anyone an idea? Could it be that there is a special MimeType required or
> something like that?
> 
> Regards
> /Steffen
> 

-- 
View this message in context: http://www.nabble.com/Http-Upload-Tutorial-tp15714716p16437475.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Http Upload Tutorial

Posted by ma...@uk.bnpparibas.com.
Hi,
 wild guesses::

- html file.    <form action="http://localhost:8192/upload/" method="post" 
enctype="multipart/form-data">


- have u configured ur su properly?


from errors, problems come from your HandlerBean (which you were in charge 
to create if i remember correctly that tutorial)

org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:152)
                 at
org.apache.servicemix.jbi.HandlerBean.onMessageExchange(HandlerBean.java:56)

hth
        marco


This communication is confidential, may be privileged and is meant only for the intended recipient.  If you are 
not the intended recipient, please notify the sender by reply and delete this message from your system.  Any 
unauthorised dissemination, distribution or copying hereof is prohibited.

BNP Paribas Fund Services UK Limited, BNP Paribas Trust Corporation UK Limited, BNP Paribas UK Limited, 
BNP Paribas Commodity Futures Ltd and Investment Fund Services Limited are authorised and regulated by 
the Financial Services Authority.

BNP Paribas, BNP Paribas Securities Services and BNP Paribas Private Bank are authorised by the CECEI 
and AMF.  BNP Paribas London Branch, BNP Paribas Securities Services London Branch and BNP Paribas 
Private Bank London Branch are regulated by the Financial Services Authority for the conduct of their UK 
business.  BNP Paribas Securities Services London Branch is also a member of the London Stock Exchange.