You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Freeman Fang <fr...@gmail.com> on 2010/06/01 04:09:24 UTC

Re: Exception when using vsf:poller with sftp (ServiceMix 4.2)

Hi,

Seems we need add javax.crypto package import for  
org.apache.servicemix.bundles.commons-vfs bundle.
Could you do a quick test to verify it?
You can change the META-INF/MANIFEST.MF of
$SMX4_home/system/org/apache/servicemix/bundles/ 
org.apache.servicemix.bundles.commons-vfs/1.0_3/ 
org.apache.servicemix.bundles.commons-vfs-1.0_3.jar
add  javax.crypto for Import-Package.

Freeman
On 2010-6-1, at 上午3:50, Martin S. wrote:

>
> Lars
>
> I did some further investigation. I enabled the debug log for the  
> class
> org.apache.commons.vfs.impl.StandardFileSystemManager  I can see  
> this entry:
>
> Skipping provider  
> "org.apache.commons.vfs.provider.sftp.SftpFileProvider"
> because required class "javax.crypto.Cipher" is not available.
>
> This seems strange because I can see the package javax.crypto being  
> imported
> for Java 1.6 in etc/config.properties:
>
> jre-1.6=, \
> com.sun.org.apache.xalan.internal.xsltc.trax, \
> com.sun.org.apache.xerces.internal.dom, \
> com.sun.org.apache.xerces.internal.jaxp, \
> com.sun.org.apache.xerces.internal.xni, \
> com.sun.jndi.ldap, \
> javax.accessibility, \
> \# javax.activation, \
> javax.activity, \
> \# javax.annotation, \
> \# javax.annotation.processing, \
> javax.crypto, \
> javax.crypto.interfaces, \
> javax.crypto.spec, \
> javax.imageio, \
> ...
>
> what's up here?
> -- 
> View this message in context: http://old.nabble.com/Exception-when-using-vsf%3Apoller-with-sftp-%28ServiceMix-4.2%29-tp28700187p28734552.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Exception when using vsf:poller with sftp (ServiceMix 4.2)

Posted by rsmaoui <s-...@hotmail.com>.
Hi,

I tried to use servicemix-vfs component to import files from sftp server.

this is my xbean.xml file:
<vfs:poller service="esb:pollerService"
                endpoint="vfs-poller"
                path="sftp://user:password@hostIp/home/"
                targetService="esb:bean"
                period="10000"
                deleteFile="false"
                recursive="true">
    </vfs:poller>

when i run servicemix server this poller don't worked, i don't see error
message in log file.

i changed the protocol to connect to ftp server and it work.

i don't know what's the problem in sftp protocol !!! 



--
View this message in context: http://servicemix.396122.n5.nabble.com/Exception-when-using-vsf-poller-with-sftp-ServiceMix-4-2-tp417225p5710017.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Exception when using vsf:poller with sftp (ServiceMix 4.2)

Posted by subendu <su...@aol.com>.
I have been trying vfs-poller recently with
'apache-servicemix-3.6.0-fuse-00-35' and I still have the same issue.

Is this the update only available on 'SMX4'? If so, how can I make it work
for the above SMX release?

I tried with the following dependencies

<dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-vfs</artifactId>
      <version>2011.02</version>
      <type>jbi-component</type>
</dependency>
<dependency>
    	<groupId>com.jcraft</groupId>
    	<artifactId>jsch</artifactId>
    	<version>0.1.46</version>
    	<type>jar</type>
    	<scope>compile</scope>
</dependency>
<dependency>
    	<groupId>commons-vfs</groupId>
    	<artifactId>commons-vfs</artifactId>
    	<version>1.0</version>
    	<type>jar</type>
    	<scope>compile</scope>
</dependency> 

java.io.IOException: Failed to initialize file system manager.
        at
org.apache.servicemix.vfs.FileObjectResolver.createIOException(FileObjectResolver.java:78)
        at
org.apache.servicemix.vfs.FileObjectResolver.resolveToFileObject(FileObjectResolver.java:66)
        at
org.apache.servicemix.vfs.VFSPollingEndpoint.poll(VFSPollingEndpoint.java:232)
        at
org.apache.servicemix.common.endpoints.PollingEndpoint$PollSchedulerTask$1.run(PollingEndpoint.java:220)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
----
        at
org.apache.commons.vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:85)
        at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:662)
        at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:602)
        at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:570)
        at
org.apache.servicemix.vfs.FileObjectResolver.resolveToFileObject(FileObjectResolver.java:53)
        ... 5 more
Caused by: java.net.MalformedURLException: unknown protocol: sftp
        at java.net.URL.<init>(URL.java:574)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at
org.apache.commons.vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:66)
        ... 9 more

Thanks,

--
View this message in context: http://servicemix.396122.n5.nabble.com/Exception-when-using-vsf-poller-with-sftp-ServiceMix-4-2-tp417225p5691603.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Exception when using vsf:poller with sftp (ServiceMix 4.2)

