Tribon,

it would be nice if you could add some hint to the tutorial for those people
facing the same problem.

Thanks in advance,
Lars




Tribon Cheng wrote:
> 
> puneetjain,您好!
> 
>       I meet the same problem, this is caused by
> "File.createTempFile(filename)", the filename should not
> be an absolute path, See the modified method code belowing:
> 
> 
>    private void onProviderExchange(MessageExchange exchange) throws
> MessagingException 
>         {
>         // Exchange is finished
>         if (exchange.getStatus() == ExchangeStatus.DONE) 
>             {
>             return;
>             }
>         // Exchange has been aborted with an exception
>         else if (exchange.getStatus() == ExchangeStatus.ERROR) 
>             {
>             return;
>             }
>         // Fault message
>         else if (exchange.getFault() != null) 
>             {
>             exchange.setStatus(ExchangeStatus.DONE);
>             channel.send(exchange);
>             } 
>         else 
>             {
>             NormalizedMessage in = exchange.getMessage("in");
>             
>             if (in == null)
>                 {
>                 // no in message - strange
>                 throw new
> MessagingException("HandlerBean.onProviderExchange(): Exchange has no IN
> message");
>                 }
>             else
>                 {
>                 String fileName = null;
>                 DataHandler content = null;
>                 Set attNames = in.getAttachmentNames();
>                 Iterator it = attNames.iterator();
>                 
>                 if (attNames.size()==1)
>                     {
>                     if (it.hasNext())
>                         {
>                         try
>                             {
> 
>                                                   //////mofify the code start
>                             File file = new File(it.next().toString());
>                                                       fileName = 
> file.getName();
>                             content =
> in.getAttachment(file.getAbsolutePath());
>    
>                             File f = File.createTempFile("tmp_",
> fileName);
> 
>                                                       //////mofify the code 
> end
> 
>                             FileOutputStream fos = new
> FileOutputStream(f);
>                             content.writeTo(fos);
>                             fos.flush();
>                             fos.close();
>                             
>                             // for the sake of simplicity only return the
> file received as attachment
>                             NormalizedMessage out =
> exchange.createMessage();
>         
>                             // set the content to dummy xml tag
>                             out.setContent(new
> StringSource("<payload/>"));
>                             
>                             FileDataSource fds = new FileDataSource(f);
>                             InputStream is = fds.getInputStream();
>                             
>                             // create a handler for the attachment
>                             DataHandler dh = new DataHandler(new
> StreamDataSource(is, fds.getContentType()));
>                             
>                             // and add it to the message
>                             out.addAttachment(fileName+"_cch", dh);
>                             
>                             // prepare and send the exchange
>                             exchange.setMessage(out, "out");
>                             channel.send(exchange);
>                             
>                             f.deleteOnExit();
>                             }
>                         catch (IOException ex)
>                             {
>                             throw new
> MessagingException("HandlerBean.onProviderExchange(): " +
> ex.getLocalizedMessage());
>                             }
>                         }
>                     }
>                 else
>                     {
>                     // more or less than one attachment
>                     throw new
> MessagingException("HandlerBean.onProviderExchange(): Wrong message format
> (invalid attachment count)");
>                     }
>                 }
>             }
>         }
> 
> ======= 2008-01-30 18:37:38 您在来信中写道:=======
> 
>>
>>I have follow all the step to create http upload application given in the
>>tutorial of servicemix successfully.
>>The deployable of the application is successfully deployed on the
>>servicemix.
>>When I create a client and try to upload a file using the appliaction
>>following exception displayed in the browser:
>>
>><?xml version="1.0" encoding="UTF-8" ?> 
>>- <error>
>>- <![CDATA[ 
>>javax.jbi.messaging.MessagingException: HandlerBean.onProviderExchange():
>>The filename, directory name, or volume label syntax is incorrect
>>      at
>>org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:173)
>>      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>
>>
>>
>>
>>And following exception appear on the console of servicemix:
>>
>>
>>ERROR - BeanComponent                  - Error processing exchange InOut[
>>  id: ID:10.105.115.61-117c979d8b4-10:2
>>  status: Active
>>  role: provider
>>  service: {http://www.servicemix.org/example}httphandler
>>  endpoint: handlerEndpoint
>>  in: <?xml version="1.0" encoding="UTF-8"?><payload/>
>>]
>>javax.jbi.messaging.MessagingException: HandlerBean.onProviderExchange():
>>The filename, directory name, or volume label syntax is incorrect
>>        at
>>org.apache.servicemix.jbi.HandlerBean.onProviderExchange(HandlerBean.java:173)
>>        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)
>>
>>
>>Please help me to solve this problem.
>>
>>Thanks,
>>Puneet Jain
>>
>>
>>-- 
>>View this message in context:
http://www.nabble.com/Problem-in-running-the-http-upload-application-tutorial-Example-tp15178224s12049p15178224.html
>>Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> = = = = = = = = = = = = = = = = = = = =
>                       
> 
>         致
> 礼!
>  
>                                
> ---------------------------------------------------------
> 程操红 
> 用友软件股份有限公司 集团平台技术开发部
> Tel:62435466
> Email:[EMAIL PROTECTED]
> 地址:北京市海淀区北清路68号 用友软件园
> 邮编:100085
> ---------------------------------------------------------
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-in-running-the-http-upload-application-tutorial-Example-tp15178224s12049p15199294.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to