ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Application with Jboss 7 and liferay don´t start with Apm Agent

book

Article ID: 131407

calendar_today

Updated On:

Products

CA Application Performance Management Agent (APM / Wily / Introscope) INTROSCOPE

Issue/Introduction

When Jboss is integrated with Liferay, and you configure Jboss to use the Application Performance Management  (APM) Agent, you may experience the next problem that Jboss start correctly, but Liferay does not.
The Liferay log show an error message like next

 ERROR [Framework Event Dispatcher: Equinox Container: 000c0b98-5655-0019-19a0-8a95602f2265][org_eclipse_equinox_console:97] FrameworkEvent ERROR 
org.osgi.framework.BundleException: Exception in org.eclipse.equinox.console.command.adapter.Activator.start() of bundle org.eclipse.equinox.console. 
...
Caused by: java.lang.NoClassDefFoundError: com/wily/introscope/agent/probe/lang/ManagedThread
...
Caused by: java.lang.ClassNotFoundException: com.wily.introscope.agent.probe.lang.ManagedThread cannot be found by org.eclipse.equinox.console_1.1.100.v20141023-1406

Cause

The cause of this problem is described in next Liferay community thread

https://community.liferay.com/es/blogs/-/blogs/liferay-ce-7-x-liferay-dxp-7-x-java-agents

"...In general, when you add the -Djavaagent=XXX parameter onto your app server's startup command, you're enabling an agent which will have full access inside of the JVM, but only as long as the class loader hierarchy is available. The classes in the agent are injected into the highest point of the class loader hierarchy so they are normally visible across the entire app server.

Except, of course, for Liferay's OSGi container.

Liferay takes great care when creating the OSGi container to limit the "pollution" of the OSGi container's class loader to prevent classes from the app server leaking in as global classes in the OSGi container.

For monitoring agents, though, the agent packages will not be available within OSGi even though the agent is still going to try to inject itself into object instantiation.

This leads to all of the ClassNotFoundExceptions for missing packages/classes during startup."

Environment

Application Performance Management (APM) 10.3
Jboss 
Liferay

Resolution

The resolution to this situation, is also explained in the same Liferay community thread.
In portal-ext.properties file, you need to add the packages from the APM agent to the module.framework.properties.org.osgi.framework.bootdelegation property.
After the modifications required for our agent, the end of the file should look similar as 
 
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.*,\
  com.wily,\
  com.wily.*

 

Additional Information

Configure Jboss to use Application Performance Management (APM) agent

https://docops.ca.com/ca-apm/10-7/en/implementing-agents/java-agent/install-the-java-agent/configure-application-server-to-use-the-java-agent/jboss-as-wildfly-and-jboss-eap

Liferay Community Thread where the problem is described

https://community.liferay.com/es/blogs/-/blogs/liferay-ce-7-x-liferay-dxp-7-x-java-agents