我正在使用以下代码从使用Java(spring mvc)的服务器读取图像
if(imagePath != null && imagePath.length() > 0 )
{
byte fileContent[] = new byte[3000];
try (FileInputStream fin = new FileInputStream(new File(imagePath))) {// here is the Exception
while(fin.read(fileContent) >= 0) {
// Base64.encodeBase64(fileContent);
}
}
}
小路
/var/sentora/hostdata/campusguru/public_html/resources/images/bharath.png
该位置有图像,但我正在跟踪以下异常
java.io.FileNotFoundException: \var\sentora\hostdata\campusguru\public_html\resources\images\bharath.png (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.rasvek.cms.controller.StudentController.getStudentAdmissionByAdmissionId(StudentController.java:696)
at com.rasvek.cms.controller.StudentController$$FastClassBySpringCGLIB$$cb2af793.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
如果路径在Windows上,我会遇到任何异常(在本地系统中)
但是在网络服务器(Linux)上, 我正在查找文件geeting异常。
请帮助我,谢谢。
莫回无
相关分类