Posted by Freeman Fang <fr...@gmail.com>.
Hi Martin,

Thanks for the feedback, I will commit fix for commons-vfs bundle very  
soon.

Freeman
On 2010-6-2, at 上午4:10, Martin S. wrote:

>
> Freeman, Lars
>
> Adding the javax.crypto to Import-Package in META-INF/MANIFEST.MF  
> did the
> trick! I tested it sucessfully. However manipulating the MANIFEST.MF  
> with an
> editor and then repackage it did not work first. The MANIFEST.MF was  
> always
> invalid after this. So I checked out
> http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/commons-vfs-1.0 
> ,
> changed pom.xml and then build it. I added the javax.crypto package  
> insinde
> the <servicemix.osgi.import.pkg> element. Then bundle was okay and it
> worked!
>
> During the process of finding this bug two issues gave me a headache  
> and I
> have two proposals for enhancements:
>
> 1) The class StandardFileSystemManager which configures the different
> FileProviders for webdav, SFTP, etc. is only create once after  
> startup of
> servicemix. This this is the case because the instance is retrieved  
> from a
> static singelton. See FileObjectResolver.java:46
>
>            if (manager == null) {
>                manager = VFS.getManager().;
>            }
>
> This is bad because StandardFileSystemManager will never reconfigure  
> itself
> and be able to detect necessary support classes which have probaly  
> added
> later with new bundles.
> I think FileObjectResolver should better create its own instance of
> StandardFileSystemManager instead of getting the static one.  
> Otherwise one
> would have to restart servicemix completely to add new FileProviders.
>
> 2) It was very hard to track connection problems because
> resolveToFileObject() throws only IOExceptions without the root  
> Exception.
> All details about a problem (wrong credentials, unknown host for SFTP
> connections, etc.) are not available for logging and tracking.
> I had to run a dedicated test with the jsch Library to find out that a
> connection failed because of a missing entry in .ssh/known_hosts.  
> There was
> no chance to make this visible in the servicemix log.
> I think resolveToFileObject() should log those root exceptions or  
> pass them
> along with the IOException.
>
> But most important I would like to thank both of you for your  
> support. Now
> my proof-of-concept works and chances are high that I will use  
> servicemix in
> our next customer project.
>
> Martin
>
>
>
>
>
> -- 
> View this message in context: http://old.nabble.com/Exception-when-using-vsf%3Apoller-with-sftp-%28ServiceMix-4.2%29-tp28700187p28746884.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Exception when using vsf:poller with sftp (ServiceMix 4.2)

Posted by "Martin S." <sc...@orcasys.ch>.
Freeman, Lars

Adding the javax.crypto to Import-Package in META-INF/MANIFEST.MF did the
trick! I tested it sucessfully. However manipulating the MANIFEST.MF with an
editor and then repackage it did not work first. The MANIFEST.MF was always
invalid after this. So I checked out
http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/commons-vfs-1.0,
changed pom.xml and then build it. I added the javax.crypto package insinde
the <servicemix.osgi.import.pkg> element. Then bundle was okay and it
worked!

During the process of finding this bug two issues gave me a headache and I
have two proposals for enhancements:

1) The class StandardFileSystemManager which configures the different
FileProviders for webdav, SFTP, etc. is only create once after startup of
servicemix. This this is the case because the instance is retrieved from a
static singelton. See FileObjectResolver.java:46 

            if (manager == null) {
                manager = VFS.getManager().;
            }

This is bad because StandardFileSystemManager will never reconfigure itself
and be able to detect necessary support classes which have probaly added
later with new bundles.
I think FileObjectResolver should better create its own instance of
StandardFileSystemManager instead of getting the static one. Otherwise one
would have to restart servicemix completely to add new FileProviders.

2) It was very hard to track connection problems because
resolveToFileObject() throws only IOExceptions without the root Exception.
All details about a problem (wrong credentials, unknown host for SFTP
connections, etc.) are not available for logging and tracking.
I had to run a dedicated test with the jsch Library to find out that a
connection failed because of a missing entry in .ssh/known_hosts. There was
no chance to make this visible in the servicemix log.
I think resolveToFileObject() should log those root exceptions or pass them
along with the IOException.

But most important I would like to thank both of you for your support. Now
my proof-of-concept works and chances are high that I will use servicemix in
our next customer project.

Martin





-- 
View this message in context: http://old.nabble.com/Exception-when-using-vsf%3Apoller-with-sftp-%28ServiceMix-4.2%29-tp28700187p28746884.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Exception when using vsf:poller with sftp (ServiceMix 4.2)

Posted by rsmaoui <s-...@hotmail.com>.
Hi,
i have a question. after build of commons-vfs project this component added
to maven repository, but nothing changed in our application, so there is
dependecy should be added or another update?

thanks.

--
View this message in context: http://servicemix.396122.n5.nabble.com/Exception-when-using-vsf-poller-with-sftp-ServiceMix-4-2-tp417225p5713368.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.