我有一个基于springboot的微服务,它从SOAP端点读取XML,解析它并将解析后的响应转发给请求客户端。
以下是使用的springboot / spring / tomcat版本:
<spring.boot.version>1.5.4.RELEASE</spring.boot.version>
<spring.version>4.3.9.RELEASE</spring.version>
Tomcat 8.5.21.0
该服务在功能上运行良好,并且能够处理负载而没有太多问题。但是,当我查看该服务的航班记录时,我看到很多(每分钟百万分钟)的例外情况如下所示:
Stack Trace Count Percentage(%) Total
java.lang.Throwable.<init>(String) 1,532,051 95.618 0
java.lang.Exception.<init>(String) 1,532,051 95.618 0
java.io.IOException.<init>(String) 1,503,857 93.858 0
java.io.FileNotFoundException.<init>(String) 1,503,782 93.854 0
org.springframework.boot.loader.jar.JarURLConnection.throwFileNotFound(Object, JarFile) 1,503,782 93.854 0
org.springframework.boot.loader.jar.JarURLConnection.connect() 1,503,782 93.854 0
org.springframework.boot.loader.jar.JarURLConnection.getInputStream() 1,503,782 93.854 0
sun.misc.URLClassPath$Loader.findResource(String, boolean) 1,503,782 93.854 0
sun.misc.URLClassPath$1.next() 1,503,782 93.854 0
sun.misc.URLClassPath$1.hasMoreElements() 1,503,782 93.854 0
java.net.URLClassLoader$3$1.run() 1,503,782 93.854 0
java.net.URLClassLoader$3$1.run() 1,503,782 93.854 0
java.security.AccessController.doPrivileged(PrivilegedAction, AccessControlContext) 1,503,782 93.854 0
java.net.URLClassLoader$3.next() 1,503,782 93.854 0
java.net.URLClassLoader$3.hasMoreElements() 1,503,782 93.854 0
sun.misc.CompoundEnumeration.next() 1,503,782 93.854 0
sun.misc.CompoundEnumeration.hasMoreElements() 1,503,782 93.854 0
sun.misc.CompoundEnumeration.next() 1,503,782 93.854 0
sun.misc.CompoundEnumeration.hasMoreElements() 1,503,782 93.854 0
java.util.ServiceLoader$LazyIterator.hasNextService() 1,503,782 93.854 0
java.util.ServiceLoader$LazyIterator.hasNext() 1,503,782 93.854 0
java.util.ServiceLoader$1.hasNext() 1,503,782 93.854 0
javax.xml.transform.FactoryFinder$1.run() 1,046,435 65.31 0
java.security.AccessController.doPrivileged(PrivilegedAction) 1,046,435 65.31 0
javax.xml.transform.FactoryFinder.findServiceProvider(Class) 1,046,435 65.31 0
javax.xml.transform.FactoryFinder.find(Class, String) 1,046,435 65.31 0
javax.xml.transform.TransformerFactory.newInstance() 1,046,435 65.31 0
com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer.<init>() 1,046,435 65.31 0
com.sun.xml.messaging.saaj.util.transform.EfficientStreamingTransformer.newTransformer() 1,046,435 65.31 0
com.sun.xml.messaging.saaj.soap.impl.EnvelopeImpl.output(OutputStream) 589,228 36.775 0
com.sun.xml.messaging.saaj.soap.impl.EnvelopeImpl.output(OutputStream, boolean) 589,228 36.775 0
com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getContentAsStream() 589,228 36.775 0
com.sun.xml.messaging.saaj.soap.MessageImpl.getHeaderBytes() 589,228 36.775 0
com.sun.xml.messaging.saaj.soap.MessageImpl.saveChanges() 589,228 36.775 0
org.springframework.ws.soap.saaj.SaajSoapMessage.writeTo(OutputStream) 589,228 36.775 0
org.springframework.ws.transport.AbstractWebServiceConnection.send(WebServiceMessage) 589,228 36.775 0
org.springframework.ws.client.core.WebServiceTemplate.sendRequest(WebServiceConnection, WebServiceMessage) 589,228 36.775 0
org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(MessageContext, WebServiceConnection, WebServiceMessageCallback, WebServiceMessageExtractor) 589,228 36.775 0
org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(String, WebServiceMessageCallback, WebServiceMessageExtractor) 589,228 36.775 0
org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(String, Object, WebServiceMessageCallback) 589,228 36.775 0
org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(Object, WebServiceMessageCallback) 589,228 36.775 0
org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(Object) 589,228 36.775 0
com.hotels.booking.discos.loyalty.client.LoyaltyWebServiceGateway.sendAndReceive(AbstractLoyaltyRequest) 589,228 36.775 0
com.hotels.booking.discos.loyalty.client.LoyaltyWebServiceGateway.retrieveRewardAdjustments(LoyaltyRewardAdjustmentsRetrievalRequest) 217,970 13.604 0
sun.reflect.GeneratedMethodAccessor334.invoke(Object, Object[]) 217,970 13.604 0
sun.reflect.DelegatingMethodAccessorImpl.invoke(Object, Object[]) 217,970 13.604 0
java.lang.reflect.Method.invoke(Object, Object[]) 217,970 13.604 0
com.hotels.thermos.proxy.GenericProxyCircuitBreaker.execute() 217,970 13.604 0
com.hotels.thermos.AbstractCircuitBreaker.run() 217,970 13.604 0
com.hotels.thermos.HystrixCommandWrapper.run() 217,970 13.604 0
com.netflix.hystrix.HystrixCommand$1.call(Subscriber) 217,970 13.604 0
com.netflix.hystrix.HystrixCommand$1.call(Object) 217,970 13.604 0
rx.Observable$2.call(Subscriber) 217,970 13.604 0
rx.Observable$2.call(Object) 217,970 13.604 0
rx.Observable$2.call(Subscriber) 217,970 13.604 0
rx.Observable$2.call(Object) 217,970 13.604 0
rx.Observable$2.call(Subscriber) 217,970 13.604 0
rx.Observable$2.call(Object) 217,970 13.604 0
具体的例外似乎是:
Message: JAR entry META-INF /services/* not found in /<service.jar>
异常数量会给服务带来很大的内存压力,从而限制了服务的性能/可扩展性
我尝试寻找解决方案,并发现了一些类似的问题。大多数资源都指向嵌入式tomcat作为问题。但我无法在任何地方找到这个特定问题的原因或解决方案。
非常感谢任何理解/解决此问题的帮助!