Hello.
We decide to use the LikeManager in our extensions to provide some new features.
I’m running my extension on an XWiki 12.10.4 using “xwiki-debug-eclipse project”. The dev server run well and like feature from default flavor works well.
In the pom of my extension I have imported
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-like-api</artifactId>
<version>${platform.version}</version>
</dependency>
Then in one of my services I inject the LikeManager
@Inject
private LikeManager likeManager;
So far so good eclipse doesn’t complain I can use it in my code.
But when I start my server I have this stacktrace
Caused by: org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [org.xwiki.like.internal.DefaultLikeManager] identified by type [interface org.xwiki.like.LikeManager] and hint [default]
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:204)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:210)
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)
... 49 common frames omitted
Caused by: java.lang.IllegalArgumentException: An Entity Reference name cannot be null or empty
at org.xwiki.model.reference.EntityReference.setName(EntityReference.java:215)
at org.xwiki.model.reference.EntityReference.<init>(EntityReference.java:187)
at org.xwiki.model.reference.EntityReference.<init>(EntityReference.java:143)
at org.xwiki.model.reference.WikiReference.<init>(WikiReference.java:61)
at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.getCurrentWikiReference(AbstractDocumentConfigurationSource.java:194)
at org.xwiki.like.internal.LikeConfigurationSource.getDocumentReference(LikeConfigurationSource.java:55)
at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.getCacheKeyPrefix(AbstractDocumentConfigurationSource.java:129)
at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.getPropertyValue(AbstractDocumentConfigurationSource.java:339)
at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.getProperty(AbstractDocumentConfigurationSource.java:299)
at org.xwiki.like.internal.DefaultLikeConfiguration.getLikeCacheCapacity(DefaultLikeConfiguration.java:53)
at org.xwiki.like.internal.DefaultLikeManager.initialize(DefaultLikeManager.java:178)
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
Am I missing a configuration to use this LikeManager ? It seems relataed to LikeConfigurationSource
Other question :
Also I had to solve a weird issue with this component on tomcat start, so this works but I don’t know why I had to do this manipulation for this Like component and not the others
the class [Lorg/xwiki/like/LikeManager;] couldn't be found in the ClassLoader
I never had this issue with other component, to fix it I have to manually add the like jar to the class path like in the screenshot bellow. Why I have to do that ? My xwiki-platform is builded on 12.10.4 the package for like api is present xwiki-dev-tolls and xwiki-platform are at the same level.
Thanks