question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missed dependency? java.lang.IllegalStateException: It appears there is no ServiceLocatorGenerator installed

See original GitHub issue

I’ve upgraded from Dropwizard 0.8 to 1.0.2. Running my unit tests, I’m seeing this error. Is there a dependency I should be including that Dropwizard doesn’t get transitively?

java.lang.RuntimeException: java.lang.ClassNotFoundException: Provider org.glassfish.jersey.internal.RuntimeDelegateImpl could not be instantiated: java.lang.IllegalStateException: It appears there is no ServiceLocatorGenerator installed.

    at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:152)
    at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120)
    at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:95)
    at javax.ws.rs.core.UriBuilder.fromPath(UriBuilder.java:148)
    at com.kessel.SmokeTest.testFetch(CustomerConfigHubRepositoryTest.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: Provider org.glassfish.jersey.internal.RuntimeDelegateImpl could not be instantiated: java.lang.IllegalStateException: It appears there is no ServiceLocatorGenerator installed.
    at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:122)
    at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:225)
    at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:135)
    ... 31 more
Caused by: java.lang.IllegalStateException: It appears there is no ServiceLocatorGenerator installed.
    at com.squarespace.jersey2.guice.GuiceServiceLocatorGeneratorStub.create(GuiceServiceLocatorGeneratorStub.java:50)
    at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:312)
    at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:293)
    at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:138)
    at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:109)
    at org.glassfish.jersey.internal.RuntimeDelegateImpl.<init>(RuntimeDelegateImpl.java:63)
    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:423)
    at java.lang.Class.newInstance(Class.java:442)
    at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:118)
    ... 33 more

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

31reactions
andrewaylettcommented, Sep 4, 2017

Calling into JerseyGuiceUtils before running tests can also help. We added a static block to each affected test file, which is painful but effective:

static {
    JerseyGuiceUtils.install((s, serviceLocator) -> null);
}
1reaction
GrumpyDBAcommented, Jul 4, 2018

Try this: JerseyGuiceUtils.reset(); Literally just had what looks like the exact same issue in the test I was looking at.

I can’t comment as to the reasons why it fixed it, or indeed if it is a better or worse solution than @andrewaylett’s ( I’d probably use his in future though)

Read more comments on GitHub >

github_iconTop Results From Across the Web

No ServiceLocatorGenerator installed Error while Running ...
RuntimeDelegateImpl could not be instantiated: java.lang.IllegalStateException: It appears there is no ServiceLocatorGenerator installed. at ...
Read more >
Missed dependency? java.lang.IllegalStateException
Missed dependency ? java.lang.IllegalStateException: It appears there is no ServiceLocatorGenerator installed.
Read more >
Antwort: Re: jax-rs-whiteboard with jersey-Apache Mail Archives
RuntimeDelegateImpl could not be instantiated: java.lang.IllegalStateException: No generator was provided and there is no default generator registered from: ...
Read more >
Workbench.java « internal « ui « eclipse « org «
ServiceLocatorCreator ; import org.eclipse.ui.internal.services.SourceProviderService ... auto-saving the workbench model, there were no top-level windows.
Read more >
HP Asset Manager - Release Notes - Support
HP shall not be liable for technical or editorial errors or omissions contained herein. ... Make sure that you have Java 7 or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found