Liferay and elastic-apm-agent 0.7.0

Hi

i testing the Agent with Liferay 7.1.10/Tomcat. Liferay is starting but without function. I'm not sure what's the right Value for this Parameter is = -Delastic.apm.application_packages=org.example, i have set it to com.liferay

Loglevel for the agent is DEBUG but there is not really interesting to see

2018-09-20 10:16:12.944 WARN  [http-nio-8080-exec-31][code_jsp:172] {code="500", msg="", uri=/web/guest/home}
javax.servlet.ServletException: Servlet execution threw an exception
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:238)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:261)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:263)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144)
	at com.liferay.portal.monitoring.internal.servlet.filter.MonitoringFilter.processFilter(MonitoringFilter.java:181)
	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
Caused by: java.lang.NoClassDefFoundError: co/elastic/apm/servlet/ServletApiAdvice
	at com.liferay.friendly.url.internal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:313

elastic-apm-agent.log

2018-09-20 11:01:49.161 [http-nio-8080-exec-19] DEBUG co.elastic.apm.impl.ElasticApmTracer - startTransaction '' 9497b504f1c3afaccfe98427b3e0e9f3 {
2018-09-20 11:01:49.163 [http-nio-8080-exec-19] DEBUG co.elastic.apm.impl.ElasticApmTracer - } endTransaction 'ServletAdapter#doGet' 9497b504f1c3afaccfe98427b3e0e9f3
2018-09-20 11:01:49.163 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - Sending payload with 1 elements to APM server http://192.168.1.200:8200
2018-09-20 11:01:49.168 [apm-reporter] DEBUG co.elastic.apm.report.ApmServerHttpPayloadSender - APM server responded with status code 202

Hi and thanks for trying out the Java agent!

I'm not familiar with Liferay. The error looks like it could have something to do with OSGi. Does Liferay use an OSGi container, and if yes, which one and which version? Also, which version of Tomcat are you using?

Cheers,
Felix

Hi Felix,

sorry for my late answer, unfortunately the Application is shipped as Docker-Images to us. Inside works Apache Tomcat/9.0.6 and if i'm not mistaken OSGi comes in Version 7 https://community.liferay.com/de/blogs/-/blogs/osgi-version-details

regards

Tim

Actually we set the org.osgi.framework.bootdelegation property to co.elastic.apm.* exactly for that reason - so that the agent classes can be found in OSGi containers. I'm not sure why it does not work with liferay :thinking:

Hi Felix,

after RTFM , this is for Liferay not enough :-D. per default in Liferay the Agent-Classes not visible for OSGi(a "feature" from Liferay :wink: ) it is necessary to add the following to the portal-exe-properties file

module.framework.properties.org.osgi.framework.bootdelegation=\
  __redirected,\
  com.liferay.aspectj,\
  com.liferay.aspectj.*,\
  com.liferay.portal.servlet.delegate,\
  com.liferay.portal.servlet.delegate*,\
  com.sun.ccpp,\
  com.sun.ccpp.*,\
  com.sun.crypto.*,\
  com.sun.image.*,\
  com.sun.jmx.*,\
  com.sun.jna,\
  com.sun.jndi.*,\
  com.sun.mail.*,\
  com.sun.management.*,\
  com.sun.media.*,\
  com.sun.msv.*,\
  com.sun.org.*,\
  com.sun.syndication,\
  com.sun.tools.*,\
  com.sun.xml.*,\
  com.yourkit.*,\
  sun.*,\
  co.elastic.apm.*

i hope that's all, the Application is starting without Exception ... i'm still testing ...

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.