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

JSP To Load Versions Dynamically #13173

Merged
merged 3 commits into from Feb 13, 2021
Merged

Conversation

volosied
Copy link
Member

@volosied volosied commented Jul 26, 2020

Potential Fix For #12387 that models the ServletVersion/JavaEEVersion.

I had modeled the Service-Component: com.ibm.ws.jsp.vXX.dd changes after our servlet factory code.

When a feature is loaded, a new version of JSP is set through injection within the JSPExtensionFactory.

The other two approaches didn't seem appealing.

Splitting the the 2.3 factories just meant more duplicate code for 2.3 and 3.0, and we only need a new version for 3.0.

Transformer could work, but it would be more of a hack. For example, we could change the version variable to "JSP_VERSION_2.3", transform to "JSP_VERSION_3.0", and then the getVersion functions would return the substring 2.3/3.0 instead.

OSGI approach seems most fitting.

I copied and applied code from the web-container methods below:

@Reference(service=ServletVersion.class, cardinality=ReferenceCardinality.MANDATORY, policy=ReferencePolicy.DYNAMIC, policyOption=ReferencePolicyOption.GREEDY)
protected synchronized void setVersion(ServiceReference<ServletVersion> reference) {
versionRef = reference;
WebContainer.loadedContainerSpecLevel = (Integer) reference.getProperty("version");
}
protected synchronized void unsetVersion(ServiceReference<ServletVersion> reference) {
if (reference == this.versionRef) {
versionRef = null;
WebContainer.loadedContainerSpecLevel = DEFAULT_MAX_VERSION;
}
}

The new getLoadedPagesSpecLevel uses timing code (from webcontainer) that was merged in this PR commit

if (WebContainer.loadedContainerSpecLevel == SPEC_LEVEL_UNLOADED) {
CountDownLatch currentLatch = selfInit;
// wait for activation
try {
currentLatch.await(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
// auto-FFDC
Thread.currentThread().interrupt();
}
currentLatch.countDown(); // don't wait again
if (WebContainer.loadedContainerSpecLevel == SPEC_LEVEL_UNLOADED) {
logger.logp(Level.WARNING, CLASS_NAME, "getServletContainerSpecLevel", "servlet.feature.not.loaded.correctly");
return WebContainer.DEFAULT_SPEC_LEVEL;
}
}

New Error message was added:
jsp.feature.not.loaded.correctly=CWWJS0001: The JSP [Pages] feature did not load with an acceptable version.

Update: Feb 8th 2021

Code was updated to pass the version variable to AbstractJSPExtensionServletWrapper per the conversation with Tom Watson in the comments below.

JSPExtensionFactory#createProcessor passes the version to AbstractJSPExtensionProcessor. It’s then set as a variable in AbstractJSPExtensionProcessor, and later passed through AbstractJSPExtensionServletWrapper#initialize. Then the version is stored as loadedJSPVersion in AbstractJSPExtensionServletWrapper.

Sounds complicated as I reread it, but it does get to AbstractJSPExtensionServletWrapper.

@volosied
Copy link
Member Author

#build

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_tnO3wM7eEeqmIcsdsdUKbw

Target locations of links might be accessible only to IBM employees.

@volosied volosied marked this pull request as draft July 26, 2020 02:24
@LibbyBot
Copy link

@LibbyBot
Copy link

The build volosied-13173-20200726-0233
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_tnO3wM7eEeqmIcsdsdUKbw
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_tnO3wM7eEeqmIcsdsdUKbw

dev/com.ibm.ws.jsp.2.3/bnd.bnd Show resolved Hide resolved
dev/com.ibm.ws.jsp.2.3/bnd.bnd Outdated Show resolved Hide resolved
@volosied
Copy link
Member Author

volosied commented Nov 9, 2020

#build

@LibbyBot
Copy link

LibbyBot commented Nov 9, 2020

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_NBN1sCLOEeux8uC7tiSOag

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

@LibbyBot
Copy link

The build volosied-13173-20201109-2204
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_NBN1sCLOEeux8uC7tiSOag
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_NBN1sCLOEeux8uC7tiSOag

@volosied
Copy link
Member Author

#build

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_xqK5wiT2Eeux8uC7tiSOag

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

@LibbyBot
Copy link

The build volosied-13173-20201112-1600
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_xqK5wiT2Eeux8uC7tiSOag
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_xqK5wiT2Eeux8uC7tiSOag

Copy link
Member

@pnicolucci pnicolucci left a comment

Choose a reason for hiding this comment

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

I see we have a PagesVersion class now but we're referring to it in the code in areas such as loadedJSPVersion should we change to loadedPagesVersion?

@volosied volosied force-pushed the jsp-version branch 8 times, most recently from 69726f3 to ff7098b Compare February 10, 2021 17:06
Copy link
Member

@pnicolucci pnicolucci left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for making the updates!

@volosied
Copy link
Member Author

#build

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_YicVUG1NEeulAs018fCg4w

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

@LibbyBot
Copy link

The build volosied-13173-20210212-0921
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_YicVUG1NEeulAs018fCg4w
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_YicVUG1NEeulAs018fCg4w

@volosied
Copy link
Member Author

All tests passed except for one failure: org.eclipse.microprofile.rest.client.tck.timeout.TimeoutTest.testConnectTimeout. However, it's an existing defect: 272083.

@volosied
Copy link
Member Author

#run-libby-bot

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 16 product code files were changed.

  • Please describe in a separate comment how you tested your changes.

  • 1 FAT files were changed, added, or removed.

  • Check that the build did not break the affected FAT suite(s).

  • 1 messages files were changed and need an L2 review.

  • @OpenLiberty/message-reviewer Please review.

  • dev/com.ibm.ws.jsp/resources/com/ibm/ws/jsp/resources/messages.nlsprops

  • 1 NLS files were changed and need an ID review.

  • @OpenLiberty/message-reviewer Please review.

  • dev/com.ibm.ws.jsp/resources/com/ibm/ws/jsp/resources/messages.nlsprops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants