各位大虾,
小弟最近在做XML生成DOC,同样的代码发布在tomcat能够正常生成doc文件,在weblogic 10.3下出现以下的错误。
现在只有在这2个Web 应用服务器跑过,查找原因是XML模板文件太大(含有图片和表格),可就是tomcat下能够正常。
和客户沟通减小模板,这个客户不同意,只能从下面2个方法着手
1.是不是weblogic需要配置什么,或者打个补丁什么的,避开此错误。
2.怎么样修改代码,增加这个流。
请各位帮帮忙看看,下周一就要给客户看效果啊。
代码:
【public void transform(OutputStream out, InputStream data, Map params,
InputStream template) throws TransformerException {
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(
template));
Result result = new StreamResult(out);
if (params != null && !params.isEmpty()){
Set set = (Set) params.keySet();
for (Iterator it = set.iterator(); it.hasNext();) {
String key = (String) it.next();
String value = (String) params.get(key);
transformer.setParameter(key, value);
}
}
transformer.transform(new StreamSource(data), result);
}
】
错误日志:
【java.io.UTFDataFormatException: encoded string too long: 273889 bytes
at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
at java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
at com.sun.org.apache.bcel.internal.classfile.ConstantUtf8.dump(Constant
Utf8.java:125)
at com.sun.org.apache.bcel.internal.classfile.ConstantPool.dump(Constant
Pool.java:230)
at com.sun.org.apache.bcel.internal.classfile.JavaClass.dump(JavaClass.j
ava:322)
at com.sun.org.apache.bcel.internal.classfile.JavaClass.dump(JavaClass.j
ava:307)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.dumpClass(XSLT
C.java:766)
at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.translate
(Stylesheet.java:735)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.
java:354)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.
java:429)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.n
ewTemplates(TransformerFactoryImpl.java:795)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.n
ewTransformer(TransformerFactoryImpl.java:617)
at weblogic.xml.jaxp.WebLogicTransformerFactory.newTransformer(WebLogicT
ransformerFactory.java:233)
at weblogic.xml.jaxp.RegistryTransformerFactory.newTransformer(RegistryT
ransformerFactory.java:209)
at com.hundsun.fund.trust.common.utils.XslTransform2MSWord.transform(Xsl
Transform2MSWord.java:47)
at com.hundsun.fund.tcmp.pm.biz.impl.DisclosureInfoManagerImpl.createFil
eByTemplate(DisclosureInfoManagerImpl.java:279)
at com.hundsun.fund.tcmp.pm.biz.impl.DisclosureInfoManagerImpl.createRep
ortDoc(DisclosureInfoManagerImpl.java:246)
at com.hundsun.fund.tcmp.pm.biz.impl.DisclosureInfoManagerImpl.saveDiscl
osureContent(DisclosureInfoManagerImpl.java:128)
at com.hundsun.fund.tcmp.pm.biz.impl.DisclosureInfoManagerImpl.createDis
closureInfo(DisclosureInfoManagerImpl.java:87)
at sun.reflect.GeneratedMethodAccessor405.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invok
e(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy164.createDisclosureInfo(Unknown Source)
at com.hundsun.fund.tcmp.pm.service.impl.DisclosureInfoServiceImpl.creat
eDisclosureInfo(DisclosureInfoServiceImpl.java:58)
at componentMethod.tcmp.pm.infoDisplay.disclosureInfoComponentHSAdapter.
deal_createDisclosureInfo(disclosureInfoComponentHSAdapter.java:50)
at componentMethod.tcmp.pm.infoDisplay.disclosureInfoComponentHSAdapter.
execute(disclosureInfoComponentHSAdapter.java:153)
at com.hundsun.jres.impl.bizkernel.runtime.processor.AbstractProcessor.e
xcute(AbstractProcessor.java:62)
at com.hundsun.jres.impl.bizkernel.runtime.core.DefaultIKernelInfrastruc
ture.execute(DefaultIKernelInfrastructure.java:75)