sun.io.MalformedInputException

今天真点背,感冒得鼻涕都快流干了,部署个应用还给我出个古怪的问题:

 

java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.Nodele

tException: Error parsing XML.  Cause: sun.io.MalformedInputException

        at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava.i

o.Reader;)Lcom.ibatis.sqlmap.client.SqlMapClient;(SqlMapConfigParser.java:89)

        at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(Ljava.

io.Reader;)Lcom.ibatis.sqlmap.client.SqlMapClient;(SqlMapClientBuilder.java:63)

        at net.yfsh.services.dao.DaoSqlMapConfig.<clinit>()V(DaoSqlMapConfig.jav

a:31)

        at jrockit.vm.Reflect$IClass.runClinit(I)V(Unknown Source)

        at jrockit.vm.Reflect$IClass.ensureInitialized(Ljava.lang.Class;)V(Unkno

wn Source)

        at jrockit.reflect.EmptyConstructorInvoker.newInstance([Ljava.lang.Objec

t;)Ljava.lang.Object;(Unknown Source)

        at java.lang.reflect.Constructor.newInstance([Ljava.lang.Object;I)Ljava.

lang.Object;(Unknown Source)

        at org.springframework.beans.BeanUtils.instantiateClass(Ljava.lang.refle

ct.Constructor;[Ljava.lang.Object;)Ljava.lang.Object;(BeanUtils.java:84)

        at org.springframework.beans.BeanUtils.instantiateClass(Ljava.lang.Class

;)Ljava.lang.Object;(BeanUtils.java:60)

        at org.springframework.beans.factory.support.SimpleInstantiationStrategy

.instantiate(Lorg.springframework.beans.factory.support.RootBeanDefinition;Ljava

.lang.String;Lorg.springframework.beans.factory.BeanFactory;)Ljava.lang.Object;(

SimpleInstantiationStrategy.java:45)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.instantiateBean(Ljava.lang.String;Lorg.springframework.beans.factory.sup

port.RootBeanDefinition;)Lorg.springframework.beans.BeanWrapper;(AbstractAutowir

eCapableBeanFactory.java:739)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.createBeanInstance(Ljava.lang.String;Lorg.springframework.beans.factory.

support.RootBeanDefinition;[Ljava.lang.Object;)Lorg.springframework.beans.BeanWr

apper;(AbstractAutowireCapableBeanFactory.java:727)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.createBean(Ljava.lang.String;Lorg.springframework.beans.factory.support.

RootBeanDefinition;[Ljava.lang.Object;)Ljava.lang.Object;(AbstractAutowireCapabl

eBeanFactory.java:390)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

ject()Ljava.lang.Object;(AbstractBeanFactory.java:254)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

y.getSingleton(Ljava.lang.String;Lorg.springframework.beans.factory.ObjectFactor

y;)Ljava.lang.Object;(DefaultSingletonBeanRegistry.java:144)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;Ljava.lang.Class;[Ljava.lang.Object;)Ljava.lang.Object;(Abstr

actBeanFactory.java:251)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;)Ljava.lang.Object;(AbstractBeanFactory.java:163)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver

.resolveReference(Ljava.lang.String;Lorg.springframework.beans.factory.config.Ru

ntimeBeanReference;)Ljava.lang.Object;(BeanDefinitionValueResolver.java:271)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver

.resolveValueIfNecessary(Ljava.lang.String;Ljava.lang.Object;)Ljava.lang.Object;

(BeanDefinitionValueResolver.java:128)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.applyPropertyValues(Ljava.lang.String;Lorg.springframework.beans.factory

.support.RootBeanDefinition;Lorg.springframework.beans.BeanWrapper;Lorg.springfr

amework.beans.PropertyValues;)V(AbstractAutowireCapableBeanFactory.java:1047)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.populateBean(Ljava.lang.String;Lorg.springframework.beans.factory.suppor

t.RootBeanDefinition;Lorg.springframework.beans.BeanWrapper;)V(AbstractAutowireC

apableBeanFactory.java:843)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.createBean(Ljava.lang.String;Lorg.springframework.beans.factory.support.

RootBeanDefinition;[Ljava.lang.Object;)Ljava.lang.Object;(AbstractAutowireCapabl

eBeanFactory.java:427)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

ject()Ljava.lang.Object;(AbstractBeanFactory.java:254)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

y.getSingleton(Ljava.lang.String;Lorg.springframework.beans.factory.ObjectFactor

y;)Ljava.lang.Object;(DefaultSingletonBeanRegistry.java:144)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;Ljava.lang.Class;[Ljava.lang.Object;)Ljava.lang.Object;(Abstr

actBeanFactory.java:251)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;)Ljava.lang.Object;(AbstractBeanFactory.java:163)

        at org.springframework.context.support.AbstractApplicationContext.getBea

n(Ljava.lang.String;)Ljava.lang.Object;(AbstractApplicationContext.java:683)

        at net.yfsh.services.BeanFactory.getBean(Ljava.lang.String;)Ljava.lang.O

bject;(BeanFactory.java:22)

        at net.yfsh.services.ejb.XxjlBean.<init>()V(XxjlBean.java:23)

        at net.yfsh.services.ejb.XxjlEJB_1u78z7_Impl.<init>()V(XxjlEJB_1u78z7_Im

pl.java:32)

        at java.lang.Object.emptyConstructor()V(Unknown Source)

        at java.lang.Class.newInstanceCached(I)Ljava.lang.Object;(Unknown Source

)

Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: su

n.io.MalformedInputException

        at com.ibatis.common.xml.NodeletParser.parse(Ljava.io.Reader;)V(NodeletP

arser.java:53)

        at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava.i

o.Reader;)Lcom.ibatis.sqlmap.client.SqlMapClient;(SqlMapConfigParser.java:86)

        at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(Ljava.

io.Reader;)Lcom.ibatis.sqlmap.client.SqlMapClient;(SqlMapClientBuilder.java:63)

        at net.yfsh.services.dao.DaoSqlMapConfig.<clinit>()V(DaoSqlMapConfig.jav

a:31)

        at jrockit.vm.Reflect$IClass.runClinit(I)V(Unknown Source)

        at jrockit.vm.Reflect$IClass.ensureInitialized(Ljava.lang.Class;)V(Unkno

wn Source)

        at jrockit.reflect.EmptyConstructorInvoker.newInstance([Ljava.lang.Objec

t;)Ljava.lang.Object;(Unknown Source)

        at java.lang.reflect.Constructor.newInstance([Ljava.lang.Object;I)Ljava.

lang.Object;(Unknown Source)

        at org.springframework.beans.BeanUtils.instantiateClass(Ljava.lang.refle

ct.Constructor;[Ljava.lang.Object;)Ljava.lang.Object;(BeanUtils.java:84)

        at org.springframework.beans.BeanUtils.instantiateClass(Ljava.lang.Class

;)Ljava.lang.Object;(BeanUtils.java:60)

        at org.springframework.beans.factory.support.SimpleInstantiationStrategy

.instantiate(Lorg.springframework.beans.factory.support.RootBeanDefinition;Ljava

.lang.String;Lorg.springframework.beans.factory.BeanFactory;)Ljava.lang.Object;(

SimpleInstantiationStrategy.java:45)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.instantiateBean(Ljava.lang.String;Lorg.springframework.beans.factory.sup

port.RootBeanDefinition;)Lorg.springframework.beans.BeanWrapper;(AbstractAutowir

eCapableBeanFactory.java:739)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.createBeanInstance(Ljava.lang.String;Lorg.springframework.beans.factory.

support.RootBeanDefinition;[Ljava.lang.Object;)Lorg.springframework.beans.BeanWr

apper;(AbstractAutowireCapableBeanFactory.java:727)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.createBean(Ljava.lang.String;Lorg.springframework.beans.factory.support.

RootBeanDefinition;[Ljava.lang.Object;)Ljava.lang.Object;(AbstractAutowireCapabl

eBeanFactory.java:390)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

ject()Ljava.lang.Object;(AbstractBeanFactory.java:254)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

y.getSingleton(Ljava.lang.String;Lorg.springframework.beans.factory.ObjectFactor

y;)Ljava.lang.Object;(DefaultSingletonBeanRegistry.java:144)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;Ljava.lang.Class;[Ljava.lang.Object;)Ljava.lang.Object;(Abstr

actBeanFactory.java:251)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;)Ljava.lang.Object;(AbstractBeanFactory.java:163)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver

.resolveReference(Ljava.lang.String;Lorg.springframework.beans.factory.config.Ru

ntimeBeanReference;)Ljava.lang.Object;(BeanDefinitionValueResolver.java:271)

        at org.springframework.beans.factory.support.BeanDefinitionValueResolver

.resolveValueIfNecessary(Ljava.lang.String;Ljava.lang.Object;)Ljava.lang.Object;

(BeanDefinitionValueResolver.java:128)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.applyPropertyValues(Ljava.lang.String;Lorg.springframework.beans.factory

.support.RootBeanDefinition;Lorg.springframework.beans.BeanWrapper;Lorg.springfr

amework.beans.PropertyValues;)V(AbstractAutowireCapableBeanFactory.java:1047)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.populateBean(Ljava.lang.String;Lorg.springframework.beans.factory.suppor

t.RootBeanDefinition;Lorg.springframework.beans.BeanWrapper;)V(AbstractAutowireC

apableBeanFactory.java:843)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.createBean(Ljava.lang.String;Lorg.springframework.beans.factory.support.

RootBeanDefinition;[Ljava.lang.Object;)Ljava.lang.Object;(AbstractAutowireCapabl

eBeanFactory.java:427)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

ject()Ljava.lang.Object;(AbstractBeanFactory.java:254)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

y.getSingleton(Ljava.lang.String;Lorg.springframework.beans.factory.ObjectFactor

y;)Ljava.lang.Object;(DefaultSingletonBeanRegistry.java:144)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;Ljava.lang.Class;[Ljava.lang.Object;)Ljava.lang.Object;(Abstr

actBeanFactory.java:251)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

(Ljava.lang.String;)Ljava.lang.Object;(AbstractBeanFactory.java:163)

        at org.springframework.context.support.AbstractApplicationContext.getBea

n(Ljava.lang.String;)Ljava.lang.Object;(AbstractApplicationContext.java:683)

        at net.yfsh.services.BeanFactory.getBean(Ljava.lang.String;)Ljava.lang.O

bject;(BeanFactory.java:22)

        at net.yfsh.services.ejb.XxjlBean.<init>()V(XxjlBean.java:23)

        at net.yfsh.services.ejb.XxjlEJB_1u78z7_Impl.<init>()V(XxjlEJB_1u78z7_Im

pl.java:32)

        at java.lang.Object.emptyConstructor()V(Unknown Source)

Caused by: sun.io.MalformedInputException

        at sun.io.ByteToCharGB18030.convert([BII[CII)I(ByteToCharGB18030.java:14

2)

        at sun.nio.cs.StreamDecoder$ConverterSD.convertInto([CII)I(StreamDecoder

.java:247)

        at sun.nio.cs.StreamDecoder$ConverterSD.implRead([CII)I(StreamDecoder.ja

va:278)

        at sun.nio.cs.StreamDecoder.read([CII)I(StreamDecoder.java:182)

        at java.io.InputStreamReader.read([CII)I(InputStreamReader.java:167)

        at weblogic.apache.xerces.impl.XMLEntityManager$EntityScanner.load(IZ)Z(

XMLEntityManager.java:3307)

        at weblogic.apache.xerces.impl.XMLEntityManager$EntityScanner.scanLitera

l(ILweblogic.apache.xerces.xni.XMLString;)I(XMLEntityManager.java:2578)

        at weblogic.apache.xerces.impl.XMLScanner.scanAttributeValue(Lweblogic.a

pache.xerces.xni.XMLString;Lweblogic.apache.xerces.xni.XMLString;Ljava.lang.Stri

ng;Lweblogic.apache.xerces.xni.XMLAttributes;IZ)V(XMLScanner.java:905)

        at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanAttrib

ute(Lweblogic.apache.xerces.xni.XMLAttributes;)V(XMLDocumentFragmentScannerImpl.

java:818)

        at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartE

lement()Z(XMLDocumentFragmentScannerImpl.java:740)

        at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCo

ntentDispatcher.dispatch(Z)Z(XMLDocumentFragmentScannerImpl.java:1477)

        at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocume

nt(Z)Z(XMLDocumentFragmentScannerImpl.java:329)

        at weblogic.apache.xerces.parsers.DTDConfiguration.parse(Z)Z(DTDConfigur

ation.java:525)

        at weblogic.apache.xerces.parsers.DTDConfiguration.parse(Lweblogic.apach

e.xerces.xni.parser.XMLInputSource;)V(DTDConfiguration.java:581)

        at weblogic.apache.xerces.parsers.XMLParser.parse(Lweblogic.apache.xerce

s.xni.parser.XMLInputSource;)V(XMLParser.java:152)

        at weblogic.apache.xerces.parsers.DOMParser.parse(Lorg.xml.sax.InputSour

ce;)V(DOMParser.java:257)

        at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(Lorg.xml.sax.In

putSource;)Lorg.w3c.dom.Document;(DocumentBuilderImpl.java:201)

        at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(Lorg.xml.sax.InputSou

rce;)Lorg.w3c.dom.Document;(RegistryDocumentBuilder.java:149)

        at com.ibatis.common.xml.NodeletParser.createDocument(Ljava.io.Reader;)L

org.w3c.dom.Document;(NodeletParser.java:157)

        at com.ibatis.common.xml.NodeletParser.parse(Ljava.io.Reader;)V(NodeletP

arser.java:50)

        at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava.i

o.Reader;)Lcom.ibatis.sqlmap.client.SqlMapClient;(SqlMapConfigParser.java:86)

        at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(Ljava.

io.Reader;)Lcom.ibatis.sqlmap.client.SqlMapClient;(SqlMapClientBuilder.java:63)

        at net.yfsh.services.dao.DaoSqlMapConfig.<clinit>()V(DaoSqlMapConfig.jav

a:31)

        at jrockit.vm.Reflect$IClass.runClinit(I)V(Unknown Source)

        at jrockit.vm.Reflect$IClass.ensureInitialized(Ljava.lang.Class;)V(Unkno

wn Source)

        at jrockit.reflect.EmptyConstructorInvoker.newInstance([Ljava.lang.Objec

t;)Ljava.lang.Object;(Unknown Source)

        at java.lang.reflect.Constructor.newInstance([Ljava.lang.Object;I)Ljava.

lang.Object;(Unknown Source)

        at org.springframework.beans.BeanUtils.instantiateClass(Ljava.lang.refle

ct.Constructor;[Ljava.lang.Object;)Ljava.lang.Object;(BeanUtils.java:84)

        at org.springframework.beans.BeanUtils.instantiateClass(Ljava.lang.Class

;)Ljava.lang.Object;(BeanUtils.java:60)

        at org.springframework.beans.factory.support.SimpleInstantiationStrategy

.instantiate(Lorg.springframework.beans.factory.support.RootBeanDefinition;Ljava

.lang.String;Lorg.springframework.beans.factory.BeanFactory;)Ljava.lang.Object;(

SimpleInstantiationStrategy.java:45)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.instantiateBean(Ljava.lang.String;Lorg.springframework.beans.factory.sup

port.RootBeanDefinition;)Lorg.springframework.beans.BeanWrapper;(AbstractAutowir

eCapableBeanFactory.java:739)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

Factory.createBeanInstance(Ljava.lang.String;Lorg.springframework.beans.factory.

support.RootBeanDefinition;[Ljava.lang.Object;)Lorg.springframework.beans.BeanWr

apper;(AbstractAutowireCapableBeanFactory.java:727)

2008-09-18 08:01:34,390 DaoSqlMapConfig - Error occurred.  Cause: com.ibatis.com

mon.xml.NodeletException: Error parsing XML.  Cause: sun.io.MalformedInputExcept

ion

 

以前还真是从来没有遇见过这种问题,开始以为是哪个SqlMap里配置得有问题呢,都检查了一遍也没发现问题,再一看同事那都好好的,都是从SVN上下的同样的代码,为什么我的就不行呢,于是,就开始从部署环境上找原因,可找来找去也没找出问题,正在头疼时,一个同事告诉我是字符集的问题,在加载SQLMap主配置文件时加入以下指定字符集的代码即可:

 

Resources.setCharset(Charset.forName("UTF-8")); 
Reader reader = Resources.getResourceAsReader(resource); 

 

 

 但是现在还没能真正理解到底是什么原因,我整个项目及项目中文件的字符集均设置的是UTF-8编码,如果有谁知道希望能留言帮助解答!

唉, 到头来问题总算是解决了。。。可以好好睡觉了。。。。

你可能感兴趣的:(java,apache,ibatis,weblogic,sun)