0

I have a question:

I'm loading a RDF file (.nt format) in my model using Web Service. I have this method:

    @WebMethod(operationName = "operation")
    public String operation(@WebParam(name = "f") String f, @WebParam(name = "label") String label) {
        return loadModel(f, label);
    }

    private String loadModel(String f, String label){
            Model model = ModelFactory.createDefaultModel();
            InputStream in = FileManager.get().open( f );

            // read the RDF/XML file
            model.read(in, "RDF/XML");

            Model modellabel = loadModel2(label);

            ResIterator sublist = modellabel.listSubjects();
            Resource sub = null;
            while (sublist.hasNext()){
                sub = sublist.next();
                break;
            }

            return sub.toString();
        }

    public Model loadModel2 (String label) {

            Model model;
            model = RDFDataMgr.loadModel(label);

            return model;
        }

When I run this code with "Test Web Service" (and I insert the Strings), I get this error on GlassFish Server 4:

Grave:   log4j:WARN No appenders could be found for logger (org.apache.jena.riot.stream.JenaIOEnvironment).
Grave:   log4j:WARN Please initialize the log4j system properly.
Grave:   log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Grave:   javax.ejb.EJBException
    at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:748)
    at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:698)
    at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:503)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4475)
    at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:205)
    at com.sun.proxy.$Proxy296.operation(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.glassfish.webservices.InvokerImpl.invoke(InvokerImpl.java:82)
    at org.glassfish.webservices.EjbInvokerImpl.invoke(EjbInvokerImpl.java:82)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:149)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:88)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:136)
    at org.glassfish.webservices.MonitoringPipe.process(MonitoringPipe.java:142)
    at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:136)
    at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:210)
    at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:142)
    at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:420)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:687)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:266)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:169)
    at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:110)
    at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:80)
    at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:203)
    at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:242)
    at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:193)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.Arrays.copyOfRange(Arrays.java:2694)
    at java.lang.String.<init>(String.java:203)
    at java.lang.StringBuilder.toString(StringBuilder.java:405)
    at org.apache.jena.riot.tokens.TokenizerText.langTag(TokenizerText.java:981)
    at org.apache.jena.riot.tokens.TokenizerText.parseToken(TokenizerText.java:221)
    at org.apache.jena.riot.tokens.TokenizerText.hasNext(TokenizerText.java:86)
    at org.apache.jena.atlas.iterator.PeekIterator.fill(PeekIterator.java:50)
    at org.apache.jena.atlas.iterator.PeekIterator.next(PeekIterator.java:92)
    at org.apache.jena.riot.lang.LangEngine.nextToken(LangEngine.java:99)
    at org.apache.jena.riot.lang.LangNTriples.parseOne(LangNTriples.java:67)
    at org.apache.jena.riot.lang.LangNTriples.runParser(LangNTriples.java:54)
    at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
    at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(RDFParserRegistry.java:142)
    at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:859)
    at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:208)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:101)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:92)
    at org.apache.jena.riot.RDFDataMgr.loadModel(RDFDataMgr.java:328)
    at prova.Prova_WS.loadModel(Prova_WS.java:98)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)

Avvertenza:   EJB5184:A system exception occurred during an invocation on EJB Prova_WS, method: public java.lang.String prova.Prova_WS.operation(java.lang.String,java.lang.String)
Avvertenza:   javax.ejb.EJBException
    at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:748)
    at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:698)
    at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:503)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4475)
    at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:205)
    at com.sun.proxy.$Proxy296.operation(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.glassfish.webservices.InvokerImpl.invoke(InvokerImpl.java:82)
    at org.glassfish.webservices.EjbInvokerImpl.invoke(EjbInvokerImpl.java:82)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:149)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:88)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:136)
    at org.glassfish.webservices.MonitoringPipe.process(MonitoringPipe.java:142)
    at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:136)
    at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:210)
    at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:142)
    at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:420)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:687)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:266)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:169)
    at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:110)
    at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:80)
    at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:203)
    at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:242)
    at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:193)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.Arrays.copyOfRange(Arrays.java:2694)
    at java.lang.String.<init>(String.java:203)
    at java.lang.StringBuilder.toString(StringBuilder.java:405)
    at org.apache.jena.riot.tokens.TokenizerText.langTag(TokenizerText.java:981)
    at org.apache.jena.riot.tokens.TokenizerText.parseToken(TokenizerText.java:221)
    at org.apache.jena.riot.tokens.TokenizerText.hasNext(TokenizerText.java:86)
    at org.apache.jena.atlas.iterator.PeekIterator.fill(PeekIterator.java:50)
    at org.apache.jena.atlas.iterator.PeekIterator.next(PeekIterator.java:92)
    at org.apache.jena.riot.lang.LangEngine.nextToken(LangEngine.java:99)
    at org.apache.jena.riot.lang.LangNTriples.parseOne(LangNTriples.java:67)
    at org.apache.jena.riot.lang.LangNTriples.runParser(LangNTriples.java:54)
    at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
    at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(RDFParserRegistry.java:142)
    at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:859)
    at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:687)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:208)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:101)
    at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:92)
    at org.apache.jena.riot.RDFDataMgr.loadModel(RDFDataMgr.java:328)
    at prova.Prova_WS.loadModel(Prova_WS.java:98)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)

I have noted that this error is given on:

Model modellabel = loadModel2(label);

I have read some post on StackOverflow to increase java heap memory as How to increase the java heap size in netbeans?, but, I get the same error, also if I increase 8192Mb.

The file that I pass in input, is big, but in java application environment I don't get this error. Why?

Community
  • 1
  • 1
Musich87
  • 562
  • 1
  • 12
  • 31
  • Are you running on a 64Bit JVM or 32Bit? The 32Bit VM has a RAM limit of 1GB I think. Use 64Bit VM where you can go as up as you want (nearly). – Rene M. Jul 29 '14 at 12:50
  • Then I would follow Aaron's sugesstion to compare both environments. But when you processing that big files I would't do it in the request (transaction), because timeouts, response time etc... I would impl. some loose coupled stuff like receiver file, store, response, send message to import sevice do import in custom transaction async and batch like. – Rene M. Jul 29 '14 at 12:56

3 Answers3

2

If you get the error on computer A but not on B, then there must be a difference. You'll have to compare every little detail:

  • Java VM type and versions
  • OS version
  • free memory on both
  • options that you use to start
  • do you really have the same versions of everything (code, JARS)?
  • Are you loading the exact same data on both systems?

Eventually, you'll stuble over something that is different and which explains the odd behavior.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • No, I have used the same computer, but I don't get error if I use this code with "Java Application" program, while I get error if I use this code with "Web Service" program. I have changed only the mode, before Java Application, now Web Service. – Musich87 Jul 29 '14 at 12:50
  • Make sure when you run with "Web Service" program, that it actually pays attention to `-Xmx512m`. If you pass this option to Netbeans, that won't give more memory to Java code started by Netbeans. You'll have to specify this option in the launch configuration (somewhere in the "Run" dialog)!! – Aaron Digulla Jul 29 '14 at 12:52
  • Where do I pass this option to Netbeans? I passed this option to my Web Service program (Right click on your project "Properties", Select "Run" category, enter your arguments(-Xmx512m) in the "VM Options" text box) – Musich87 Jul 29 '14 at 12:54
  • That should work. Can you print how much memory you have in the code and double check? See http://viralpatel.net/blogs/getting-jvm-heap-size-used-memory-total-memory-using-java-runtime/ – Aaron Digulla Jul 29 '14 at 12:56
  • What is a webservice programm? What are you developing? When you use an application server (glassfish is one) and you start the application server out of your IDE. Normaly the IDE provides something like a run configuration for the application server. There you can define start params, ports, timeout etc... it drives me crazy when people start to build a skyscraper but didn't know how to make concrete ;) – Rene M. Jul 29 '14 at 12:59
  • Aaron: I get: Informazioni: ##### Heap utilization statistics [MB] ##### Informazioni: Used Memory:193 Informazioni: Free Memory:122 Informazioni: Total Memory:316 Informazioni: Max Memory:455 @rmertins: For "Web Service program" I intend a "Web Service project". I said that if I run my code in a "Java Application Project" I don't get error, but if I run my code in a "Web Service Project" (the same code) I get this error. I know that these projects aren't equals for various reasons, I would like to know why a simple RDF load don't run. – Musich87 Jul 29 '14 at 13:09
  • It's how you load the RDF is to expensive for your provided ram. Provide more RAM or make it less expensive (what would I prefer) – Rene M. Jul 29 '14 at 13:12
  • @Musich87: 1) are you loading the same RDF file? 2) did you print the free memory just before the line `model.read(in, "RDF/XML");`, i.e. you have 122MB free? 3) how big is your RDF file? – Aaron Digulla Jul 29 '14 at 13:24
  • 1) yes, I'm loading the same RDF file. 2) I print the free memory after the line model.read(in, "RDF/XML"). I have a PC with 16GB of RAM, the System.out says that I have 122MB free, but I'm using only 6GB... 3) RDF file is about 78Mb. – Musich87 Jul 29 '14 at 13:31
  • Well, try to start Glassfish with `-Xmx1500m` – Aaron Digulla Jul 29 '14 at 14:11
  • Glasfish? Where I can modify this value in GlassFish? Before, I have modify the heap memory on my project (until 8192MB) but I get error. I don't have modify in Glassfish. – Musich87 Jul 29 '14 at 14:30
  • Setting it in the VM arguments when you start it as a "Web Service" should work. Do you see more free memory in the output? – Aaron Digulla Jul 29 '14 at 15:16
  • I have tried until 4096MB. I have changed both of Glassfish JVM option, both Netbeans project, but I get this error – Musich87 Jul 30 '14 at 07:16
  • Please don't skip steps. Do you see `Free Memory` > 3000 in the output? – Aaron Digulla Jul 30 '14 at 07:20
  • I'm sorry. No, I didn't see Free Memory > 3000. I have resolved my problem by changing the code. My response is visible. – Musich87 Jul 30 '14 at 08:12
0

I have resolved my problem in this way: I have changed the loadModel2 method:

public Model loadModel2 (String label) {

                String directory;
                directory = "C:\\tdb";
                Model model = TDBFactory.createModel(directory); 

        return model;
    }

In this way, I don't get the overhead error.

Musich87
  • 562
  • 1
  • 12
  • 31
  • :-/ I don't see how that could fix the error. Why does that use less memory? – Aaron Digulla Jul 30 '14 at 08:36
  • Yes, this method use less memory. I have read in literature that to resolve the problem by reading of large RDF file, is useful usually to utilize the triplestore TDB library. – Musich87 Jul 30 '14 at 08:41
0

You can try by giving more memory to the process, just add one parameter in your startup scripts:

java -Xmx1024m< com.yourcompany.YourClass/code>

You can also try out Plumbr for free. When we find the cause for the java.lang.OutOfMemoryError you will see the exact location of the problem along with solution guidelines.