2015-09-25 61 views
0

当我上传图片并发布页面时,会显示一条消息网页内容暂时不可用上传图片时出现“格式错误的字节输入”

这是日志中的错误:

21:28:57,687 ERROR [http-bio-2020-exec-6][render_portlet_jsp:132] null 
java.io.UTFDataFormatException: malformed input around byte 714 
    at com.liferay.portal.image.ImageToolImpl.read(ImageToolImpl.java:446) 
    at com.liferay.portal.image.ImageToolImpl.getImage(ImageToolImpl.java:368) 
    at com.liferay.portal.kernel.image.ImageToolUtil.getImage(ImageToolUtil.java:144) 
    at com.liferay.portal.service.impl.ImageLocalServiceImpl.updateImage(ImageLocalServiceImpl.java:144) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115) 
    at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62) 
    at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) 
    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) 
    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) 
    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) 
    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) 
    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) 
    at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) 
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) 
21:30:20,989 WARN [http-bio-2020-exec-3][code_jsp:?] {code="404", msg="/ONA-theme/images/common/edit_white.png", uri=/ONA-theme/images/common/edit_white.png} 
21:30:20,990 WARN [http-bio-2020-exec-10][code_jsp:?] {code="404", msg="/ONA-theme/images/common/edit_template_white.png", uri=/ONA-theme/images/common/edit_template_white.png} 
21:30:20,997 WARN [http-bio-2020-exec-3][code_jsp:?] {code="404", msg="/ONA-theme/images/common/add_white.png", uri=/ONA-theme/images/common/add_white.png} 
21:30:20,998 WARN [http-bio-2020-exec-10][code_jsp:?] {code="404", msg="/ONA-theme/images/common/configuration_white.png", uri=/ONA-theme/images/common/configuration_white.png} 

我怎样才能成功上传图片?

+0

你上传了什么样的图片?你正在使用哪个版本的Liferay?他抱怨图像的格式,所以你应该先尝试一个不同的图像。 –

+0

另外,在你的主题中有很多图片的404错误,这让我想知道你的主题没有更深的问题。请提供一些关于您的配置,主题和构建方式的更多信息。另外:什么时候发生这种异常? –

+0

先生,每当我使用PNG文件,然后它不工作,并给这个错误,但是当我上传JPG图像,然后它的工作正常,...你能告诉我背后的原因。 – 007

回答

0

试着了解图像的类型是否导致问题。 在Linux/Mac的系统尝试使用(由壳/ temrinal)

# file filepath/filename 

一个常见的问题是,你正在使用CMYK而不是RGB色彩空间(尝试使用Photoshop等软件打开图像,并验证/转换你的形象)。

+0

先生,每当我使用PNG文件,然后它不工作,并给这个错误,但是当我上传JPG图像,那么它的工作很好,... 你能告诉我背后的原因。 – 007

+0

正如我写的,我认为你应该检查你的图像类型...例如,你确认你的PNG的颜色空间?如果你不习惯以这种方式继续尝试使用这个PNG文件:http://www.personal.psu.edu/sdh5174/Mario_png.png(我刚刚验证了它的颜色空间,它是RGB而不是CMYK)。让我知道... –