Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The license is not found anymore after a server restart #17

Closed
mflorea opened this issue Aug 8, 2019 · 1 comment
Assignees
Milestone

Comments

@mflorea
Copy link
Contributor

@mflorea mflorea commented Aug 8, 2019

Steps to reproduce:

  • install the Antivirus Application
  • get a trial license
  • restart the wiki

The trial license we generated is not visible anymore. There's a stack trace when XWiki is initializing:

019-08-02 00:02:49,591 [localhost-startStop-1] WARN  c.x.l.i.DefaultLicenseManager  - Error registering license, license has been skipped. 
org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [org.xwiki.instance.internal.DefaultInstanceIdManager] identified by type [interface org.xwiki.instance.InstanceIdManager] and hint [default]
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:204)
        at org.xwiki.component.embed.GenericProvider.getInstance(GenericProvider.java:111)
        at org.xwiki.component.embed.GenericProvider.get(GenericProvider.java:100)
        at com.xwiki.licensing.internal.DefaultLicenseValidator.isApplicable(DefaultLicenseValidator.java:83)
        at com.xwiki.licensing.internal.DefaultLicenseManager.linkLicenseToLicensedFeature(DefaultLicenseManager.java:194)
        at com.xwiki.licensing.internal.DefaultLicenseManager.initialize(DefaultLicenseManager.java:121)
        at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
        at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
        at org.xwiki.component.embed.EmbeddableComponentManager.getDependencyInstance(EmbeddableComponentManager.java:406)
        at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:355)
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
        at org.xwiki.component.embed.EmbeddableComponentManager.getDependencyInstance(EmbeddableComponentManager.java:406)
        at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:355)
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
        at org.xwiki.observation.internal.DefaultObservationManager.onEventListenerComponentAdded(DefaultObservationManager.java:364)
        at org.xwiki.observation.internal.DefaultObservationManager.onComponentEvent(DefaultObservationManager.java:342)
        at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:288)
        at org.xwiki.component.internal.StackingComponentEventManager.sendEvent(StackingComponentEventManager.java:142)
        at org.xwiki.component.internal.StackingComponentEventManager.flushEvents(StackingComponentEventManager.java:92)
        at org.xwiki.extension.jar.internal.handler.JarExtensionHandler.loadComponents(JarExtensionHandler.java:237)
        at org.xwiki.extension.jar.internal.handler.JarExtensionHandler.install(JarExtensionHandler.java:165)
        at org.xwiki.extension.jar.internal.handler.JarExtensionHandler.initialize(JarExtensionHandler.java:143)
        at org.xwiki.extension.handler.internal.DefaultExtensionHandlerManager.initialize(DefaultExtensionHandlerManager.java:154)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initializeExtensionInNamespace(DefaultExtensionInitializer.java:202)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initializeExtensionInNamespace(DefaultExtensionInitializer.java:161)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initializeExtensionInNamespace(DefaultExtensionInitializer.java:173)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initializeExtensionInNamespace(DefaultExtensionInitializer.java:161)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initializeExtensionInNamespace(DefaultExtensionInitializer.java:189)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initializeExtensionInNamespace(DefaultExtensionInitializer.java:161)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initializeExtension(DefaultExtensionInitializer.java:127)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initialize(DefaultExtensionInitializer.java:105)
        at org.xwiki.extension.handler.internal.DefaultExtensionInitializer.initialize(DefaultExtensionInitializer.java:81)
        at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
        at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:189)
        at org.xwiki.container.servlet.XWikiServletContextListener.contextInitialized(XWikiServletContextListener.java:120)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2038)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: null
        at org.xwiki.instance.internal.DefaultInstanceIdManager.getXWikiContext(DefaultInstanceIdManager.java:151)
        at org.xwiki.instance.internal.DefaultInstanceIdManager.initialize(DefaultInstanceIdManager.java:93)
        at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
        at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)
        at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
        at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
        ... 54 common frames omitted

@mflorea mflorea added this to the 1.2.4 milestone Aug 8, 2019
@mflorea mflorea self-assigned this Aug 8, 2019
@mflorea

This comment has been minimized.

Copy link
Contributor Author

@mflorea mflorea commented Aug 8, 2019

The issue is that the Antivirus Application has an event listener (AttachmentUploadedEventListener) that injects the Licensor directly, and since event listeners are loaded right away, the Licensor is initialized too early. The Licensor needs to be initialized later because it needs the instance ID which is stored in the database and thus it needs to have the database ready. Other components that don't need the database can be loaded with @Inject directly in the event listener, but for the Licensor we need to use the Provider (for lazy loading).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.