sun.io.MalformedInputException IBM Websphere 中间件异常
1[13-12-2 18:09:21:923 CST] 00000015 WebApp E Exception caught while initializing context 2org.springframework.beans.factory.BeanDefinitionStoreException: Unable to determine validation mode for [file [/opt/IBM/WebSphere/AppServer/profiles/Appserver02/installedApps/Appserver02/sinoom_v1_0_0_war.ear/sinoom_v1.0.0.war/WEB-INF/classes/spring/applicationContext-quartz.xml]]: an error occurred whilst reading from the InputStream.; nested exception is sun.io.MalformedInputException 3Caused by: sun.io.MalformedInputException 4 at sun.io.ByteToCharGB18030.convert(ByteToCharGB18030.java:171) 5 at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:314) 6 at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:364) 7 at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:250) 8 at java.io.InputStreamReader.read(InputStreamReader.java:212) 9 at java.io.BufferedReader.fill(BufferedReader.java:157) 10 at java.io.BufferedReader.readLine(BufferedReader.java:320) 11 at java.io.BufferedReader.readLine(BufferedReader.java:383) 12 at org.springframework.util.xml.XmlValidationModeDetector.detectValidationMode(XmlValidationModeDetector.java:79) 13 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.detectValidationMode(XmlBeanDefinitionReader.java:468) 14 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.getValidationModeForResource(XmlBeanDefinitionReader.java:438) 15 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404) 16 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:357) 17 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) 18 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126) 19 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142) 20 at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:123) 21 at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:91) 22 at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94) 23 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:294) 24 at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) 25 at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) 26 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) 27 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) 28 at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:641) 29 at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:298) 30 at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:289) 31 at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:90) 32 at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:157) 33 at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:665) 34 at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:618) 35 at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335) 36 at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551) 37 at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1301) 38 at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1138) 39 at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:569) 40 at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:817) 41 at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:950) 42 at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2120) 43 at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342) 44 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
此问题为xml配置文件编码问题,一般出现的websphere、weblogic等中间件上。
1、解决方法将xml文件的编码格式,注意是文件,改成GB18030。此外还要将内部编码格式encoding="GB18030"。
这里说明一下修改方法:
1)、创建一个xml文件,将其文件格式改为GB18030
2)、将原来出问题的编码格式的文件所有内容copy到记事本中,注意是记事本,而不是其他编辑器。
3)、将xml中编码格式改为encoding="GB18030"
2、如果上边的第一种方法解决不了,我们可以将xml配置文件里的所有中文字符删掉,再试试。
3、有的人认为是ibm io的问题,他们是这样解决问题的。
这个问题产生的原因是IBM在JDK 1.4版本中为了追求对io通道的高效率改变了JDK 1.3中对io通道中异常处理的策略。
IBM JDK 1.4中对于io通道的异常处理更加严格,因此系统中会报上面的错误。
解决这一问题的办法是不使用IBM JDK 1.4中默认的io通道,而使用nio通道。具体的做法如下:
1)、打开管理控制台,找到并选择运行这个JSP的应用服务器
2)、依次选择进程定义,java虚拟机,一般JVM自变量
3)、添加-Dibm.stream.nio=true
4)、确定,保存
5)、重新启动该服务器
参考文档