*
The moose likes JBoss/WildFly and the fly likes Getting java.lang.outofmemoryexception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Getting java.lang.outofmemoryexception" Watch "Getting java.lang.outofmemoryexception" New topic
Author

Getting java.lang.outofmemoryexception

kunal green
Greenhorn

Joined: Dec 31, 2009
Posts: 26

hi my environment is

jboss,myeclipse,oracle 10 g xe,spring 2.5 junit 4.0

while running a junit testcase i am getting the following exception:

java.lang.OutOfMemoryError: Java heap space
at org.eclipse.persistence.internal.libraries.antlr.runtime.DFA.unpackEncodedString(Unknown Source)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLLexer.<clinit>(JPQLLexer.java:3827)
at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParserBuilder.buildParser(JPQLParserBuilder.java:36)
at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParserFor(JPQLParser.java:116)
at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParseTree(JPQLParser.java:93)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:203)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:170)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:134)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:95)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:80)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:740)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.JpaTemplate$CloseSuppressingInvocationHandler.invoke(JpaTemplate.java:404)
at $Proxy81.createQuery(Unknown Source)
...

junit console is showing

2213 [main] INFO org.springframework.orm.jpa.LocalEntityManagerFactoryBean - Building JPA EntityManagerFactory for persistence unit 'AccessManagerTestDS'
[EL Warning]: 2011.05.16 14:32:54.748--The temporary classLoader for PersistenceLoadProcessor [AccessManagerDS] is not available. Switching classLoader to [sun.misc.Launcher$AppClassLoader@13f5d07]. Weaving has been disabled for this session. EclipseLink may be unable to get a spec mandated temporary class loader from the server, you may be able to use static weaving as an optional workaround.
[EL Warning]: 2011.05.16 14:32:55.278--The temporary classLoader for PersistenceLoadProcessor [AccessManagerDS] is not available. Switching classLoader to [sun.misc.Launcher$AppClassLoader@13f5d07]. Weaving has been disabled for this session. EclipseLink may be unable to get a spec mandated temporary class loader from the server, you may be able to use static weaving as an optional workaround.
54280 [main] INFO gl.am.business.interruption.InterruptionService - Entering method getInterruptions...
55801 [main] INFO gl.am.business.interruption.InterruptionService - Exiting method getInterruptions.

I tried to increase the size of memory of my eclipse and jboss but upto the maximum permissible limits i was getting the issue.

the code was working fine yesterday.can any body suggest any solution
.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5835
    
    7

Looks like Eclipse persistence is giving you all kinds of headaches. Any reason you are using that instead of Hibernate?

You could always try increasing the heap size and see if that helps.

You should also verify that you have not set all references to be immediately loaded - that could have the undesired side effect of loading the entire database on a single query. You should set all persistent objects references to lazy loading unless performance testing indicates otherwise for specific references.


JBoss In Action
kunal green
Greenhorn

Joined: Dec 31, 2009
Posts: 26

thanks a lot...
we have tried the same already....
any other idea??
cant we do it with eclipse link?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5835
    
    7

Try setting the -XX:+HeapDumpOnOutOfMemoryError JVM option. This causes the JVM to dump the heap to a file when an OOME occurs. Then load the file into VisualVM and find out what is using the space.

Eclipse Link might be convenient because because it is embedded in Eclipse, but Jboss AS uses Hibernate to handle JPA, so you would be better off using Hibernate. Install JBoss Tools, and read the Jboss Tools docs - they will get you started with developing apps the use Hibernate for JPA.
 
GeeCON Prague 2014
 
subject: Getting java.lang.outofmemoryexception