如题,需要在linux服务器上读取本地ftp服务器上的pdf文件,目的是需要校验pdf个文件的格式,大小等
我已经知道ftp服务器上的路径/var/……下面是部分代码
String temp=null;
PDDocument pdfdocument = null;
//在这里读不到ftp的文件
FileInputStream is=new FileInputStream(fileurl);///读不到
PDFParser parser = new PDFParser( is );
parser.parse();
pdfdocument= parser.getPDDocument();
COSDocument cd = pdfdocument.getDocument();
String version = cd.getHeaderString();
ByteArrayOutputStream out = new ByteArrayOutputStream();OutputStreamWriter writer = new OutputStreamWriter( out );
PDFTextStripper stripper = new PDFTextStripper();
stripper.writeText(pdfdocument.getDocument(), writer );
writer.close();
pdfdocument.close();报错(错误就出现在“FileInputStream is=new FileInputStream(fileurl);”这一行):
java.io.at java.io.FileInputStream.open(Native Method)fileurl:?
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at com.sinosoft.platform.handup.business.submitcapture.manager.CaptureManager.getPdfDesc(CaptureManager.java:1188)
at com.sinosoft.platform.handup.business.submitcapture.manager.CaptureManager.judgePdfFile(CaptureManager.java:1157)
at com.sinosoft.platform.handup.business.submitcapture.service.CaptureServiceImpl.checkUploadFile(CaptureServiceImpl.java:252)
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:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
……
请高手指教,急用
我已经知道ftp服务器上的路径/var/……下面是部分代码
String temp=null;
PDDocument pdfdocument = null;
//在这里读不到ftp的文件
FileInputStream is=new FileInputStream(fileurl);///读不到
PDFParser parser = new PDFParser( is );
parser.parse();
pdfdocument= parser.getPDDocument();
COSDocument cd = pdfdocument.getDocument();
String version = cd.getHeaderString();
ByteArrayOutputStream out = new ByteArrayOutputStream();OutputStreamWriter writer = new OutputStreamWriter( out );
PDFTextStripper stripper = new PDFTextStripper();
stripper.writeText(pdfdocument.getDocument(), writer );
writer.close();
pdfdocument.close();报错(错误就出现在“FileInputStream is=new FileInputStream(fileurl);”这一行):
java.io.at java.io.FileInputStream.open(Native Method)fileurl:?
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at com.sinosoft.platform.handup.business.submitcapture.manager.CaptureManager.getPdfDesc(CaptureManager.java:1188)
at com.sinosoft.platform.handup.business.submitcapture.manager.CaptureManager.judgePdfFile(CaptureManager.java:1157)
at com.sinosoft.platform.handup.business.submitcapture.service.CaptureServiceImpl.checkUploadFile(CaptureServiceImpl.java:252)
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:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
……
请高手指教,急用
解决方案 »
- NND, 项目移植报个No bean named 'sessionFactory' is defined
- 求助!推荐一些SSH框架的比较好的教程
- 传说中JAVA底层的面试题第二季(标题党)
- struts2的jsp页的循环输出数据代码解释
- 谁有MyEclipse比较好的首选项配置??帮帮忙!
- web.xml项目中的配置文件的加载流程和原理
- request.getHeader("REFERER"); 乱码问题
- 请问重庆朗沃教育的培训质量如何
- 哪位大侠知道用java发送dtmf(rfc2833) rtp消息怎么做
- 100台割草机割一块地需要200天,200台割草机割同一块地需要n天, 已知n < 100, 如果要设计一个系统,当输入n时,显示该草坪种的是什么草。
- 关于strurs2滴整合
- ssh 开发,为什么我提交登陆后总是转不到我要的页面
之前路径不对的时候报错是找不到该文件
FTP服务器就在本地Linux系统上
直接敲这路径可以访问到该文件
在windows下给fileurl路径为d:\\aaa.pdf