title: java.lang.OutOfMemoryError: GC overhead limit exceeded on predeployment of PersistenceUnit
body: <p>I'm working on a web project with Java EE, and it works smooth on my computer, but when I export into a war and upload it into the server I'm receiving the following error:</p>
  
  <pre><code>[2017-02-01T23:29:09.439+0100] [Payara 4.1] [INFO] [] [] [tid: _ThreadID=40 _ThreadName=admin-thread-pool(1)] [timeMillis: 1485988149439] [levelValue: 800] [[
    ================== availabilityEnabled  skipped]]
  
  [2017-02-01T23:31:07.548+0100] [Payara 4.1] [INFO] [NCLS-REST-00003] [javax.enterprise.admin.rest] [tid: _ThreadID=5211 _ThreadName=admin-thread-pool(143)] [timeMillis: 1485988267548] [levelValue: 800] [[
    An error occurred while processing the request. Please see the server logs for details.
  org.glassfish.jersey.server.ContainerException: java.lang.OutOfMemoryError: GC overhead limit exceeded
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer$ResponseWriter.rethrow(GrizzlyHttpContainer.java:324)
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer$ResponseWriter.failure(GrizzlyHttpContainer.java:306)
      at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
      at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)
      at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)
      at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:466)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:169)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.portunif.PUFilter.handleRead(PUFilter.java:231)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
  ]]
  
  [2017-02-01T23:31:08.403+0100] [Payara 4.1] [SEVERE] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=38 _ThreadName=deployment-jar-scanner] [timeMillis: 1485988268403] [levelValue: 1000] [[
    Exception while visiting org/eclipse/persistence/internal/jpa/querydef/CriteriaQueryImpl.class of size 21034
  java.lang.OutOfMemoryError: GC overhead limit exceeded
  ]]
  </code></pre>
  
  <p>In my computer, it works without any problem, with a stable memory usage around 450,000Kb - the jvm allowed memory in the server is 512Mb, is there a problem in the server or could be something in my code? as I can only see references to glassfish and sun libraries.</p>