有一个名为
/var/xyz/aa/clm/data/infiles/SenderJMS/CE/L3/
的目录,其中存储了进程运行后的许多 XML 文件。这些文件包含要通过 JMS 队列推送到远程服务器的数据。队列在客户端的云服务器上配置。
在
SenderJMS
服务代码中,我们只需使用 JMS 配置凭据和队列名称,然后开始推送文件。有时 XML 文件列表增加到 20K/30K,并且在错误日志中我们会收到“OutOfMemoryError”。然后 SenderJMS
在处理过程中停止。然后我们从停止执行的地方重新启动服务以进行处理。
凭证:
Queue Name: VS.REVFDX.CL10.PUB.LAS.TCF.L3
jndi.environment.property.key.java.naming.provider.url=ldap://apptstldap.corp.<client_name>.com:888/ou=messaging,dc=corp,dc=<client_name>,dc=com
destination.jndiName=fxClientDestinationUID=D.REVFDX.DLRS.ToBeInvoiced
connection.factory.userid= XYZ_UID
connection.factory.password= PWD
JNDI 配置
@Bean(name = "jndiTemplate")
public JndiTemplate jndiTemplate() {
JndiTemplate jndiTemplate = new JndiTemplate();
Properties environment = new Properties();
environment.setProperty("java.naming.factory.initial", "jndi_environment_property_key_java_naming_factory_initial");
environment.setProperty("java.naming.provider.url", "jndi_environment_property_key_java_naming_provider_url");
jndiTemplate.setEnvironment(environment);
return jndiTemplate;
}
队列通道
@Bean(name="channel1")
public QueueChannel queueChannel() {
return new QueueChannel();
}
文件轮询器
@Bean(name="fileListPoller1")
public FileListPoller fileListPoller() {
FileListPoller fp = new FileListPoller();
fp.setDirectoryPath(file_inbound_dir);
fp.setExcludes(excludes);
return fp;
}
入站处理程序
@Bean(name="inboundHandler2",initMethod="initWS")
public InboundJMSHandlerWS inboundJMSHandlerWS() {
InboundJMSHandlerWS inboundJMSHandlerWS = new InboundJMSHandlerWS();
inboundJMSHandlerWS.setChannel(queueChannel());
inboundJMSHandlerWS.setAddress(inbound_webservice_endpoint_address_4jms);
return inboundJMSHandlerWS;
}
出站处理程序
@Bean(name="outboundJMSHandler1",initMethod="initThreadPool")
public OutboundJMSHandler outboundJMSHandler() {
OutboundJMSHandler outboundJMSHandler = new OutboundJMSHandler();
outboundJMSHandler.setChannel(queueChannel());
outboundJMSHandler.setThreadPoolSize(outbound_jmshandler_thread_pool_size);
outboundJMSHandler.setJndiTemplate(jndiTemplate());
outboundJMSHandler.setJmsPoolSize(connection_pool_size);
outboundJMSHandler.setConnectionFactoryJndiKey(connectionFactory_jndiName);
outboundJMSHandler.setDestinationJndiKey(destination_jndiName);
outboundJMSHandler.setInterfaceName(outbound_jms_interface_name);
outboundJMSHandler.setTestLevel(outbound_jms_testLevel);
outboundJMSHandler.setCnFactoryUID(connection_factory_userid);
outboundJMSHandler.setCnFactoryPassword(connection_factory_password);
outboundJMSHandler.setJmsMessageType(jms_message_type);
return outboundJMSHandler;
}
错误详细信息:
Exception in thread "TIBCO EMS TCPLink Reader (Server-130801)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "<ClientName>JMSStarvedConsumerTimer" java.lang.OutOfMemoryError: Java heap space.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=75M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: MaxNewSize (512000k) is equal to or greater than the entire heap (512000k). A new max generation size of 511936k will be used.
正如日志中我们得到的
OutOfMemoryError
,我们将堆大小从 500MB 增加到 1024MB(1GB),但这并没有解决我们的问题。和之前一样,如果再次出现上述问题,我们需要重新启动SenderJMS
服务。
SenderJMS
应用程序在中间停止的原因可能是什么?文件推送时是否需要检查队列是否已满?
根据您提供的信息,无法确定应用程序内存不足的原因。当您点击
OutOfMemoryError
时,您需要捕获堆转储,然后对其进行分析以查看哪些内容消耗了大部分内存。
要在点击
OutOfMemoryError
时捕获堆转储,您可以使用 -XX:+HeapDumpOnOutOfMemoryError
JVM 参数,如此处所述。
您可以使用许多工具来分析堆转储(例如 JVisualVM、Eclipse MAT 等)。