Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and simplify handling of JSPParser classloader #7567

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

matthiasblaesing
Copy link
Contributor

The classloader was reset after each invocation by calls to resetClassLoaders, so there is already little caching present here.

The old behavior though posed a different problem: the classloaders were shared into multiple threads and calls to resetClassLoaders were not coordinated, so the "slower" thread could be faced with a closed classloader. For an URLClassLoader this means, that classes already loaded work, new classes can't be loaded. This leads to difficult to debug situations.

At runtime this was observed as:

Unable to read TLD "META-INF/liferay-portlet-ext.tld" from JAR file "file:/home/matthias/.m2/repository/com/liferay/portal/release.portal.api/7.4.3.94-ga94/release.portal.api-7.4.3.94-ga94.jar": org.apache.jasper.JasperException: PWC6112: Failed to load or instantiate TagExtraInfo class: com.liferay.taglib.portlet.ActionURLTei

Leading to errors reported in JSPs.

@matthiasblaesing matthiasblaesing added the Java EE/Jakarta EE [ci] enable enterprise job label Jul 12, 2024
@matthiasblaesing matthiasblaesing added this to the NB23 milestone Jul 12, 2024
- J2EE DD API bundled javaee-api-5.jar, which seems to be unused apart
  from an unused import in ResourceImpl. javaee-api-5.jar can only be
  used to compile against, but fails usage at runtime (it does not
  contain the code), so is assumed to be actually be unused.
  The bundled javaee-api-5.jar was pulled onto the classpath when the
  module was in the dependencies and the missing code parts caused
  class loading error, which are fixed by the removal.
- The web.jspparser project uses multiple demo project to check loading
  two were partially donated, one was not (project3). Tests relying on
  the removed project were removed. The other two projects were fixable
  replacing the missing components with fresh downloads from maven
  central and a pseudo tag jar build at compile time.
- One test relyed on a special VM and was not executed, but did not
  report that.
Copy link
Contributor

@lkishalmi lkishalmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked through the changes, have not tested it.

If this works it seems to be fine.

return true;
}
return false;
return JspParserAPI.TAG_MIME_TYPE.equals(fo.getMIMEType());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could tally with the previous fo.getExt condition.

The classloader was reset after each invocation by calls to
resetClassLoaders, so there is already little caching present here.

The old behavior though posed a different problem: the classloaders
were shared into multiple threads and calls to resetClassLoaders were
not coordinated, so the "slower" thread could be faced with a closed
classloader. For an URLClassLoader this means, that classes already
loaded work, new classes can't be loaded. This leads to difficult to
debug situations.

At runtime this was observed as:

Unable to read TLD "META-INF/liferay-portlet-ext.tld" from JAR file
"file:/home/matthias/.m2/repository/com/liferay/portal/release.portal.api/7.4.3.94-ga94/release.portal.api-7.4.3.94-ga94.jar":
org.apache.jasper.JasperException: PWC6112: Failed to load or
instantiate TagExtraInfo class: com.liferay.taglib.portlet.ActionURLTei
@matthiasblaesing matthiasblaesing merged commit 0f675a8 into apache:master Jul 17, 2024
31 checks passed
@matthiasblaesing matthiasblaesing deleted the fix_jsp_parser2 branch July 21, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java EE/Jakarta EE [ci] enable enterprise job
Projects
Development

Successfully merging this pull request may close these issues.

3 participants