static service locator configuration

350 views
Skip to first unread message

Martin Naughton

unread,
Jul 12, 2016, 4:54:28 PM7/12/16
to Lagom Framework Users
Hey Guys,
               I am trying to work with lagom to get a simple production microservice going. I created the helloworld project and remove the hello stream project and renamed the helloworld project to quiz project. Just to see where everything has be defined through failing.

I am still finding out how to my own service locator but for now I am happy to do the static locator option. I looked at the documentation and followed it but having some problems.
http://www.lagomframework.com/documentation/1.0.x/java/Overview.html#deploying-using-static-service-locations

I turned off conductR service locator.
//#service-locator-disabled
lagomServiceLocatorEnabled
in ThisBuild := false
//#service-locator-disabled

added this line and its imports to the module for the service quiz. I want the service locator to work in dev so i do not have the if statement to check if its production
bind(ServiceLocator.class).to(ConfigurationServiceLocator.class);


When the application starts cassandra complains about the service locator not being bound. That stops the whole application working. I have the impl project dependent on persistence instead of api so that is not the issue.


[warn] c.l.l.i.p.c.ServiceLocatorSessionProvider - Could not find Cassandra contact points, due to: ServiceLocator is not bound
[warn] c.l.l.i.p.c.ServiceLocatorSessionProvider - Could not find Cassandra contact points, due to: ServiceLocator is not bound
[warn] c.l.l.i.p.c.ServiceLocatorSessionProvider - Could not find Cassandra contact points, due to: ServiceLocator is not bound[error] a.c.s.PersistentShardCoordinator - Persistence failure when replaying events for persistenceId [/sharding/JugQuizEntityCoordinator]. Last known sequence number [0]
java
.lang.IllegalStateException: ServiceLocator is not bound
    at com
.lightbend.lagom.internal.persistence.cassandra.ServiceLocatorSessionProvider.com$lightbend$lagom$internal$persistence$cassandra$ServiceLocatorSessionProvider$$tryAgain$1(ServiceLocatorSessionProvider.scala:52) ~[lagom-javadsl-persistence_2.11-1.0.0-RC1.jar:1.0.0-RC1]
    at com
.lightbend.lagom.internal.persistence.cassandra.ServiceLocatorSessionProvider$$anonfun$com$lightbend$lagom$internal$persistence$cassandra$ServiceLocatorSessionProvider$$tryAgain$1$1.apply$mcV$sp(ServiceLocatorSessionProvider.scala:58) ~[lagom-javadsl-persistence_2.11-1.0.0-RC1.jar:1.0.0-RC1]
    at akka
.actor.Scheduler$$anon$4.run(Scheduler.scala:122) ~[akka-actor_2.11-2.4.4.jar:na]
    at akka
.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39) ~[akka-actor_2.11-2.4.4.jar:na]
    at java
.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_91]
    at java
.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_91]
    at java
.lang.Thread.run(Thread.java:745) ~[na:1.8.0_91]


The application does not work with this configuration. even if I have dummy service in the application.conf. I just wanted to see if where this information would turn up in the application. is this the information that will appear in the output of http://localhost:8000/services  ??  Is service A the actually name of the service that you can inject in?

8 lagom.services {
 
9       serviceA = "http://10.1.2.3:8080"
 
10       serviceB = "http://10.1.2.4:8080"
 
11 }


I am still experimenting with lagom. I will update the docs if i can get this solved. Write it from a beginner perspective.

thanks.

Martin Naughton

unread,
Jul 13, 2016, 3:46:17 AM7/13/16
to Lagom Framework Users
actually disregard the question about lagom services bit. After sleeping on it i just realized it is the services your own service relies on and how it can find them. Also the name of the service is in the api project and declared with the named method. So hellostream would rely on helloservice in the helloworld demo if you wanted to setup static service locations.

example locally
lagom.services{
helloservice = "http://0.0.0.0:24266"
}


The cassandra bit is still confusing how to fix it.
Reply all
Reply to author
Forward
0 new messages