Message Boards

missing classes in ext plugin in LF 7.1

Pawel Michalski, modified 4 Years ago.

missing classes in ext plugin in LF 7.1

New Member Posts: 12 Join Date: 2/3/15 Recent Posts
Hi,
I'm migrating code from 6.2 to 7.1. We have some ext plugins to migrate, one of them is overrinding class JournalContentPortletLayoutListener to add auditing when content is removed from layout.
New ext is gradle project inside liferay workspace with this dep in gradle.build:

originalModule group: "com.liferay", name: "com.liferay.journal.content.web", version: "3.0.34"

Project is compiling and new ext with changed code is created.
The problem is after deploying and running new code. In code added to original class we are using this class:

com.liferay.portal.kernel.security.auth.PrincipalThreadLocal;

Sadly I get error that this class is not available:

java.lang.ClassNotFoundException: com.liferay.portal.kernel.security.auth.PrincipalThreadLocal cannot be found by com.liferay.journal.content.web_3.0.34.ext

I have no idea why is that, shouldn't this class be available for all other libriaries as it is a part of portal-kernel.jar?
Could anyone explaing why it is not working?

Also why I'm not able to check original project on github? I belive that this is the project:
https://github.com/liferay/com-liferay-journal/tree/master/journal-content-web
and I get 404 for this address.

Best regards
thumbnail
David H Nebinger, modified 4 Years ago.

RE: missing classes in ext plugin in LF 7.1

Liferay Legend Posts: 14919 Join Date: 9/2/06 Recent Posts
This is no longer in the core, so an EXT will not be able to do anything with it. EXT only covers changing core functionality which, these days, is pretty thin.

All of what you want to do in the EXT is likely better handled by using regular OSGi modules. A new model listener on layout and/or other classes can add the audit functionality without overriding existing implementations.

And Liferay has done a lot to move typical EXT overrides into OSGi so they can be changed cleanly w/o using an EXT.

Why is getting rid of your EXT important? Every upgrade with an EXT is going to be difficult. Classes get moved out of core (this is a strategic goal) so EXT override is not possible. EXT has no visibility inside the OSGi container, so EXT overrides simply can't pull things together the way they might have in the past. The code in the EXT becomes too fragile as it is ignorant of version bumps that may or may not make your EXT break the portal instead of just adding functionality.

Your goal when upgrading should first and foremost center around the question, "How do I eliminate my EXT plugin using OSGi?" If you find something that you think you need an EXT plugin for, you're likely wrong and we can help point you in the right direction.

You absolutely should not be planning on trying to upgrade EXT plugins as-is from 6.x to 7.x because, at the end of the day, it simply will not work.