I'm trying to configure a global serializer for Hazelcast 3.12 (My application runs on payara 5 which comes bundled with this version of Hazelcast so I cannot update to 4.x)
According to the manual (https://docs.hazelcast.org/docs/3.12/manual/html-single/index.html#global-serializer) implementing and configuring a global serializer should be simple, here is my Serializer:
public class MyGlobalStreamSerializer implements StreamSerializer<Object> {
private static FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
#Override
public int getTypeId() {
return 123;
}
#Override
public void destroy() {
}
#Override
public void write(ObjectDataOutput objectDataOutput, Object o) throws IOException {
objectDataOutput.write(conf.asByteArray(o));
}
#Override
public Object read(ObjectDataInput objectDataInput) throws IOException {
return conf.asObject(objectDataInput.readByteArray());
}
}
I'm using fast-serialization for the actual serialization implementation:
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>2.57</version>
</dependency>
And the serialization configuration in my hazelcast-config.xml
<serialization>
<portable-version>0</portable-version>
<serializers>
<global-serializer override-java-serialization="true" >de.mycompany.myapp.domain.MyGlobalStreamSerializer</global-serializer>
</serializers>
</serialization>
however at application startup I get a NullPointerException when the configuration is built:
[2020-10-20T12:37:14.348+0200] [Payara 5.2020] [SEVERE] [NCLS-CORE-00014] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1603190234348] [levelValue: 1000] [[
Shutdown required
MultiException stack 1 of 1
MultiException stack 1 of 4
java.lang.NullPointerException
at fish.payara.nucleus.hazelcast.HazelcastCore.buildConfiguration(HazelcastCore.java:333)
at fish.payara.nucleus.hazelcast.HazelcastCore.bootstrapHazelcast(HazelcastCore.java:480)
at fish.payara.nucleus.hazelcast.HazelcastCore.getInstance(HazelcastCore.java:234)
at fish.payara.nucleus.config.ClusteredConfig.postConstruct(ClusteredConfig.java:99)
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.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1268)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:309)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:351)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:679)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:54)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:188)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:211)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:334)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
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:821)
MultiException stack 2 of 4
java.lang.IllegalStateException: Unable to perform operation: post construct on fish.payara.nucleus.config.ClusteredConfig
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:369)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:679)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:54)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:188)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:211)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:334)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
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:821)
MultiException stack 3 of 4
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of fish.payara.nucleus.requesttracing.RequestTracingService errors were found
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:224)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:334)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
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:821)
MultiException stack 4 of 4
java.lang.IllegalStateException: Unable to perform operation: resolve on fish.payara.nucleus.requesttracing.RequestTracingService
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:363)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:463)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:281)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:65)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2102)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:67)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1213)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1144)
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:821)
]]
Omitting the package / using just the class name as value for global-serializer in the configuration as seen in the manual didn't work either, my last attempt was with the full path because that's how it's done in the hazelcast-full-example.xml that comes with the release.
I also saw another post here where someone was trying to implement a global serializer using Kryo as implementation for the actual serialization, the code and config looked pretty much the same but he didn't seem to have my problem (Hazelcast with global serializer (Kryo) - There is no suitable de-serializer for type)
Can anyone tell me what I'm doing wrong? Thanks in advance!
Payara Server uses its own serializer which can't be disabled, see the docs: https://docs.payara.fish/community/docs/5.2020.5/documentation/payara-server/hazelcast/configuration.html. The Payara serializer delegates to a Hazelcast global serializer which is specified in the Hazelcast config. This serialized should be in the Payara Server's classpath, it's not enough to add it to your application.
Try adding a JAR file with MyGlobalStreamSerializer and all its dependencies (e.g. the fst JAR and its dependencies) to the lib directory in your domain directory, this will add it to the server's classpath. Here's the docs on the asadmin add-library command, which you can use: https://docs.payara.fish/community/docs/5.2020.5/documentation/payara-server/asadmin-commands/misc-commands.html#add-library-command.
In your case, it seems that the exception is thrown when Payara Server wants to log a message that your global serializer is not a subclass of StreamSesrializer which the Payara serializer expects: https://github.com/payara/Payara/blob/master/nucleus/payara-modules/hazelcast-bootstrap/src/main/java/fish/payara/nucleus/hazelcast/HazelcastCore.java#L333
That code hasn't changed in any version of Payara Server 5.2020.x and the only way it can throw a NullPointerException is if the global serializer is null. I expect this happens because Hazelcast can't find the class of your serializer and returns null for the serializer.
Related
I am running an ActiveMQ Artemis 2.16.0 server to which I developed a custom login module to authenticate against my own authorization server. It worked perfectly so far.
Now that I have upgraded to 2.17.0 and 2.18.0 I am getting following exception:
WARN [org.apache.activemq.artemis.core.server] AMQ222216: Security problem while authenticating: AMQ229031: Unable to validate user from /127.0.0.1:61432. Username: technical; SSL certificate subject DN: unavailable
My login.config file looks like this:
activemq {
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule sufficient
debug=false
reload=true
org.apache.activemq.jaas.properties.user="artemis-users.properties"
org.apache.activemq.jaas.properties.role="artemis-roles.properties";
com.dallmeier.asa.security.artemis.MyLoginModule sufficient
logEnabled=true
authUrl="http://localhost:5561/auth"
onSuccessRole="amq"
cacheDurationMinutes="3"
cacheSize="10000";
};
The plugin implements javax.security.auth.spi.LoginModule. It initializes a Singleton instance of a class ValidationSupplier. This executes simple http requests and caches the user for 5 minutes with:
com.google.common.cache.Cache;
com.google.common.cache.CacheBuilder;
It looks like it is something with the cache. Why it is a problem? When I am not using it it works.
public class CachingAdapter {
private Cache<String, IAuthPrincipal> tokenCache;
private ValidationSupplier coreSupplier;
public CachingAdapter (long cacheDurationMinutes, long cacheSize, ValidationSupplier coreSupplier) {
this.tokenCache = CacheBuilder.newBuilder().maximumSize(cacheSize)
.expireAfterWrite(cacheDurationMinutes, TimeUnit.MINUTES).build();
this.coreSupplier = coreSupplier;
}
public IAuthPrincipal validate(String username, String password) throws Exception {
return this.tokenCache.get(username, () -> coreSupplier.validate(username, password));
}
}
DEBUG [org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager] Couldn't validate user: javax.security.auth.login.LoginException: java.lang.NoClassDefFoundError: com/google/common/util/concurrent/internal/InternalFutureFailureAccess
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.google.common.cache.LocalCache$LoadingValueReference.<init>(LocalCache.java:3472)
at com.google.common.cache.LocalCache$LoadingValueReference.<init>(LocalCache.java:3476)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2134)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4848)
ActiveMQ Artemis 2.17 has updated the guava version from 24.1.1-jre to 30.1-jre. Using guava version 30.1-jre to build the custom login module, should fix the issue.
Caching for authentication and authorization data was added in 2.16.0. Therefore, it's not clear why your login module would need its own caching. I'm not sure why you're getting the java.lang.NoClassDefFoundError, but this answer might help.
In any case, I recommend you remove your caching mechanism and simply use the broker's caching. You can read more about configuration for this caching in the documentation.
Currently working on a module with gRPC/gNMI + Kotlin with Ktor HTTP.
Stucked with the secured dependency library tc-native netty-tcnative-boringssl-static 2.0.19-Final
Ktor is in 1.0.0-beta3
// ktor
implementation "io.ktor:ktor-server-core:${ktor_version}"
implementation "io.ktor:ktor-server-netty:${ktor_version}"
implementation "io.ktor:ktor-html-builder:${ktor_version}"
implementation "io.ktor:ktor-gson:${ktor_version}"
implementation "io.ktor:ktor-metrics:${ktor_version}"
implementation "io.ktor:ktor-locations:${ktor_version}"
implementation "ch.qos.logback:logback-classic:${logback_version}"
// tpl
implementation "io.ktor:ktor-freemarker:${ktor_version}"
implementation "org.freemarker:freemarker:${freemarker_version}"
// Security
//implementation "io.netty:netty-tcnative:${netty_tcnative_version}"
implementation "io.netty:netty-tcnative-boringssl-static:${netty_tcnative_version}".
When using gRPC request
fun Route.routeFilesystem() {
get("/test") {
call.respondHtml {
head {
title { +"gRPC/gNMI" }
}
body {
p {
+"[ Capabilities Test ] "
TLSConnection("xxx.xxx.xxx.xxx",8448).capabilities()
}
}
}
}
it gives the following error (stacktrace):
[DEBUG] 2018-11-09 16:50:36.789 [nettyCallPool-4-4] DEBUG i.n.u.internal.NativeLibraryLoader - netty_tcnative_linux_x86_64 cannot be loaded from java.libary.path, now trying export to -Dio.netty.native.workdir: /tmp
java.lang.UnsatisfiedLinkError: no netty_tcnative_linux_x86_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:440)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:97)
at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:244)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:120)
at sdn.client.cli.console.TLSConnection.<init>(TLSConnection.kt:38)
at sdn.client.ui.ApplicationKt$routeFilesystem$1$1$2$1.invoke(Application.kt:125)
at sdn.client.ui.ApplicationKt$routeFilesystem$1$1$2$1.invoke(Application.kt)
at kotlinx.html.ApiKt.visit(api.kt:80)
at kotlinx.html.Gen_tag_groupsKt.p(gen-tag-groups.kt:125)
at kotlinx.html.Gen_tag_groupsKt.p$default(gen-tag-groups.kt:125)
at .sdn.client.ui.ApplicationKt$routeFilesystem$1$1$2.invoke(Application.kt:123)
at .sdn.client.ui.ApplicationKt$routeFilesystem$1$1$2.invoke(Application.kt)
at kotlinx.html.ApiKt.visit(api.kt:80)
at kotlinx.html.Gen_tags_hKt.body(gen-tags-h.kt:164)
at kotlinx.html.Gen_tags_hKt.body$default(gen-tags-h.kt:164)
at .sdn.client.ui.ApplicationKt$routeFilesystem$1$1.invoke(Application.kt:122)
at sdn.client.ui.ApplicationKt$routeFilesystem$1$1.invoke(Application.kt)
at kotlinx.html.ApiKt.visit(api.kt:80)
at kotlinx.html.ApiKt.visitAndFinalize(api.kt:93)
at kotlinx.html.Gen_consumer_tagsKt.html(gen-consumer-tags.kt:317)
at kotlinx.html.Gen_consumer_tagsKt.html$default(gen-consumer-tags.kt:317)
at io.ktor.html.HtmlContent.writeTo(RespondHtml.kt:32)
at io.ktor.server.engine.BaseApplicationResponse$respondWriteChannelContent$2.invokeSuspend(BaseApplicationResponse.kt:155)
at io.ktor.server.engine.BaseApplicationResponse$respondWriteChannelContent$2.invoke(BaseApplicationResponse.kt)
at io.ktor.util.cio.ReadersKt.use(Readers.kt:33)
at io.ktor.server.engine.BaseApplicationResponse.respondWriteChannelContent$suspendImpl(BaseApplicationResponse.kt:149)
at io.ktor.server.engine.BaseApplicationResponse.respondWriteChannelContent(BaseApplicationResponse.kt)
at io.ktor.server.engine.BaseApplicationResponse.respondOutgoingContent$suspendImpl(BaseApplicationResponse.kt:119)
at io.ktor.server.engine.BaseApplicationResponse.respondOutgoingContent(BaseApplicationResponse.kt)
at io.ktor.server.netty.NettyApplicationResponse.respondOutgoingContent$suspendImpl(NettyApplicationResponse.kt:37)
at io.ktor.server.netty.NettyApplicationResponse.respondOutgoingContent(NettyApplicationResponse.kt)
at io.ktor.server.engine.BaseApplicationResponse$$special$$inlined$apply$lambda$1.invokeSuspend(BaseApplicationResponse.kt:36)
at io.ktor.server.engine.BaseApplicationResponse$$special$$inlined$apply$lambda$1.invoke(BaseApplicationResponse.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.PipelineContext.proceedWith(PipelineContext.kt:39)
at io.ktor.server.engine.DefaultTransformKt$installDefaultTransformations$1.invokeSuspend(DefaultTransform.kt:26)
at io.ktor.server.engine.DefaultTransformKt$installDefaultTransformations$1.invoke(DefaultTransform.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.html.RespondHtmlKt.respondHtml(RespondHtml.kt:37)
at io.ktor.html.RespondHtmlKt.respondHtml$default(RespondHtml.kt:15)
at sdn.client.ui.ApplicationKt$routeFilesystem$1.invokeSuspend(Application.kt:116)
at .sdn.client.ui.ApplicationKt$routeFilesystem$1.invoke(Application.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.routing.Routing.executeResult(Routing.kt:110)
at io.ktor.routing.Routing.interceptor(Routing.kt:29)
at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:75)
at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.features.ContentNegotiation$Feature$install$1.invokeSuspend(ContentNegotiation.kt:60)
at io.ktor.features.ContentNegotiation$Feature$install$1.invoke(ContentNegotiation.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.features.StatusPages$intercept$3.invokeSuspend(StatusPages.kt:88)
at io.ktor.features.StatusPages$intercept$3.invoke(StatusPages.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:82)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:162)
at io.ktor.features.StatusPages.intercept(StatusPages.kt:87)
at io.ktor.features.StatusPages$Feature$install$1.invokeSuspend(StatusPages.kt:121)
at io.ktor.features.StatusPages$Feature$install$1.invoke(StatusPages.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.features.CallLogging$Feature$install$2.invokeSuspend(CallLogging.kt:124)
at io.ktor.features.CallLogging$Feature$install$2.invoke(CallLogging.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:80)
at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:31)
at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:54)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:160)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:22)
at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:16)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38)
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:353)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:464)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Suppressed: java.lang.UnsatisfiedLinkError: no netty_tcnative_linux_x86_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
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 io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
at java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
... 90 common frames omitted
Please any idea to solve the problem ?
Thanks
See https://github.com/netty/netty-tcnative/issues/331
It's a DEBUG level print, which indicates it may not be an actual error, just something netty tried and failed to load. Loading the boringssl .so possibly succeeded later on.
I am trying to implement liquibase in my JEE8 application using liquibase-cdi.
Liquibase starts up, runs all migrations successfully, but then throws the following exception, which causes the deploy to fail.
Payara 5.182.RC5 Exception:
16:05:10.263 [main] DEBUG liquibase.executor.jvm.JdbcExecutor - Release Database Lock
16:05:10.265 [main] DEBUG liquibase.executor.jvm.JdbcExecutor - UPDATE PUBLIC.DATABASECHANGELOGLOCK SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
16:05:10.266 [main] INFO liquibase.lockservice.StandardLockService - Successfully released change log lock
2018-06-12T16:05:10.286+0200] [] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1528812310286] [levelValue: 1000] [[
Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-000049: Unable to invoke public void liquibase.integration.cdi.CDILiquibase.onStartup() on liquibase.integration.cdi.CDILiquibase#5f0b2fe1 -- WELD-000049: Unable to invoke public void liquibase.integration.cdi.CDILiquibase.onStartup() on liquibase.integration.cdi.CDILiquibase#5f0b2fe1
at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:38)
at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:499)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93)
at org.glassfish.weld.WeldDeployer.processApplicationLoaded(WeldDeployer.java:511)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:422)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:333)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:496)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)
at fish.payara.micro.impl.PayaraMicroImpl.deployAll(PayaraMicroImpl.java:1553)
at fish.payara.micro.impl.PayaraMicroImpl.bootStrap(PayaraMicroImpl.java:1036)
at fish.payara.micro.impl.PayaraMicroImpl.main(PayaraMicroImpl.java:199)
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 fish.payara.micro.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:107)
at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:70)
at fish.payara.micro.boot.PayaraMicroLauncher.main(PayaraMicroLauncher.java:79)
at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:397)
]]
[2018-06-12T16:05:10.287+0200] [] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1528812310287] [levelValue: 1000] Exception while loading the app
[2018-06-12T16:05:10.293+0200] [] [SEVERE] [AS-WEB-GLUE-00192] [javax.enterprise.web] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1528812310293] [levelValue: 1000] Undeployment failed for context
My CDI class:
#Dependent
public class LiquibaseCdiIntegration {
#Resource
private DataSource myDataSource;
#Produces
#LiquibaseType
public CDILiquibaseConfig createConfig() {
CDILiquibaseConfig config = new CDILiquibaseConfig();
config.setChangeLog("liquibase/changelog.xml");
return config;
}
#Produces
#LiquibaseType
public DataSource createDataSource() throws SQLException {
return myDataSource;
}
#Produces
#LiquibaseType
public ResourceAccessor create() {
return new ClassLoaderResourceAccessor(getClass().getClassLoader());
}
}
From my pom.xml:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-cdi</artifactId>
<version>3.6.1</version>
</dependency>
Since my changelog.xml runs successfully, I won't paste it here.
EDIT: (Might be relevant)
When trying to deploy to Payara Micro 5.181 the following error happens:
[2018-06-12T16:20:16.355+0200] [] [WARN] [] [org.jboss.weld.Validator] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1528813216355] [levelValue: 900] WELD-001473: javax.enterprise.inject.spi.Bean implementation liquibase.integration.cdi.CDIBootstrap$1#1798c749 declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (#SessionScoped, #ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
No valid EE environment for injection of liquibase.integration.cdi.CDILiquibase
No valid EE environment for injection of de.ccsys.sns.monitoring.config.LiquibaseCdiIntegration
No valid EE environment for injection of de.ccsys.sns.monitoring.config.LiquibaseCdiIntegration
No valid EE environment for injection of de.ccsys.sns.monitoring.config.LiquibaseCdiIntegration
16:20:16.615 [main] INFO liquibase.integration.cdi.CDILiquibase - Booting Liquibase 3.6.1
[2018-06-12T16:20:16.736+0200] [] [WARNING] [NCLS-CORE-00069] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1528813216736] [levelValue: 900] [[
Exception while dispatching an event
org.glassfish.api.invocation.InvocationException
at org.glassfish.api.invocation.InvocationManagerImpl.postInvoke(InvocationManagerImpl.java:178)
at org.glassfish.weld.WeldDeployer.processApplicationLoaded(WeldDeployer.java:522)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:426)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:333)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:493)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:512)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:134)
at fish.payara.micro.impl.PayaraMicroImpl.deployAll(PayaraMicroImpl.java:1531)
at fish.payara.micro.impl.PayaraMicroImpl.bootStrap(PayaraMicroImpl.java:1019)
at fish.payara.micro.impl.PayaraMicroImpl.main(PayaraMicroImpl.java:201)
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 fish.payara.micro.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:107)
at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:70)
at fish.payara.micro.boot.PayaraMicroLauncher.main(PayaraMicroLauncher.java:79)
at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:383)
]]
Can someone point me in the right direction here?
I also had to deal with this issue. Similar configuration Java EE8, Payara 5.183, and using Liquibase 3.6.1.
The issue is related to how WELD (CDI) is wrapping the exception thrown by Liquibase during the execution of the database scripts. The explicit message for the error cause is not been printed in the logs, but it is usually related to an error on the instructions of the liquibase changeset.
In my case, I was adding a primary key but I had forgotten to put the constraint name. Once I fixed that, it started working.
If any one is getting the same error, please start by checking the instructions in the changeset.
The above answer is based on Liquibase-CDI fails to deploy after successful run, reported by owner of this question (who already mentioned his problem is fixed). But it's worthy to detail the cause and possible aproaches to fix it, for other people with the same problem.
I have a cluster with 2 nodes. Then I tried to run the CacheJdbcStoreExample in apache-ignite-fabric-2.1.0-bin/examples.But I got following exception:
visor> [06:51:41,113][SEVERE][tcp-disco-msg-worker-#13%null%][TcpDiscoverySpi] Failed to unmarshal discovery custom message.
class org.apache.ignite.IgniteCheckedException: Failed to find class with given class loader for unmarshalling (make sure same versions of all classes are available on all nodes or enable pee
r-class-loading) [clsLdr=sun.misc.Launcher$AppClassLoader#4aa4ceeb, cls=org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcStoreExample$1] at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:124)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:94)
at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:143)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9733)
at org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage.message(TcpDiscoveryCustomEventMessage.java:81)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.notifyDiscoveryListener(ServerImpl.java:5436)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processCustomMessage(ServerImpl.java:5321)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2629)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2420)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$MessageWorkerAdapter.body(ServerImpl.java:6576)
at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.body(ServerImpl.java:2506)
at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
Caused by: java.lang.ClassNotFoundException: org.apache.ignite.examples.datagrid.store.jdbc.CacheJdbcStoreExample$1
at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8465)
at org.apache.ignite.marshaller.jdk.JdkMarshallerObjectInputStream.resolveClass(JdkMarshallerObjectInputStream.java:54)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1817)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1982)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1917)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1527)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:420)
at java.util.ArrayList.readObject(ArrayList.java:771)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2118)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2227)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2151)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2009)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1533)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:420)
at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:121)
... 12 more
I decompiled CacheJdbcStoreExample$1.class and got following code:
CacheJdbcStoreExample$1
package org.apache.ignite.examples.datagrid.store.jdbc;
import javax.cache.configuration.Factory;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
import org.h2.jdbcx.JdbcConnectionPool;
class CacheJdbcStoreExample$1
implements Factory<CacheStoreSessionListener>
{
public CacheStoreSessionListener create()
{
CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
lsnr.setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
return lsnr;
}
}
SO I think there is something wrong at row 90 in CacheJdbcStoreExample source code:
// Configure JDBC session listener.
cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
#Override public CacheStoreSessionListener create() {
CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
lsnr.setDataSource(JdbcConnectionPool.create("jdbc:h2:tcp://localhost/mem:ExampleDb", "sa", ""));
return lsnr;
}
});
If I run the example on only one node not a cluster, it's OK.
What should I do to fix it?
The problem is that you configured a cache with a factory of CacheStoreSessionListener-s, but this factory is not visible from other nodes as they don't have it in their classpath.
You should start additional remote nodes with org.apache.ignite.examples.ExampleNodeStartup class from examples module or add examples module to the classpath of other nodes.
I am writing a CDI custom scope that is added via an extension:
public class SliceScopeExtension
implements Extension, Serializable {
public void addScope(#Observes final BeforeBeanDiscovery event) {
event.addScope(SliceScoped.class, true, true);
}
public void registerContext(#Observes final AfterBeanDiscovery event) {
event.addContext(new SliceScopeContext());
}
}
The corresponding context class uses a custom bean store implementation that is derived from org.jboss.weld.context.beanstore.AttributeBeanStore:
public class SliceScopeContext implements Context, Serializable {
private static final Logger log = Logger.getLogger(SliceScopeContext.class.getName());
private final ThreadLocal<HttpServletRequest> request;
private final ThreadLocal<SliceScopeBeanStore> beanStore;
public SliceScopeContext() {
this.request = new ThreadLocal<>();
this.beanStore = new ThreadLocal<>();
}
...
}
If I now deploy this web application glassfish/weld are throwing a org.jboss.weld.resources.spi.ResourceLoadingException with a nested NoClassDefFoundError saying that the class org/jboss/weld/context/beanstore/AttributeBeanStore could not be found. If I use the NamingScheme interface or SimpleNamingScheme the error is thrown for these class names:
org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class my.package.SliceScopeContext
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:179)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:188)
at org.jboss.weld.bootstrap.BeanDeployer.loadAnnotatedType(BeanDeployer.java:122)
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:100)
at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:159)
at org.jboss.weld.bootstrap.BeanDeployment.createClasses(BeanDeployment.java:214)
at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:470)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:211)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: org/jboss/weld/context/beanstore/AttributeBeanStore
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:1183)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1728)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.FieldRepository.getGenericType(FieldRepository.java:85)
at java.lang.reflect.Field.getGenericType(Field.java:236)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedField.of(BackedAnnotatedField.java:28)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.computeValue(BackedAnnotatedType.java:178)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.computeValue(BackedAnnotatedType.java:171)
at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:154)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.<init>(BackedAnnotatedType.java:171)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedFields.<init>(BackedAnnotatedType.java:171)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:65)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:47)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:85)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:82)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:358)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:396)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:174)
... 43 more
Caused by: java.lang.ClassNotFoundException: org.jboss.weld.context.beanstore.AttributeBeanStore
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
... 76 more
I verified if these classes are present in the weld-osgi-bundle.jar inside the glassfish modules directory and they are. This SO post I have checked and my project does not include any library that already contains these WELD classes.
What's going or what am I doing wrong here?
Opening weld-osgi-bundle.jar you can see that in META-INF/MANIFEST.MF file, the Export-Package section doesn't mention org.jboss.weld.context.beanstore; package, so it is private to weld.
You probably have to create your own context by copying this weld code or by using Apache Deltaspike and the tools in org.apache.deltaspike.core.util.context to create a portable context across Weld and OpenWebBeans.
The last (dirty) solution would be to modify the MANIFEST.MF file in weld-osgi-bundle.jar