[
https://issues.apache.org/jira/browse/MYFACES-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17598371#comment-17598371
]
Paul Nicolucci commented on MYFACES-4449:
-----------------------------------------
The fallback is where the API ClassUtils classloader is used. When, running in
an OSGI environment and the API is isolated from the Implementation it only has
access to the classes/resources in the API bundle. The methods check the
ThreadContext which in this case is the Application classloader and then falls
back to the ClassUtils classloader, neither of which contains the resource
which is being looked for. The resource exists for this example in the
implementation JAR.
> Implementation ClassUtils needs methods added to support OSGI runtimes
> ----------------------------------------------------------------------
>
> Key: MYFACES-4449
> URL: https://issues.apache.org/jira/browse/MYFACES-4449
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 4.0.0-RC1
> Reporter: Paul Nicolucci
> Assignee: Paul Nicolucci
> Priority: Major
>
> Historically in MyFaces, there existed an {{ClassUtils}} in the
> implementation as well as the API. In Faces 4.0 the code was refactored to
> have the {{Classutils}} in the Impl extend the {{ClassUtils}} in the API:
> API:
> [https://github.com/apache/myfaces/blob/main/api/src/main/java/org/apache/myfaces/core/api/shared/lang/ClassUtils.java]
> Impl:
> [https://github.com/apache/myfaces/blob/main/impl/src/main/java/org/apache/myfaces/util/lang/ClassUtils.java]
>
> If we look at the 3.0 branches you'll see the implementation class does not
> extend the API class:
> API:
> [https://github.com/apache/myfaces/blob/3.0.x/api/src/main/java/jakarta/faces/component/html/_ClassUtils.java]
> Impl:
> [https://github.com/apache/myfaces/blob/3.0.x/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassUtils.java]
>
> Having all the classloading methods in the API class works fine when the API
> and IMPL are bundled within an application but when trying to integrate
> MyFaces into an OSGI runtime where the API has no visibility into the
> implementation then a number of classloading issues occur.
>
> I've identified the following methods that need to be placed back into the
> implementation ClassUtils:
> * public static URL getResource(String resource)
> * public static InputStream getResourceAsStream(String resource)
> * public static Class simpleClassForName(String type)
> * public static Class simpleClassForName(String type, boolean logException)
> * public static Class classForName(String type) throws ClassNotFoundException
--
This message was sent by Atlassian Jira
(v8.20.10#820010)