1
I need help trying to clear up these 2 mistakes:
Exception in thread "Thread-4" java.lang.OutOfMemoryError: Java heap space
at java.util.zip.InflaterInputStream.<init>(InflaterInputStream.java:88)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.<init>(ZipFile.java:394)
at java.util.zip.ZipFile.getInputStream(ZipFile.java:375)
at java.util.jar.JarFile.getInputStream(JarFile.java:447)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:162)
at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:238)
at org.hibernate.internal.util.xml.DTDEntityResolver.resolveInHibernateNamespace(DTDEntityResolver.java:116)
at org.hibernate.internal.util.xml.DTDEntityResolver.resolveOnClassPath(DTDEntityResolver.java:99)
at org.hibernate.internal.util.xml.DTDEntityResolver.resolveEntity(DTDEntityResolver.java:71)
at org.hibernate.cfg.EJB3DTDEntityResolver.resolveEntity(EJB3DTDEntityResolver.java:59)
at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:110)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:988)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1154)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:78)
at org.hibernate.cfg.Configuration.add(Configuration.java:488)
at org.hibernate.cfg.Configuration.add(Configuration.java:484)
at org.hibernate.cfg.Configuration.add(Configuration.java:657)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:740)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2188)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2160)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2140)
BUILD STOPPED (total time: 48 minutes 37 seconds)
And this:
Exception in thread "Thread-4" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3326)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:421)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at org.hibernate.sql.SelectFragment.toFragmentString(SelectFragment.java:151)
at org.hibernate.persister.entity.AbstractEntityPersister.propertySelectFragment(AbstractEntityPersister.java:1458)
at org.hibernate.persister.entity.AbstractEntityPersister.selectFragment(AbstractEntityPersister.java:1423)
at org.hibernate.loader.AbstractEntityJoinWalker.initStatementString(AbstractEntityJoinWalker.java:123)
at org.hibernate.loader.AbstractEntityJoinWalker.initStatementString(AbstractEntityJoinWalker.java:108)
at org.hibernate.loader.AbstractEntityJoinWalker.initAll(AbstractEntityJoinWalker.java:90)
at org.hibernate.loader.AbstractEntityJoinWalker.initAll(AbstractEntityJoinWalker.java:77)
at org.hibernate.loader.entity.CascadeEntityJoinWalker.<init>(CascadeEntityJoinWalker.java:51)
at org.hibernate.loader.entity.CascadeEntityLoader.<init>(CascadeEntityLoader.java:46)
at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3891)
at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:3828)
at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:1018)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:462)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1861)
at DAO.GenericDao.getSession(GenericDao.java:28)
at DAO.ProdutoDao.findProdutoByNumero(ProdutoDao.java:39)
at Service.ProdutoController.findProdutoByNumero(ProdutoController.java:37)
at Service.ServidorService.getValoresAndon(ServidorService.java:718)
at Service.ServidorService$1.run(ServidorService.java:141)
set 10, 2014 11:44:23 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH000030: Cleaning up connection pool [jdbc:mysql://localhost:3306/mydb?zeroDateTimeBehavior=convertToNull]
BUILD STOPPED (total time: 37 minutes 0 seconds)
These errors appeared after starting to use the hibernate
and I would like to understand if it is possible to know which the objecto
What’s filling up the memory?
Everything I’m doing with the hibernate
works well but passing a few minutes bursts.
I have no experience using the hibernate
As for the matter of increasing memory I have already done(-Xmx128m and more amount up and not solved)
EDIT
private void threadControllerRun() {
new Thread() {
@Override
public void run() {
while (true) {
try {
getValoresAndon();
TimeUnit.MINUTES.sleep(5);
} catch (InterruptedException ex) {
Logger.getLogger(ServidorService.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}.start();
}
This is where I call the function I think gives the error (it’s the "main" function) but I think there’s no way to see the error
I’ve been looking at the code I have from my DAO and I don’t know why but I think this implementation is not correct, this because whenever I do something the BD creates a new session, am I right or wrong? This could be what blows my memory away?
public Session getSession() {
Configuration cfg= new Configuration().configure();
SessionFactory sessionfactory=cfg.buildSessionFactory();
session=sessionfactory.openSession();
return this.session;
}
Click [Edit] and add the code of the run() method of your Servorservice class. I believe this will help us to help you.
– Math
Already added, the run method that calls the function where I think gives the error, I do not know if it was this method, because I have several.
– jsantos1991
To better explain this program is a server that when it starts creates a thread to manage sockets (clients that will stay connected to it to receive information) and then has another that processes all this information to send to them and that’s where I have the problem
– jsantos1991
I don’t know if you’re familiar with Ibernate but what I’m talking about above doesn’t make any sense?
– jsantos1991