Skip to content

Commit

Permalink
Let engine process utContext use Platform ClassLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaMuravjov committed Aug 15, 2023
1 parent 0312936 commit 6d50aee
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ private var idCounter: Long = 0
private fun EngineProcessModel.setup(kryoHelper: KryoHelper, watchdog: IdleWatchdog, realProtocol: IProtocol) {
val model = this
watchdog.measureTimeForActiveCall(setupUtContext, "UtContext setup") { params ->
// we use parent classloader with null to disable autoload classes from system classloader
// - We use `ClassLoader.getSystemClassLoader().parent` as parent to let
// classes like `javax.sql.DataSource` load from URLs like `jrt:/java.sql`.
// - We do not use `ClassLoader.getSystemClassLoader()` itself to avoid utbot dependencies like Jackson
// being used instead of user's dependencies, which is important, since they may have different versions.
UtContext.setUtContext(UtContext(URLClassLoader(params.classpathForUrlsClassloader.map {
File(it).toURI().toURL()
}.toTypedArray(), null)))
}.toTypedArray(), ClassLoader.getSystemClassLoader().parent)))
}
watchdog.measureTimeForActiveCall(getSpringBeanDefinitions, "Getting Spring bean definitions") { params ->
try {
Expand Down

0 comments on commit 6d50aee

Please sign in to comment.