]
Sebastian Łaskawiec commented on ISPN-5193:
-------------------------------------------
Unfortunately there's no perfect solution in this scenario...
The main problem here are duplicated classes (class X is available in the Uber Jar and in
the module or other Jar). Even if we decided not to relocate JBoss Logging we would
probably get a {{ClassCastException}} at some point (because the root problem remains the
same). The situation gets even worse when you consider CDI as the spec clearly says that
in case of duplicated classes, non portable behavior might occur.
You are also right about the workaround. The suggested solution is to use small jars
instead.
I will look into this but I'm afraid there's not much we can do (apart from
telling our users that they should not mix Uber Jars with Small Jars).
infinispan-embedded and infinispan-cli-interpreter don't work
together
----------------------------------------------------------------------
Key: ISPN-5193
URL:
https://issues.jboss.org/browse/ISPN-5193
Project: Infinispan
Issue Type: Bug
Components: CLI
Affects Versions: 7.1.0.CR2, 8.0.0.Beta2
Reporter: Jakub Markos
Assignee: Sebastian Łaskawiec
Creating a java application (no container) with both infinispan-embedded and
infinispan-cli-interpreter dependencies results in this error when starting a cache
manager:
{code}Exception in thread "main" java.util.ServiceConfigurationError:
org.infinispan.lifecycle.ModuleLifecycle: Provider
org.infinispan.cli.interpreter.LifecycleCallbacks could not be instantiated:
java.lang.ExceptionInInitializerError
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at org.infinispan.commons.util.ServiceFinder.addServices(ServiceFinder.java:60)
at org.infinispan.commons.util.ServiceFinder.load(ServiceFinder.java:42)
at
org.infinispan.util.ModuleProperties.resolveModuleLifecycles(ModuleProperties.java:41)
at
org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:94)
at
org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:292)
at
org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:271)
at
org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:244)
at
org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:231)
at Main64.main(Main64.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 15 more
Caused by: java.lang.IllegalArgumentException: Logger implementation class
org.infinispan.cli.interpreter.logging.Log_$logger has no matching constructor
at infinispan.org.jboss.logging.Logger.getMessageLogger(Logger.java:2255)
at infinispan.org.jboss.logging.Logger.getMessageLogger(Logger.java:2211)
at org.infinispan.util.logging.LogFactory.getLog(LogFactory.java:21)
at
org.infinispan.cli.interpreter.LifecycleCallbacks.<clinit>(LifecycleCallbacks.java:20)
... 21 more
{code}
Tried with 7.1.0.CR2, config:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:infinispan:config:7.1">
<cache-container default-cache="localcache">
<local-cache name="localcache"/>
</cache-container>
</infinispan>
{code}
application:
{code}
public static void main(String[] args) throws Exception {
EmbeddedCacheManager manager = new DefaultCacheManager("config.xml");
Cache defaultCache = manager.getCache("localcache");
for (int i = 0; i < 10; i++) {
defaultCache.put("key"+i, "value"+i);
}
Thread.sleep(5000000);
}
{code}
Using infinispan-core dependency instead of infinispan-embedded works.