留言板

YEOMAN THEME GENERATOR BROKEN

Paul Allain,修改在7 年前。

YEOMAN THEME GENERATOR BROKEN

Junior Member 帖子: 77 加入日期: 13-9-3 最近的帖子
Hello Liferay Community,

Over the past months I have been working with the Yeoman Theme Generator pretty regularly with predictable results. Today, however, the generator stopped working all of a sudden, every time I try creating a theme I get the following errors in the browser and on the console:

javax.servlet.ServletException: javax.servlet.jsp.JspException: com.liferay.portal.kernel.template.TemplateException: Unable to process template custom-theme-admin-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:905)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:838)
	com.liferay.taglib.servlet.PageContextWrapper.handlePageException(PageContextWrapper.java:164)


Further down the stack trace there's the following which indicates that the portal doesn't like the .ftl that is being fed to it:

freemarker.core._TemplateModelException: Java method "Object.equals(Object)" takes 1 argument, but 2 was given.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #if stringUtil.equals(page.getType(),...  [in template "custom-theme-admin-theme_SERVLET_CONTEXT_/templates/init.ftl" at line 156, column 9]
	- Reached through: #include init  [in template "custom-theme-admin-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 3, column 1]
----


It seems that the problem is with "Object.equals(Object)" takes 1 argument, but 2 was given, I thought it was just a one off but now every time I create a theme it's the same behaviour.

Any pointers greatly appreciated.
Paul
thumbnail
David H Nebinger,修改在7 年前。

RE: YEOMAN THEME GENERATOR BROKEN

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
StringUtil.equals() is a reference to a static class, StringUtil, that has a method, equals() which takes two string arguments. It's a Liferay class which is null-safe for both of the string arguments.

Not sure why this cannot resolve any longer; is the stringUtil assignment in the ftl still valid?
thumbnail
Wouter Vernaillen,修改在7 年前。

RE: YEOMAN THEME GENERATOR BROKEN

Junior Member 帖子: 80 加入日期: 09-6-6 最近的帖子
This problem occurred for me too after deleting the node_modules folder this weekend and doing a new "npm install".

The theme is not working any more on Liferay 7 CE ga3 after I downloaded all the new packages. However the theme is working correctly when I deploy it on a fresh build from master.

When I create a new theme I have the same results, not working on ga3, but working on master.
thumbnail
Wouter Vernaillen,修改在7 年前。

RE: YEOMAN THEME GENERATOR BROKEN

Junior Member 帖子: 80 加入日期: 09-6-6 最近的帖子
I did some more digging and found out that this StringUtils.equals method does not exist yet in ga3, it's only added recently (commit) as part of LPS-69980.

The unstyled theme (frontend-theme-unstyled) now has been updated to use this new StringUtils.equals method. This means the theme won't work on ga3 if you're using the latest version of liferay-theme-deps-7.0.
The solution is to lock down the liferay-theme-deps-7.0 version to 1.0.0 in package.json as Robert Frampton suggested here

After trying that my theme is now working again on ga3. emoticon
Paul Allain,修改在7 年前。

RE: YEOMAN THEME GENERATOR BROKEN

Junior Member 帖子: 77 加入日期: 13-9-3 最近的帖子
Wouter Vernaillen:
The unstyled theme (frontend-theme-unstyled) now has been updated to use this new StringUtils.equals method. This means the theme won't work on ga3 if you're using the latest version of liferay-theme-deps-7.0.

Actually the same problem happens on all generated themes including admin themes.

-
thumbnail
Yaseen L Meridjal,修改在7 年前。

RE: YEOMAN THEME GENERATOR BROKEN (答复)

Junior Member 帖子: 25 加入日期: 11-1-10 最近的帖子
Paul Allain:
It seems that the problem is with "Object.equals(Object)" takes 1 argument, but 2 was given, I thought it was just a one off but now every time I create a theme it's the same behaviour.

Due to the fact that Yeoman generator pulls code from the master branch/trunk this error started manifesting itself about a week ago when some "substantial code changes" were pushed to the portal's repository on npm and Github, one of the changes was made to init.ftl and stringUtil.equals method.

Since most development would be on a GA release of the portal the Yeoman generator would produce a theme that would break the GA server due to the reasons mentioned above, so unless you're developing against the master branch you'll need one of the following fixes:

(1) On a newly generated theme
Change
"liferay-theme-deps-7.0": "*"
to
"liferay-theme-deps-7.0": "1.0.0"
and run
npm install


(2) On an existing theme (one that is faulty)
Override
init.ftl
and replace all occurrences of
stringUtil.equals(x, y)
with
 x == y

There is a discussion on Github as to what's the best way forward here, it's an issue raised against the generator-liferay-theme repository.

Yaseen
Paul Allain,修改在7 年前。

RE: YEOMAN THEME GENERATOR BROKEN

Junior Member 帖子: 77 加入日期: 13-9-3 最近的帖子
Thanks all for chiming in.

The Yeoman generator needs to cater for the various releases of the portal (GA and master) if it is to be useful in the long term.