instead of expecting classes to be at a certain location, ask the class loader where to put them
alternative: default or configure, where the default is the one above
Problem
gradle run
↓
vlingo/actors: Generating proxy for main: github.dled.demo.Greeter
vlingo/actors: Generating proxy for test: github.dled.demo.Greeter
playground: Actor instantiation failed because: Actor proxy github.dled.demo.Greeter not created for main or test: Actor proxy github.dled.demo.Greeter not created because: Cannot generate proxy class for github.dled.demo.Greeter because there is no corresponding:
target/test-classes/github/dled/demo/Greeter.class
java.lang.IllegalArgumentException: Actor proxy github.dled.demo.Greeter not created for main or test: Actor proxy github.dled.demo.Greeter not created because: Cannot generate proxy class for github.dled.demo.Greeter because there is no corresponding:
target/test-classes/github/dled/demo/Greeter.class
at io.vlingo.actors.ActorProxy.tryGenerateCreate(ActorProxy.java:72)
at io.vlingo.actors.ActorProxy.createFor(ActorProxy.java:36)
at io.vlingo.actors.Stage.actorProxyFor(Stage.java:96)
at io.vlingo.actors.Actor.selfAs(Actor.java:105)
at github.dled.demo.ConsoleGreeter.<init>(ConsoleGreeter.java:15)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at io.vlingo.actors.ActorFactory.actorFor(ActorFactory.java:39)
at io.vlingo.actors.Stage.createRawActor(Stage.java:262)
at io.vlingo.actors.Stage.actorFor(Stage.java:184)
at io.vlingo.actors.Stage.actorFor(Stage.java:166)
at io.vlingo.actors.Stage.actorFor(Stage.java:30)
at io.vlingo.actors.World.actorFor(World.java:51)
at github.dled.demo.App.main(App.java:14)
Caused by: java.lang.IllegalArgumentException: Actor proxy github.dled.demo.Greeter not created because: Cannot generate proxy class for github.dled.demo.Greeter because there is no corresponding:
target/test-classes/github/dled/demo/Greeter.class
at io.vlingo.actors.ActorProxy.tryGenerateCreate(ActorProxy.java:89)
at io.vlingo.actors.ActorProxy.tryGenerateCreate(ActorProxy.java:70)
... 16 more
Caused by: java.lang.IllegalArgumentException: Cannot generate proxy class for github.dled.demo.Greeter because there is no corresponding:
target/test-classes/github/dled/demo/Greeter.class
at io.vlingo.actors.ProxyGenerator.generateFor(ProxyGenerator.java:86)
at io.vlingo.actors.ActorProxy.tryGenerateCreate(ActorProxy.java:84)
... 17 more
java.lang.IllegalArgumentException: Actor instantiation failed because: Actor proxy github.dled.demo.Greeter not created for main or test: Actor proxy github.dled.demo.Greeter not created because: Cannot generate proxy class for github.dled.demo.Greeter because there is no corresponding:
playground: vlingo/actors: FAILED: Actor instantiation failed because: Actor proxy github.dled.demo.Greeter not created for main or test: Actor proxy github.dled.demo.Greeter not created because: Cannot generate proxy class for github.dled.demo.Greeter because there is no corresponding:
target/test-classes/github/dled/demo/Greeter.class
at io.vlingo.actors.Stage.createRawActor(Stage.java:266)
at io.vlingo.actors.Stage.actorFor(Stage.java:184)
The exception hints at a location where class files are expected: target/test-classes/github/dled/demo/Greeter.class, which seems to be a maven convention, but it can't be expected in the general case. The implementation is here: DynaFile.java
if (targetClassesRelativePathToClass.exists()) { //sure, class doesn't exist
try {
//...
} else {
throw new IllegalArgumentException("Cannot generate proxy class for " + actorProtocol + " because there is no corresponding:\n" + relativePathToClassFile);
}
Solution proposal
https://github.com/vlingo/vlingo-actors/compare/auto_class_location#diff-71e561a2af5d9976ff569d6912379978R72
Problem
gradle run
↓
The exception hints at a location where class files are expected:
target/test-classes/github/dled/demo/Greeter.class
, which seems to be a maven convention, but it can't be expected in the general case. The implementation is here: DynaFile.javafiles are there in this case:
pre-creating the directories didn't help (in case the files could not be written).
Line: