aspose file tools*
The moose likes Java in General and the fly likes Reading remote file - difference between linux and windows deployments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Reading remote file - difference between linux and windows deployments" Watch "Reading remote file - difference between linux and windows deployments" New topic
Author

Reading remote file - difference between linux and windows deployments

Naresh Kavala
Greenhorn

Joined: Jun 07, 2008
Posts: 23
Hi Ranchers,

I am facing a problem while reading data from linux machine when app deployed in linux machine but able to read from linux when the application deployed in Windows machine. Here I am posting error prone method. I have used jsch-0.1.31.jar , commons-vfs-1.0 jars . I am getting NoSuchMethodException in former case. Could anybody suggest what should be taken care while reading data from linux to linux ..

Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Without knowing the answer to your problem: you should close your resources in a proper way (try {} finally {}). And you don't need to close the BufferedInputStream since that is being closed by the DataInputStream.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

First of all, there's a difference between NoSuchMethodException and NoSuchMethodError. The former is thrown when using reflection to find a method, the latter when a method call is compiled into the byte code but then the method disappears.

Secondly, please call nsme.printStackTrace() to the catch block. That will show you more information, including which method is missing. The cause is probably a difference between classes (or JAR files) between the compilation process and the runtime process.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Naresh Kavala
Greenhorn

Joined: Jun 07, 2008
Posts: 23
Ranchers,
I am getting following exception in this case..I have applied couple of fixes suggested but no use. has anybody ever faced this issue?
Caused by: java.lang.reflect.InvocationTargetException
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:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
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:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
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:597)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:94)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:70)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:216)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:186)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
... 73 more
Caused by: java.lang.NoSuchMethodError: com.jcraft.jsch.ChannelSftp.isClosed()Z
at org.apache.commons.vfs.provider.sftp.SftpFileSystem.putChannel(SftpFileSystem.java:158)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:148)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:75)
at org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1296)
at org.apache.commons.vfs.provider.AbstractFileObject.getContent(AbstractFileObject.java:1041)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

Naresh Kavala wrote:Caused by: java.lang.NoSuchMethodError: com.jcraft.jsch.ChannelSftp.isClosed()Z
at org.apache.commons.vfs.provider.sftp.SftpFileSystem.putChannel(SftpFileSystem.java:158)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:148)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:75)
at org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:1296)
at org.apache.commons.vfs.provider.AbstractFileObject.getContent(AbstractFileObject.java:1041)

I think you have a library version problem. The currently available version of JSch is missing the isClosed method of class com.jcraft.jsch.ChannelSftp.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading remote file - difference between linux and windows deployments