Skip to content

faq 75268105

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

Guice throwing "Unable to create injector" exception when running Pt scenario

by Ramon Iglesias on 2016-07-27 22:34:47


Hi,

I'm trying to run a PT scenario based on this TU Berlin tutorial, but when I run the scenario I get an injection error (copied below at the end of the message). I'm running MATSim 0.8.0, but 0.7.0 throws the same errors as well. 

I can't seem to find any reference to this error in the web, any ideas of how to get past it?

 

Thank you,

Ramon

Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:

 1) No implementation for org.matsim.core.router.RoutingModule annotated with @com.google.inject.name.Named(value=walk) was bound.
   at org.matsim.core.router.TripRouterModule.install(TripRouterModule.java:65) (via modules: com.google.inject.util.Modules$CombinedModule -> com.google.inject.util.Modules$CombinedModule -> org.matsim.core.controler.AbstractModule$4 -> com.google.inject.util.Modules$OverrideModule -> org.matsim.core.controler.Controler$1 -> org.matsim.core.controler.ControlerDefaultsModule -> org.matsim.core.router.TripRouterModule)

 1 error
 	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
 	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
 	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
 	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:226)
 	at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:233)
 	at org.matsim.core.controler.Injector.createInjector(Injector.java:63)
 	at org.matsim.core.controler.Controler.run(Controler.java:177)
 	at RunSimulation.main(RunSimulation.java:54)

Comments: 1


Re: Guice throwing "Unable to create injector" exception when running Pt scenario

by Kai Nagel on 2016-07-29 13:07:35

Dear Ramon,

I just tried and it is working for me, both with the HEAD version and with 0.8.x.  

So I can only guess.  Did you maybe add "walk" trips into your plans file?  Then you need to specify a walk router. If you are using config_v2, the syntax for the "teleportation" router roughly is

	<module name="planscalcroute" >
 		<parameterset type="teleportedModeParameters" >
 			<param name="beelineDistanceFactor" value="1.3" />
 			<param name="mode" value="walk" />

 			<!-- Speed for a teleported mode. Travel time = (<beeline distance> * beelineDistanceFactor) / teleportedModeSpeed. Insert a line like this for every such mode. -->
 			<param name="teleportedModeSpeed" value="0.8333333333333333" />
 		</parameterset>
         ...

Does this fix it?  If not, could you please deposit your full log file and if possible a runnable scenario somewhere and let us know?

Best, Kai

Clone this wiki locally