问题1.在Java 中使用KBeamArcEagerDependencyParser做依存句法树分析文本,本地测试没问题,但是发布到Linux服务器中就提示引用的 data/model/perceptron/ctb/pos.bin 加载失败,然后通过环境变量拼接的方式给Config重写了文件引用路径
之后路径问题没有了,但是又出现另外一个内存溢出问题
ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space] with root cause
java.lang.OutOfMemoryError: Java heap space
at java.io.ObjectInputStream$HandleTable.grow(ObjectInputStream.java:3962) | |
---|---|
at java.io.ObjectInputStream$HandleTable.assign(ObjectInputStream.java:3768) | |
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2178) | |
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1667) | |
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:503) | |
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:461) | |
at java.util.HashMap.readObject(HashMap.java:1410) | |
at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:498) | |
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1184) | |
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2296) | |
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2187) | |
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1667) | |
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:2093) | |
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1655) | |
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:503) | |
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:461) | |
at com.hankcs.hanlp.dependency.perceptron.structures.ParserModel.(ParserModel.java:129) | |
at com.hankcs.hanlp.dependency.perceptron.transition.parser.KBeamArcEagerParser.(KBeamArcEagerParser.java:44) | |
at com.hankcs.hanlp.dependency.perceptron.transition.parser.KBeamArcEagerParser.(KBeamArcEagerParser.java:39) | |
at com.hankcs.hanlp.dependency.perceptron.parser.KBeamArcEagerDependencyParser.(KBeamArcEagerDependencyParser.java:63) | |
at com.hankcs.hanlp.dependency.perceptron.parser.KBeamArcEagerDependencyParser.(KBeamArcEagerDependencyParser.java:58) | |
at com.hankcs.hanlp.dependency.perceptron.parser.KBeamArcEagerDependencyParser.(KBeamArcEagerDependencyParser.java:42) | |
at com.knx.vxorgsurvey.controller.ReportAIController.getHanlpWorldAnalysis(ReportAIController.java:82) | |
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:498) | |
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) | |
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) | |
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) |
,在网上搜索了一下所示添加VM参数-Xms768m -Xmx768m -XX:PermSize=64M -XX:MaxPermSize=512m,但是问题还是没解决,请问这个问题怎么解决的