Liferay 7.2+ [DXP] Wildfly Bundles

Just a quick one today...

Liferay stopped releasing Liferay CE/DXP Wildfly bundles after 7.1, so I was recently asked to create a Liferay 7.2 DXP bundle for Wildfly 11.

So I followed the instructions posted here: https://help.liferay.com/hc/en-us/articles/360029123751-Installing-Liferay-DXP-on-Wildfly

Started the Wildfly bundle and it seemed to come up fine. Navigating to the site, though, showed things were not right. I had no pages, no content, etc, although I could log in and interface elements were all seemingly working.

When I checked the logs, though, I found a slew of the following:

2020-05-04 15:45:59.031 ERROR [default task-44][IncludeTag:128] Current URL / generates exception: javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/ccpp/Profile
java.lang.ClassNotFoundException: javax.ccpp.Profile from [Module "deployment.ROOT.war" from Service Module Loader]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetPublicMethods(Class.java:2902)
	at java.lang.Class.privateGetPublicMethods(Class.java:2917)
	at java.lang.Class.getMethods(Class.java:1615)
	at freemarker.ext.beans.ClassIntrospector.discoverAccessibleMethods(ClassIntrospector.java:464)
	at freemarker.ext.beans.ClassIntrospector.discoverAccessibleMethods(ClassIntrospector.java:457)
	at freemarker.ext.beans.ClassIntrospector.createClassIntrospectionData(ClassIntrospector.java:268)
	at freemarker.ext.beans.ClassIntrospector.get(ClassIntrospector.java:244)
	at freemarker.ext.beans.BeanModel.(BeanModel.java:114)
	at freemarker.ext.beans.BeanModel.(BeanModel.java:104)
	at freemarker.ext.beans.StringModel.(StringModel.java:52)
	at com.liferay.portal.template.freemarker.internal.LiferayObjectWrapper$5.create(LiferayObjectWrapper.java:191)
	at com.liferay.portal.template.freemarker.internal.LiferayObjectWrapper.wrap(LiferayObjectWrapper.java:113)
	at com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate$CachableDefaultMapAdapter.get(FreeMarkerTemplate.java:180)
	at freemarker.core.Environment.getGlobalVariable(Environment.java:1489)
	at freemarker.core.Environment.getVariable(Environment.java:1475)

Well, a quick google showed that there was nothing on this, so I was left to solve it on my own. I got it working and wanted to post the details here in case you too run into this issue.

So first thing I did was to find the CC/PP dependency. I downloaded it from https://mvnrepository.com/artifact/javax.ccpp/ccpp/1.0 because I kind of trust mvnrepository.

I copied the jar to the $LIFERAY_HOME/wildfly-11.0.0.Final/modules/com/liferay/portal/main directory, then I added a line to the $LIFERAY_HOME/wildfly-11.0.0.Final/modules/com/liferay/portal/main/module.xml file to reference the new jar.

My updated module.xml file is:

<?xml version="1.0"?>

<module name="com.liferay.portal" xmlns="urn:jboss:module:1.0">
	<resources>
		<resource-root path="com.liferay.petra.concurrent.jar" />
		<resource-root path="com.liferay.petra.executor.jar" />
		<resource-root path="com.liferay.petra.function.jar" />
		<resource-root path="com.liferay.petra.io.jar" />
		<resource-root path="com.liferay.petra.lang.jar" />
		<resource-root path="com.liferay.petra.memory.jar" />
		<resource-root path="com.liferay.petra.nio.jar" />
		<resource-root path="com.liferay.petra.process.jar" />
		<resource-root path="com.liferay.petra.reflect.jar" />
		<resource-root path="com.liferay.petra.string.jar" />
		<resource-root path="com.liferay.registry.api.jar" />
		<resource-root path="hsql.jar" />
		<resource-root path="ccpp-1.0.jar" />

		<resource-root path="portal-kernel.jar" />
		<resource-root path="portlet.jar" />
		<resource-root path="postgresql.jar" />
	</resources>
	<dependencies>
		<module name="ibm.jdk" />
		<module name="javax.api" />
		<module name="javax.mail.api" />
		<module name="javax.servlet.api" />
		<module name="javax.servlet.jsp.api" />
		<module name="javax.transaction.api" />
	</dependencies>
</module>

After making these changes and restarting Wildfly, everything seemed to work.

Are there better ways to solve this problem? Perhaps. If you have a solution that works better than mine, please share in the comments below!

Blogs

Thanks for sharing this with the community, David. Turns out https://help.liferay.com/hc/en-us/articles/360029031491-Installing-Liferay-DXP-on-Tomcat explicitly says that it's necessary to download or copy ccpp.jar from an existing bundle to lib/ext in Tomcat. So it seems that it's necessary to download and add it to Wildfly as well, if it's not included in the app server itself somehow. I'll check how ant deploy behaves when setting the app.server.type to wildfly in app.server.properties.

After the deploy process finished, a ccpp.jar file was available on standalone/deployments/ROOT.war/WEB-INF/lib/ccpp.jar. But other needed libraries were missing, which makes me suspect ant deploy is not providing the needed libraries. :/

After ant all on Wildfly the portal runs normally. I'll request to update the documentation so that the needed libraries be present on the lib folder.

It seems that ccpp.jar needs to be a part of the DXP/CE dependencies ZIP file. For now, the documentation needs to be updated to include it. thanks.

The ccpp.jar is in the Portal/DXP WAR file. So copying the file into the JAR to the dependencies ZIP or somewhere else in the class path doesn't need to be done. Nobody has been able to reproduce the problem. Dave - Can you file a product ticket for it?

We run LR 7.2 on Wildfly 16 and, interestingly, didn't need to copy ccpp.jar here!

Following the guide from https://help.liferay.com/hc/en-us/articles/360029123751-Installing-Liferay-DXP-on-Wildfly was sufficient.