jasperreports icon indicating copy to clipboard operation
jasperreports copied to clipboard

JRXmlUtils.createDocumentBuilder jvm overload problem

Open mesutusenmez opened this issue 5 years ago • 1 comments

Hello,

We use jasperreports-3.7.4.jar. Our code is as follows:

xmlDataSource = new JRXmlDataSource(dataInputStream, selectExpression);

'dataInputStream' is value that converted to byte from a xml. This xml and 'selectExpression' can be different each time. Sometimes this method is extremely called on our application.

On JRXmlUtils.createDocumentBuilder method, Why is DocumentBuilder object created every call? Class loading each time and causing jvm overload. Then jvm becomes unusable. Why is sinleton pattern not used on JRXmlUtils.createDocumentBuilder method?

Dump:

at java/lang/ClassLoader.loadClass(ClassLoader.java:852(Compiled Code)) at org/apache/xerces/parsers/ObjectFactory.findProviderClass(Bytecode PC:55(Compiled Code)) at org/apache/xerces/parsers/ObjectFactory.newInstance(Bytecode PC:3(Compiled Code)) at org/apache/xerces/parsers/ObjectFactory.createObject(Bytecode PC:529(Compiled Code)) at org/apache/xerces/parsers/ObjectFactory.createObject(Bytecode PC:3(Compiled Code)) at org/apache/xerces/parsers/DOMParser.(Bytecode PC:5(Compiled Code)) at org/apache/xerces/parsers/DOMParser.(Bytecode PC:3(Compiled Code)) at org/apache/xerces/jaxp/DocumentBuilderImpl.(Bytecode PC:14(Compiled Code)) at org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.newDocumentBuilder(Bytecode PC:101(Compiled Code)) at net/sf/jasperreports/engine/util/JRXmlUtils.createDocumentBuilder(JRXmlUtils.java:219(Compiled Code)) at net/sf/jasperreports/engine/util/JRXmlUtils.parse(JRXmlUtils.java:72(Compiled Code)) at net/sf/jasperreports/engine/data/JRXmlDataSource.(JRXmlDataSource.java:251(Compiled Code)) at net/sf/jasperreports/engine/data/JRXmlDataSource.(JRXmlDataSource.java:267(Compiled Code)) at net/sf/jasperreports/engine/data/JRXmlDataSource.(JRXmlDataSource.java:262(Compiled Code)) at com/project/technical/ea/itmgmt/itinfst/template/printing/core/v2/spring/impl/TemplatePrintingImpl.producePrintingOutput(TemplatePrintingImpl.java:197(Compiled Code)) at com/project/technical/ea/itmgmt/itinfst/template/printing/core/v2/spring/impl/TemplatePrintingImpl.createDocumentFromTemplate(TemplatePrintingImpl.java:169(Compiled Code)) at sun/reflect/GeneratedMethodAccessor364.invoke(Bytecode PC:82(Compiled Code)) at sun/reflect/DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55(Compiled Code)) at java/lang/reflect/Method.invoke(Method.java:508(Compiled Code)) at org/springframework/aop/support/AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317(Compiled Code)) at org/springframework/aop/framework/ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183(Compiled Code)) at org/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150(Compiled Code)) at org/springframework/transaction/interceptor/TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96(Compiled Code)) at org/springframework/transaction/interceptor/TransactionAspectSupport$1.doInTransaction(TransactionAspectSupport.java:282(Compiled Code)) at org/springframework/transaction/jta/WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:343(Compiled Code)) at com/ibm/ws/uow/embeddable/EmbeddableUOWManagerImpl.runUnderCurrentUOW(EmbeddableUOWManagerImpl.java:994(Compiled Code)) at com/ibm/ws/uow/embeddable/EmbeddableUOWManagerImpl.runUnderUOW(EmbeddableUOWManagerImpl.java:381(Compiled Code)) at org/springframework/transaction/jta/WebSphereUowTransactionManager.__AW_execute(WebSphereUowTransactionManager.java:287(Compiled Code)) at org/springframework/transaction/jta/WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java(Compiled Code)) at org/springframework/transaction/interceptor/TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277(Compiled Code)) at org/springframework/transaction/interceptor/TransactionInterceptor.invoke(TransactionInterceptor.java:94(Compiled Code)) at org/springframework/aop/framework/ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172(Compiled Code)) at org/springframework/aop/framework/JdkDynamicAopProxy.__AW_invoke(JdkDynamicAopProxy.java:204(Compiled Code)) at org/springframework/aop/framework/JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java(Compiled Code)) at com/sun/proxy/$Proxy168.createDocumentFromTemplate(Bytecode PC:42(Compiled Code))

mesutusenmez avatar Nov 03 '20 15:11 mesutusenmez

You are using a very old version of JasperReports Library. Even if we do something about it, you would need to ugprade to latest, because we do not fix old versions. Have you tried made this change on your own modifying 3.7.4 source code to see if it works any better?

Thank you, Teodor

teodord avatar May 05 '21 16:05 teodord

Feel free to reopen this if you see this problem when using a more recent version of our library.

Thank you, Teodor

teodord avatar Jul 21 '23 08:07 teodord