I would avoid an Out of Memory exception in my JasperReport Server.
please, help me.
EDIT 29/08/2015
I'm using JasperReport server 6.1 on Ubuntu 14.04, java 8
Same result --- DETAILS BELOW
I wrote a java code to download (store in local files) multiple pdf reports from my instance of JasperReport Server.
It works well for about 600 reports, after that it produce an error 500.
In the JasperServer log file I see an Out of memory exception.
maybe there is an error in my code? don't think so.
Instead I think there is a memory leak in the jasperReport server.
here you can see my java code (class ga.system.jasperserver.ReportExtractor)
for (ReportParameters aReportParams : listOfReportParameters)
{
String filename = "report-"+aReportParams.getParameter1()+ ".PDF";
jasperreport_url = combineParamsIntoJasperserverUrl(aReportParams);
URL website = new URL(jasperreport_url);
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destPath+"/" +filename);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
here you can see a snippet of the exception I get
java.io.IOException: Server returned HTTP response code: 500 for URL: http://myjasperserverurl/jasperserver/rest_v2/reports/TestDir/TestReport.pdf?j_username=xxx&j_password=xxx&PARAMETER1=9734&PARAMETER2=0&PARAMETER3=815G21
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at ga.system.jasperserver.ReportExtractor.extract(ReportExtractor.java:102)
...
...
...
Here you can see the log in JasperReport Server (catalina.out snippet)
2015-08-17 18:16:17,091 ERROR RunReportServiceImpl,pool-5-thread-66:511 - caught Throwable exception: Java heap space
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2271)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at com.lowagie.text.pdf.OutputStreamCounter.flush(Unknown Source)
at com.lowagie.text.DocWriter.close(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.close(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
at com.lowagie.text.Document.close(Unknown Source)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:815)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:513)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.exportToPdf(EngineServiceImpl.java:559)
at com.jaspersoft.jasperserver.remote.exporters.PdfExporter.exportReport(PdfExporter.java:98)
at com.jaspersoft.jasperserver.remote.services.impl.ReportExecutorImpl.exportReport(ReportExecutorImpl.java:177)
at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.generateReportOutput(RunReportServiceImpl.java:478)
at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl.executeExport(RunReportServiceImpl.java:378)
at com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl$2.run(RunReportServiceImpl.java:343)
at com.jaspersoft.jasperserver.api.logging.util.LoggableExecutorService$1.run(LoggableExecutorService.java:59)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Virtualizer used in my server (applicationContext.xml snippet)
<bean id="fileVirtualizerFactory" class="com.jaspersoft.jasperserver.api.engine.common.service.impl.FileVirtualizerFactory">
<property name="maxSize" value="3000"></property>
<property name="directory" value="${java.io.tmpdir}"></property>
</bean>
I'm using JasperReport server 5.6.0 on Ubuntu 14.04 (trusty), java 8
EDIT 29/08/2015
new test using JasperReport server 6.1 on Ubuntu 14.04, java 8
Same result, freshly installed server, after 580 pdf produced the server hangs showing this message (read last line: "Caused by: java.lang.OutOfMemoryError: Java heap space"):
org.hibernate.exception.GenericJDBCException: could not initialize
lazy properties:
[com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.RepoFileResource#8448]
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at
org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyPropertiesFromDatastore(AbstractEntityPersister.java:831)
at
org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyProperty(AbstractEntityPersister.java:771)
at
org.hibernate.intercept.AbstractFieldInterceptor.intercept(AbstractFieldInterceptor.java:97)
at
org.hibernate.intercept.cglib.FieldInterceptorImpl.readObject(FieldInterceptorImpl.java:98)
at
com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.RepoFileResource.$cglib_read_data(Unknown
Source) at
com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.RepoFileResource.getData(Unknown
Source) at
com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.RepoFileResource.copyData(Unknown
Source) at
com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl$22.execute(HibernateRepositoryServiceImpl.java:1420)
at
com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl.executeCallback(HibernateDaoImpl.java:56)
at
com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl.getResourceData(HibernateRepositoryServiceImpl.java:1414)
at sun.reflect.GeneratedMethodAccessor337.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy32.getResourceData(Unknown Source) at
sun.reflect.GeneratedMethodAccessor337.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at
com.jaspersoft.jasperserver.api.metadata.user.service.impl.PermissionsPrefetcher.invoke(PermissionsPrefetcher.java:79)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at
com.jaspersoft.jasperserver.api.metadata.user.service.impl.PermissionsPrefetcher.invoke(PermissionsPrefetcher.java:79)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at
org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at
org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy38.getResourceData(Unknown Source) at
com.jaspersoft.jasperserver.api.engine.jasperreports.util.repo.RepositoryConnection.getInputStream(RepositoryConnection.java:114)
at java.net.URL.openStream(URL.java:1037) at
net.sf.jasperreports.engine.util.JRLoader.getInputStream(JRLoader.java:298)
at
net.sf.jasperreports.repo.DefaultRepositoryService.getInputStream(DefaultRepositoryService.java:100)
at
net.sf.jasperreports.repo.InputStreamPersistenceService.load(InputStreamPersistenceService.java:48)
at
net.sf.jasperreports.repo.DefaultRepositoryService.getResource(DefaultRepositoryService.java:155)
at
net.sf.jasperreports.repo.RepositoryUtil.findInputStream(RepositoryUtil.java:176)
at
net.sf.jasperreports.repo.RepositoryUtil.getBytesFromLocation(RepositoryUtil.java:192)
at
net.sf.jasperreports.engine.RenderableUtil.getRenderable(RenderableUtil.java:121)
at
net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:536)
at
net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:472)
at
net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
at
net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)
at
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBackground(JRVerticalFiller.java:1846)
at
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288)
at
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152)
at
net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)
at
net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$SynchronousExecutor.execute(EngineServiceImpl.java:886)
at
net.sf.jasperreports.engine.fill.BaseFillHandle.startFill(BaseFillHandle.java:165)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1804)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$SynchronousReportFiller.fillReport(EngineServiceImpl.java:790)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1731)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runWithDataSource(EngineServiceImpl.java:1086)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runReport(EngineServiceImpl.java:1015)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportRunnable.run(EngineServiceImpl.java:908)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$SynchronousExecutor.execute(EngineServiceImpl.java:886)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:607)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.executeReportUnitRequest(EngineServiceImpl.java:1937)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.domain.impl.ReportUnitRequest.execute(ReportUnitRequest.java:67)
at
com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.execute(EngineServiceImpl.java:497)
at
com.jaspersoft.jasperserver.remote.services.impl.ReportExecutorImpl$GenericRunReportStrategy.runReport(ReportExecutorImpl.java:225)
at
com.jaspersoft.jasperserver.remote.services.impl.ReportExecutorImpl.runReport(ReportExecutorImpl.java:127)
at
com.jaspersoft.jasperserver.remote.services.impl.RunReportServiceImpl$1.run(RunReportServiceImpl.java:230)
at
com.jaspersoft.jasperserver.api.logging.util.LoggableExecutorService$1.run(LoggableExecutorService.java:59)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724) Caused by:
org.postgresql.util.PSQLException: Fine memoria scaricando i risultati
della query. at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1816)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:510)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271) at
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at
org.hibernate.persister.entity.AbstractEntityPersister.initializeLazyPropertiesFromDatastore(AbstractEntityPersister.java:802)
... 73 more
Caused by: java.lang.OutOfMemoryError: Java heap space
feel free to ask for details you need!
Please help
Thanks
Memory management is a common problem with Jasper. You want to use a Jasper Virtualizer to cut down on the heap load.
I am having the exact same problem. Lots of fast running, small reports eventually wipe out memory. Eclipse MAT says that shortest path to GC Root is:
Ultimately this turned out to be a corrupt .jasper file. Regenerating the jasper file for the main report and all subreports fixed the issue for me.
Related
I have run into an issue developing a HTTP client with the use of BouncyCastle libraries.
Target versions (but the error is also reproducible in Java 1.8.0_91 with the same version of BouncyCastle.)
JRE 1.6.0_45-b06
BouncyCastle jdk15to18 167 (bcprov-jdk15to18-167.jar, bcpkix-jdk15to18-167.jar, bctls-jdk15to18-167.jar)
HTTPClient code:
String strURL = "https://www.<WEBSITE>.com";
// CODE to set default TrustStore, KeyStore to be used
// setup BC as SecurityProvider and SSLSocketFactoryProvider
/*
Security.insertProviderAt(new BouncyCastleProvider(), 1);
Security.insertProviderAt(new BouncyCastleJsseProvider(), 2);
Security.setProperty("ssl.KeyManagerFactory.algorithm", "PKIX");
Security.setProperty("ssl.TrustManagerFactory.algorithm", "PKIX");
Security.setProperty("ssl.SocketFactory.provider", "org.bouncycastle.jsse.provider.SSLSocketFactoryImpl");
System.setProperty("jdk.tls.trustNameService", "true");
*/
URL url = new URL( strURL );
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("GET");
InputStream is = null;
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
System.out.println("OK");
is = conn.getInputStream();
} else if (conn.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) {
System.out.println("ERROR");
is = conn.getErrorStream();
} else {
System.out.println( conn.getResponseCode() );
System.out.println( conn.getResponseMessage() );
}
if (is != null) {
System.out.println( readFullyAsString(is, "UTF-8") );
}
conn.disconnect();
Accessing data on a website with TLS 1.2 without client_auth works fine (there are some issues with specific sites that return handshake_failure(40), but luckily not in our case). But when client_auth is required the code fails with the following (a little cryptic) error:
nov. 27, 2020 5:23:10 PM org.bouncycastle.jsse.provider.ProvTlsClient notifyAlertRaised
WARNING: Client raised fatal(2) internal_error(80) alert: Failed to read record
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.bouncycastle.tls.RecordStream$Record.fillTo(RecordStream.java:429)
at org.bouncycastle.tls.RecordStream$Record.readHeader(RecordStream.java:468)
at org.bouncycastle.tls.RecordStream.readRecord(RecordStream.java:201)
at org.bouncycastle.tls.TlsProtocol.safeReadRecord(TlsProtocol.java:768)
at org.bouncycastle.tls.TlsProtocol.readApplicationData(TlsProtocol.java:731)
at org.bouncycastle.jsse.provider.ProvSSLSocketDirect$AppDataInput.read(ProvSSLSocketDirect.java:603)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at HttpsClient.main(HttpsClient.java:109)
nov. 27, 2020 5:23:10 PM org.bouncycastle.jsse.provider.ProvTlsClient notifyAlertRaised
WARNING: Client raised fatal(2) internal_error(80) alert: Failed to read record
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.bouncycastle.tls.RecordStream$Record.fillTo(RecordStream.java:429)
at org.bouncycastle.tls.RecordStream$Record.readHeader(RecordStream.java:468)
at org.bouncycastle.tls.RecordStream.readRecord(RecordStream.java:201)
at org.bouncycastle.tls.TlsProtocol.safeReadRecord(TlsProtocol.java:768)
at org.bouncycastle.tls.TlsProtocol.readApplicationData(TlsProtocol.java:731)
at org.bouncycastle.jsse.provider.ProvSSLSocketDirect$AppDataInput.read(ProvSSLSocketDirect.java:603)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at HttpsClient.main(HttpsClient.java:109)
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.bouncycastle.tls.RecordStream$Record.fillTo(RecordStream.java:429)
at org.bouncycastle.tls.RecordStream$Record.readHeader(RecordStream.java:468)
at org.bouncycastle.tls.RecordStream.readRecord(RecordStream.java:201)
at org.bouncycastle.tls.TlsProtocol.safeReadRecord(TlsProtocol.java:768)
at org.bouncycastle.tls.TlsProtocol.readApplicationData(TlsProtocol.java:731)
at org.bouncycastle.jsse.provider.ProvSSLSocketDirect$AppDataInput.read(ProvSSLSocketDirect.java:603)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at HttpsClient.main(HttpsClient.java:109)
As expected the code runs just fine in Java 1.8 without BC as Security Provider ... but in Java 1.6 BC is needed for TLS 1.2 support.
I looked at the packets with Wireshark, but I don't have enough knowledge to analyze what's happening (failing) with the SSL handshake operation with the server.
What am I missing here? Or it's just a known limitation of BC?
Thanks for any suggestions.
After extensive research and testing (we set up our own dev environment that replicated the endpoint, we were trying to connect to with client cert) we have found a solution (posted below) that works for us in our dev environment, but couldn't be configured on the endpoint. That's why we went to plan B - TLS termination proxy and it worked like a charm in our case, when we didn't have control of the server environment.
Solution for IIS
In our case the web service requiring client auth was running on Microsoft IIS. As stated "Unfortunately our TLS libraries do not support renegotiation (and we do not plan to add it, although there are corresponding TLS 1.3 features that we will)." in this open issue (https://github.com/bcgit/bc-java/issues/593). After reading the IIS documentation and some testing we successfully configured the environment in a way that TLS sessions could be established with BC TLS lib:
Step 1:
Create an IIS site with default settings
Run IISCrypto with the "Best practices" template:
Step 2:
Enable SSLAlwaysNegoClientCert
Save the following text to a file called "Enable_SSL_Renegotiate.js"
var vdirObj=GetObject("IIS://localhost/W3svc/1");
// replace 1 on this line with the number of the web site you wish to configure
WScript.Echo("Value of SSLAlwaysNegoClientCert Before: " + vdirObj.SSLAlwaysNegoClientCert);
vdirObj.Put("SSLAlwaysNegoClientCert", true);
vdirObj.SetInfo();
WScript.Echo("Value of SSLAlwaysNegoClientCert After: " + vdirObj.SSLAlwaysNegoClientCert);
Run the following command from an elevated / administrator command prompt:
cscript.exe enable_ssl_renegotiate.js
I posted the same answer on BouncyCastle Github - #847
I'm using RestAssured.get(url).statusCode() to see if a url is working and respond successfully(Code 200) or not. In case of some urls(like url1) it properly works but for some urls(such as url2) it will cause the following error:
String url1="http://www.bbsys.com/playersdemo.exe"
String url2="http://www.ezhomeinspectionsoftware.com/filestorage/EZ-Setup.exe"
both of these urls result in downloading files. But the second one downloads a bigger file. So, probably that's why it cause out of memory exception. I need to know how can I handle cases like this. I need to get response from a large number of different urls. Do you recommend using another library or I'm using this library in a wrong way?
java.lang.OutOfMemoryError: Java heap space
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3236)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
at io.restassured.internal.util.IOUtils.toByteArray(IOUtils.java:31)
at io.restassured.internal.http.GZIPEncoding$GZIPDecompressingEntity.getContent(GZIPEncoding.java:69)
at org.apache.http.conn.BasicManagedEntity.getContent(BasicManagedEntity.java:85)
at io.restassured.internal.http.HTTPBuilder.parseResponse(HTTPBuilder.java:545)
at io.restassured.internal.RequestSpecificationImpl$RestAssuredHttpBuilder.super$2$parseResponse(RequestSpecificationImpl.groovy)
at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at io.restassured.internal.RequestSpecificationImpl$RestAssuredHttpBuilder.parseResponse(RequestSpecificationImpl.groovy:2137)
at sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at io.restassured.internal.RequestSpecificationImpl$RestAssuredHttpBuilder.doRequest(RequestSpecificationImpl.groovy:2073)
at io.restassured.internal.http.HTTPBuilder.doRequest(HTTPBuilder.java:494)
at io.restassured.internal.http.HTTPBuilder.request(HTTPBuilder.java:451)
at io.restassured.internal.http.HTTPBuilder$request$2.call(Unknown Source)
at io.restassured.internal.RequestSpecificationImpl.sendHttpRequest(RequestSpecificationImpl.groovy:1450)
at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
Do you actually want to download the files or do you only want to check if the url is alive?
If not take, a look at the head method (https://static.javadoc.io/io.rest-assured/rest-assured/3.0.7/io/restassured/RestAssured.html#head-java.lang.String-java.util.Map-), to send a head request without triggering the download.
Otherwise your only option is to provide sufficient memory, as #Roberto suggested.
I am building a project which uses Gora-hbase as backend .
Hbase is up and running . I am not using maven or ivy .
Also i have specified the following in /conf/gora.properties :
gora.datastore.default=org.apache.gora.hbase.store.HBaseStore
gora.datastore.autocreateschema=true
In my code, i am using the following piece of code to start a datastore :
datastore =
DataStoreFactory.getDataStore(long.class,UserDetails.class,new
Configuration());
I am getting the following exception at the above line :
13/02/04 23:02:26 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x13ca8d9ecac000c, negotiated timeout = 40000
org.apache.gora.util.GoraException: java.lang.RuntimeException: java.net.MalformedURLException
at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:167)
at org.apache.gora.store.DataStoreFactory.getDataStore(DataStoreFactory.java:278)
at com.psl.gora.java.model.TestClass.init(TestClass.java:34)
at com.psl.gora.java.model.TestClass.<init>(TestClass.java:23)
at com.psl.gora.java.model.TestClass.main(TestClass.java:47)
Caused by: java.lang.RuntimeException: java.net.MalformedURLException
at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:125)
at org.apache.gora.store.DataStoreFactory.initializeDataStore(DataStoreFactory.java:102)
at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:161)
... 4 more
Caused by: java.net.MalformedURLException
at java.net.URL.<init>(URL.java:617)
at java.net.URL.<init>(URL.java:480)
at java.net.URL.<init>(URL.java:429)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
at org.apache.gora.hbase.store.HBaseStore.readMapping(HBaseStore.java:524)
at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:111)
... 6 more
Caused by: java.lang.NullPointerException
at java.net.URL.<init>(URL.java:522)
... 19 more
Is there anything I am missing or am not aware of?
Any help or suggestion appreciated.
When this stacktrace is shown, probably is because gora-hbase-mapping.xml is missing.
This question is from months ago, but if other person has the same problem, maybe this would help.
From HBaseStore:524 is being called builder.build(null) and results are like in http://www.eclipse.org/forums/index.php/t/262714/
---- Other possibility ----
Try as key class String.class and check if it works. (Just checking...)
When web service is called by using SOAP request it will give following parse error.
I have check about the prolog of request its right there is no whitespace or dash. Even though it will cause following error
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispat
ch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour
ce)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
at requestModel.SimpleCheckMail.checkMail(SimpleCheckMail.java:162)
at model.InboxDataBean.prepareList(InboxDataBean.java:97)
at model.InboxDataBean.getemailList(InboxDataBean.java:207)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:87)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELR
esolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELRe
solver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:1
89)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpress
ion.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.
java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.
java:182)
at javax.faces.component.UIData.getValue(UIData.java:731)
at javax.faces.component.UIData.getDataModel(UIData.java:1798)
at javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIDa
ta.java:484)
at javax.faces.component.UIData.setRowIndex(UIData.java:473)
at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRen
derer.java:81)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.jav
a:820)
at javax.faces.component.UIData.encodeBegin(UIData.java:1118)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1754)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.
java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView
(FaceletViewHandlingStrategy.java:401)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewH
andler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePha
se.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoin
t.java:1805)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:907)
at java.lang.Thread.run(Thread.java:619)
Please let me know whats the problem......of this error....thanx in advance
Ya....all of you are right ....But what i am getting is that it is an SOAP request and i have already see the request carefully there is no bad character.....But the problem is that when i am invoking the web service through soap request it gives null as a respone so i am getting the error.....
As soon as Webservice work properly ......this works fine now....thanks all of you
It means that there is something in xml before <?xml ... look carefully in it. Also check that there is no invisible character (you can do it in any HEX editor). Sometimes windows notepad adds his marker in the file beginning.
The parser sees character data before the actual XML itself is started. Either make sure your XML does not contain any stuff before the XML starts, or let your SAX parser ignore this...
Try to display the data you're actually parsing. Maybe some bad characters are inserted before the beginning of your xml, or maybe you're not reading the right file.
This may be a because of a BOM, if your XML file is stored as UTF-8 (which it probably is).
Here, you have an example of an InputStream, that gets rid of the BOM.
I'm using play framework for my application
In my application.conf i have given
jvm.memory=-Xmx512M -Xms512M -XX:-UseGCOverheadLimit
I have a function which will be executed for every Customer and for customers each microapp
This function will return records for that customer and for that microapp from DB.
if i run for all customer I'm getting InvocationTargetException for 16th customer.(For 15 customers it ran successfully).
The error is
12:38:30,153 ERROR ~
Execution exception
InvocationTargetException occured : null
play.exceptions.JavaExecutionException
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:230)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.reflect.InvocationTargetException
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:543)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:499)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:475)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:470)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:158)
... 1 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.StringValue.from(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at com.mysql.jdbc.SingleByteCharsetConverter.toString(SingleByteCharsetConverter.java:327)
at com.mysql.jdbc.ResultSetRow.getString(ResultSetRow.java:787)
at com.mysql.jdbc.BufferRow.getString(BufferRow.java:539)
at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5571)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5448)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5488)
at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:229)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:330)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
at org.hibernate.loader.Loader.getRow(Loader.java:1355)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
at org.hibernate.loader.Loader.doQuery(Loader.java:829)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
I found there is something error with that customer . so i run for that customer alone. I'm getting
Exception in thread "Timer-0" java.lang.OutOfMemoryError: Java heap space
at java.util.jar.Manifest.read(Unknown Source)
at java.util.jar.Manifest.<init>(Unknown Source)
at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
at java.util.jar.JarFile.getManifest(Unknown Source)
at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run(ThreadPoolAsynchronousRunner.java:633)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Exception in thread "pool-2-thread-1" java.lang.OutOfMemoryError: Java heap space
For this microapp( Error occuring ) alone i have 421,251 records
What could be the source of error. Please help me.
Your problem is an OutOfMemory error. It happens later when you increase the ram for that reason.
You did not provide any code sample, but I assume you are trying to load into memory too much data from your clients with only one query. That comment about having 421k records kind of confirms this (unless I misunderstood).
Instead of doing a find() (or select, or the cal you are doing) to retrieve all the records, try to retrieve records in batches (100, 200) and process them that way.