-
Bug
-
Resolution: Not an Issue
-
P3
-
None
Summary: Adding a library to the class path after loading a class that depends on that library does not reload the class.
As a result the return from changing classpath should be a List of events. Should probably only have a setClasspath rather than add.
Reproduction Steps:
- Download akka from http://downloads.typesafe.com/akka/akka_2.11-2.3.12.zip?_ga=1.210377941.1593193379.1436640268
- Run in jshell:
Nikolays-MacBook-Air:bin nbotev$ jshell
| Welcome to JShell -- Version 0.610
| Type /help for help
-> /classpath ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar
| Path ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar added to classpath
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| java.lang.NoClassDefFoundError thrown: com/typesafe/config/ConfigFactory
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at Option.getOrElse (Option.scala:121)
| at ActorSystem$.apply (ActorSystem.scala:141)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| java.lang.NoClassDefFoundError thrown: com/typesafe/config/ConfigFactory
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at Option.getOrElse (Option.scala:121)
| at ActorSystem$.apply (ActorSystem.scala:141)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| java.lang.NoClassDefFoundError thrown: com/typesafe/config/ConfigFactory
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at Option.getOrElse (Option.scala:121)
| at ActorSystem$.apply (ActorSystem.scala:141)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
Workaround:
Load the JAR *before* referencing the class that depends on classes in the JAR, as below:
Nikolays-MacBook-Air:bin nbotev$ jshell
| Welcome to JShell -- Version 0.610
| Type /help for help
-> /classpath ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar
| Path ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar added to classpath
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar added to classpath
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| com.typesafe.config.ConfigException$Missing thrown: No configuration setting found for key 'akka'
| at SimpleConfig.findKey (SimpleConfig.java:124)
| at SimpleConfig.find (SimpleConfig.java:147)
| at SimpleConfig.find (SimpleConfig.java:159)
| at SimpleConfig.find (SimpleConfig.java:164)
| at SimpleConfig.getString (SimpleConfig.java:206)
| at ActorSystem$Settings.<init> (ActorSystem.scala:169)
| at ActorSystemImpl.<init> (ActorSystem.scala:505)
| at ActorSystem$.apply (ActorSystem.scala:142)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
As a result the return from changing classpath should be a List of events. Should probably only have a setClasspath rather than add.
Reproduction Steps:
- Download akka from http://downloads.typesafe.com/akka/akka_2.11-2.3.12.zip?_ga=1.210377941.1593193379.1436640268
- Run in jshell:
Nikolays-MacBook-Air:bin nbotev$ jshell
| Welcome to JShell -- Version 0.610
| Type /help for help
-> /classpath ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar
| Path ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar added to classpath
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| java.lang.NoClassDefFoundError thrown: com/typesafe/config/ConfigFactory
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at Option.getOrElse (Option.scala:121)
| at ActorSystem$.apply (ActorSystem.scala:141)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| java.lang.NoClassDefFoundError thrown: com/typesafe/config/ConfigFactory
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at Option.getOrElse (Option.scala:121)
| at ActorSystem$.apply (ActorSystem.scala:141)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| java.lang.NoClassDefFoundError thrown: com/typesafe/config/ConfigFactory
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at ActorSystem$$anonfun$5.apply (ActorSystem.scala:141)
| at Option.getOrElse (Option.scala:121)
| at ActorSystem$.apply (ActorSystem.scala:141)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
Workaround:
Load the JAR *before* referencing the class that depends on classes in the JAR, as below:
Nikolays-MacBook-Air:bin nbotev$ jshell
| Welcome to JShell -- Version 0.610
| Type /help for help
-> /classpath ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar
| Path ~/Downloads/akka-2.3.12/lib/scala-library-2.11.5.jar added to classpath
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/akka-actor_2.11-2.3.12.jar added to classpath
-> /classpath ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar
| Path ~/Downloads/akka-2.3.12/lib/akka/config-1.2.1.jar added to classpath
-> akka.actor.ActorSystem system = akka.actor.ActorSystem.create("MySystem")
| com.typesafe.config.ConfigException$Missing thrown: No configuration setting found for key 'akka'
| at SimpleConfig.findKey (SimpleConfig.java:124)
| at SimpleConfig.find (SimpleConfig.java:147)
| at SimpleConfig.find (SimpleConfig.java:159)
| at SimpleConfig.find (SimpleConfig.java:164)
| at SimpleConfig.getString (SimpleConfig.java:206)
| at ActorSystem$Settings.<init> (ActorSystem.scala:169)
| at ActorSystemImpl.<init> (ActorSystem.scala:505)
| at ActorSystem$.apply (ActorSystem.scala:142)
| at ActorSystem$.apply (ActorSystem.scala:109)
| at ActorSystem$.create (ActorSystem.scala:57)
| at ActorSystem.create (ActorSystem.scala)
| at (#9:1)
- relates to
-
JDK-8129539 JShell API: setClassPath() -- replace class-path
-
- Closed
-