I have been trying to run my project which is a web application that takes excel sheet as input and processes the data. Up until recently the execution was taking place smoothly but only today morning that i am getting the below error,do help
Exception in PoolingDAO ==> insertClass() :
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'item_codes' at row 1
at com.mysql.jdbc.PreparedStatement.executeInternal
at com.mysql.jdbc.PreparedStatement.executeUpdate
at com.mysql.jdbc.PreparedStatement.executeUpdate
at com.Fidoop.DAOFactory.PoolingDAO.insert_to_mbill(PoolingDAO.java:471)
at com.Fidoop.util.GetInvoiceRead.Itemlistread(GetInvoiceRead.java:63)
at com.action.user.UploadFileMaster.doPost(UploadFileMaster.java:291)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
at org.apache.catalina.core.ApplicationFilterChain.doFilter
at org.apache.catalina.core.StandardWrapperValve.invoke
at org.apache.catalina.core.StandardContextValve.invoke
at org.apache.catalina.authenticator.AuthenticatorBase.invoke
at org.apache.catalina.core.StandardHostValve.invoke
at org.apache.catalina.valves.ErrorReportValve.invoke
at org.apache.catalina.valves.AccessLogValve.invoke
at org.apache.catalina.core.StandardEngineValve.invoke
at org.apache.catalina.connector.CoyoteAdapter.service
at org.apache.coyote.http11.AbstractHttp11Processor.process
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at java.lang.Thread.run(Unknown Source)
NEW CONNECTION CREATED
Vector :[com.mysql.jdbc.JDBC4Connection#75c5a4]
Destroy Connection
Removing Duplicate words:
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'item_codes' at row 1
This error is coming from MySQL because whatever you're trying to persist is too large for the given field item_codes. You have several options to mitigate this
field length on that table *
adjust the character length in the spreadsheet
programatically trim the length of the input.
Related
I am trying to read an Access database using UCanAccess.
The code is working but is tremendously slow due to the database being large. As the database rarely changes, I am trying to use the keepMirror suggestion in
Slow initial connection to MS access database; .
connection = DriverManager.getConnection(UcanaccessDriver.URL_PREFIX + databaseFile + ";keepMirror=/some/dir/test/resources/db-mirror/mirror");
On the first run, the application works perfectly and creates the mirror files in the directory above. On subsequent runs, however, I get the following exception:
Exception in thread "main" java.lang.RuntimeException:
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.6 error in
script file line: 289
/some/dir/test/resources/db-mirror/mirror-783471167 a UNIQUE
constraint already exists on the set of columns in statement [CREATE
CACHED TABLE <TABLE DEF> ON DELETE CASCADE ON UPDATE CASCADE)] at
de.gdfsuezenergie.stromnev.enet.ENETConnector.init(ENETConnector.java:69)
at de.gdfsuezenergie.stromnev.Main.setUp(Main.java:374) at
de.gdfsuezenergie.stromnev.Main.main(Main.java:165) at
de.gdfsuezenergie.stromnev.MainTest.main(MainTest.java:9) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483) at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.6
error in script file line: 289
/some/dir/test/resources/db-mirror/mirror-783471167 a UNIQUE
constraint already exists on the set of columns in statement [CREATE
CACHED TABLE <TABLE DEF> ON DELETE CASCADE ON UPDATE CASCADE)] at
net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:264)
at java.sql.DriverManager.getConnection(DriverManager.java:664) at
java.sql.DriverManager.getConnection(DriverManager.java:270) at
de.gdfsuezenergie.stromnev.enet.ENETConnector.createConnection(ENETConnector.java:86)
at
de.gdfsuezenergie.stromnev.enet.ENETConnector.init(ENETConnector.java:57)
... 8 more Caused by: java.sql.SQLException: error in script file
line: 289 /some/dir/test/resources/db-mirror/mirror-783471167 a UNIQUE
constraint already exists on the set of columns in statement [CREATE
CACHED TABLE <TABLE DEF> ON DELETE CASCADE ON UPDATE CASCADE)] at
org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at
org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at
org.hsqldb.jdbc.JDBCConnection.(Unknown Source) at
org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at
org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) at
java.sql.DriverManager.getConnection(DriverManager.java:664) at
java.sql.DriverManager.getConnection(DriverManager.java:247) at
net.ucanaccess.jdbc.DBReference.getHSQLDBConnection(DBReference.java:440)
at
net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:231)
... 12 more Caused by: org.hsqldb.HsqlException: error in script file
line: 289 /some/dir/test/resources/db-mirror/mirror-783471167 a UNIQUE
constraint already exists on the set of columns in statement [CREATE
CACHED TABLE <TABLE DEF> ON DELETE CASCADE ON UPDATE CASCADE)] at
org.hsqldb.error.Error.error(Unknown Source) at
org.hsqldb.scriptio.ScriptReaderText.readDDL(Unknown Source) at
org.hsqldb.scriptio.ScriptReaderBase.readAll(Unknown Source) at
org.hsqldb.persist.Log.processScript(Unknown Source) at
org.hsqldb.persist.Log.open(Unknown Source) at
org.hsqldb.persist.Logger.open(Unknown Source) at
org.hsqldb.Database.reopen(Unknown Source) at
org.hsqldb.Database.open(Unknown Source) at
org.hsqldb.DatabaseManager.getDatabase(Unknown Source) at
org.hsqldb.DatabaseManager.newSession(Unknown Source) ... 19 more
Caused by: org.hsqldb.HsqlException: a UNIQUE constraint already
exists on the set of columns at org.hsqldb.error.Error.error(Unknown
Source) at org.hsqldb.error.Error.error(Unknown Source) at
org.hsqldb.ParserTable.addTableConstraintDefinitions(Unknown Source)
at org.hsqldb.StatementSchema.getResult(Unknown Source) at
org.hsqldb.StatementSchema.execute(Unknown Source) at
org.hsqldb.Session.executeCompiledStatement(Unknown Source) ... 28
more
I understand that this is therefore violating some constraint on this cached table, what I don't understand is why it is running this script. I thought the whole point of creating the mirror was that I wouldn't need to reapply any scripts?
Does someone know how to read the mirror properly?
Note: <TABLE DEF> => I haves skipped the table definition for brevity.
This issue is known to occur when a table in the Access database has more than one unique index defined for a given column, e.g., a Primary Key index (Primary=Yes, Unique=Yes) and another separate Unique index (Primary=No, Unique=Yes).
Access itself does not have any problem with this, but HSQLDB (which UCanAccess uses for its backing database) does not permit more than one unique constraint on a set of columns.
The best solution is to open the .accdb or .mdb database in Access and remove the redundant non-Primary unique index.
I managed to get it to work but it's a bit hacky. Basically by removing the Unique Constraints from the mirror script it finally managed to get through. Sadly I don't have knowledge of the data, so need to work out if its still correct, but I believe it is.
Thanks for the pointers everyone! Very much appreciated.
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.
I'm making a inserting program for database ..
I've simply a textbox to insert an article into my webpage.
When i insert this article:
But while the results are pretty exciting, it's important to note that
this is still a small-scale study and further research is needed to
confirm the link between SERT and SAD, as well as the role that
sunlight plays on serotonin.
The next step will be to find out more about why some people increase
SERT production as the days get shorter, and why some people are
unaffected. It’s estimated SAD affects more than 12 million people
across northern Europe.
Sam Challis, an information manager at British mental health charity
Mind, told the BBC: "We don't yet know enough about how serotonin
levels can be affected by light levels so this is quite an
interesting, albeit small, study. We would welcome more research."
after updating that article into database ..it's throwing an error as:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's important to note
that this is still a small-scale study and further researc' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2819)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1811)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1725)
at org.apache.jsp.controller.rajendra.arora.successfully_jsp._jspService(successfully_jsp.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:107)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:76)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:934)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:90)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:515)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1012)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:642)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1555)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I've this code to insert into database:
String content=request.getParameter("content");
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/news", "root", "1234");
Statement st=con.createStatement();
int i=st.executeUpdate("insert into main_news(my_news) values('"+content+"')");
}
catch(Exception e){
e.printStackTrace();
}
Surely, Help would be appreciated!
As DaniEll said, that is because your string contains single quotes ('). To prevent this problem you can use PreparedStatement:
PreparedStatement ps = con.prepareStatement
("insert into main_news(my_news) values(?)");
ps.setString(1,content);
ps.executeUpdate();
I'm trying to store the following tweet into MySQL database and it fails with the following exception. How do I fix it? Any help is appreciated. I am using utf8 charset database and I am thinking that !??? in the message is being problematic here.
tweet=I'm forbidden by a ride # USS due to my height, I'm suppose to sit in the mid, incase there's an accident, but I still love my height!???
Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\x8D\xF0\x9F...' for column 'message' at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
In your driver url path use the following parameters
jdbc:mysql://<host>:<port>/<db>?useUnicode=true&characterEncoding=UTF-8
I want to get the osm data and put it in a mysql database but the error indicated below is raised by osmosis.
I need the data of an osm file to convert int to matrix then put a depot area and treat user's selected nodes as nodes like graph and i will get the fastest o efficient path to route a vehicle with capacity to get some things in the nodes and if the vehicle is full then it will return to the starting area and unload it's current loads then go back to the remaining nodes to get their loads.
20-Nov-2011 15:42:45 org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskMa
nager waitForCompletion
SEVERE: Thread for task 2-buffer failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to bulk insert re
lation members into the database.
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.flushRelationMembers
(ApidbWriter.java:895)
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.addRelationMembers(A
pidbWriter.java:1229)
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.flushRelations(Apidb
Writer.java:829)
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.complete(ApidbWriter
.java:1044)
at org.openstreetmap.osmosis.core.buffer.v0_6.EntityBuffer.run(EntityBuf
fer.java:77)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Incorrect integer value: 'Way' for column 'mem
ber_type' at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:2077)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:2362)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:2280)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:2265)
at org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.flushRelationMembers
(ApidbWriter.java:893)
... 5 more
20-Nov-2011 15:42:45 org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed
.
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForComple
tion(Pipeline.java:146)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Laun
cher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:31)
C:\Users\home\Desktop>
Well, the stacktrace is quite obvious:
Caused by: java.sql.SQLException: Incorrect integer value:
'Way' for column 'member_type' at row 1
You are trying to pass a string "Way" to the integer-column "member_type".