Hi,
I’m trying to test Payara MQTT Cloud connector following documentation and subscribe messages from external MQTT server, but I get this error:
INFO: No resource-adapter-mid specified, defaulting to the resource-adapter [ mqtt-rar-1.0.0 ] that supports the requested message-listener [ fish.payara.cloud.connectors.mqtt.api.MQTTListener ]
SEVERE: Exception during lifecycle processing
java.lang.NoClassDefFoundError: Could not initialize class org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl
code:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = “topicFilter”, propertyValue = “test”) ,
@ActivationConfigProperty(propertyName = “automaticReconnect”, propertyValue = “true”),
@ActivationConfigProperty(propertyName = “serverURIs”, propertyValue = “tcp://broker.hivemq.com:1883”)
})
public class MQTTReceiveMessage implements MQTTListener {
@OnMQTTMessage
public void messageArrived(String topic, MqttMessage message) {
Logger.getAnonymousLogger().info("Received message on topic " + topic + " " + new String(message.getPayload()));
}
}
Who can help me to get it work?
my env:
OpenJDK 64-Bit Server VM Zulu17.42+19-CA (build 17.0.7+7-LTS, mixed mode, sharing)
Netbeans 18 + Payara 6.2023.7 full ed.
Deployed adapter: mqtt-rar-1.0.0
ok update to this problem - using adapter mqtt-rar-0.8.0 and Payara 5.2022.5 everything works as expected
full error with Payara 6.2023.8:
SEVERE: Exception during lifecycle processing
java.lang.ExceptionInInitializerError
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper$PackageContext.<init>(Wrapper.java:477)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper$Environment._clear(Wrapper.java:693)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper$Environment.<init>(Wrapper.java:688)
at java.base/java.lang.ThreadLocal$SuppliedThreadLocal.initialValue(ThreadLocal.java:305)
at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195)
at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper.env(Wrapper.java:886)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper._clear(Wrapper.java:1142)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:242)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:286)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:104)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:218)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:334)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:580)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:570)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:552)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/javax.security.auth.Subject.doAs(Subject.java:376)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:551)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:582)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:574)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/javax.security.auth.Subject.doAs(Subject.java:376)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:573)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1497)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1879)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1755)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:604)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:256)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:150)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:174)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:153)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:196)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private static java.lang.ClassLoader java.io.ObjectInputStream.latestUserDefinedLoader() accessible: module java.base does not "opens java.io" to unnamed module @75f2851b
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at org.glassfish.pfl.basic.reflection.Bridge$1.run(Bridge.java:90)
at org.glassfish.pfl.basic.reflection.Bridge$1.run(Bridge.java:82)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at org.glassfish.pfl.basic.reflection.Bridge.getLatestUserDefinedLoaderMethod(Bridge.java:81)
at org.glassfish.pfl.basic.reflection.Bridge.<init>(Bridge.java:129)
at org.glassfish.pfl.basic.reflection.Bridge.get(Bridge.java:154)
at org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl$1.run(ClassCopierOrdinaryImpl.java:58)
at org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl$1.run(ClassCopierOrdinaryImpl.java:55)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl.<clinit>(ClassCopierOrdinaryImpl.java:54)
... 49 more
SEVERE: Exception while loading the app
SEVERE: Exception while loading the app
java.lang.reflect.InaccessibleObjectException: Unable to make private static java.lang.ClassLoader java.io.ObjectInputStream.latestUserDefinedLoader() accessible: module java.base does not "opens java.io" to unnamed module @75f2851b
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at org.glassfish.pfl.basic.reflection.Bridge$1.run(Bridge.java:90)
at org.glassfish.pfl.basic.reflection.Bridge$1.run(Bridge.java:82)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at org.glassfish.pfl.basic.reflection.Bridge.getLatestUserDefinedLoaderMethod(Bridge.java:81)
at org.glassfish.pfl.basic.reflection.Bridge.<init>(Bridge.java:129)
at org.glassfish.pfl.basic.reflection.Bridge.get(Bridge.java:154)
at org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl$1.run(ClassCopierOrdinaryImpl.java:58)
at org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl$1.run(ClassCopierOrdinaryImpl.java:55)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at org.glassfish.pfl.dynamic.copyobject.impl.ClassCopierOrdinaryImpl.<clinit>(ClassCopierOrdinaryImpl.java:54)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper$PackageContext.<init>(Wrapper.java:477)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper$Environment._clear(Wrapper.java:693)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper$Environment.<init>(Wrapper.java:688)
at java.base/java.lang.ThreadLocal$SuppliedThreadLocal.initialValue(ThreadLocal.java:305)
at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195)
at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper.env(Wrapper.java:886)
at org.glassfish.pfl.dynamic.codegen.spi.Wrapper._clear(Wrapper.java:1142)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:242)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:286)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:104)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:218)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:334)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:580)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:570)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:552)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/javax.security.auth.Subject.doAs(Subject.java:376)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:551)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:582)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:574)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/javax.security.auth.Subject.doAs(Subject.java:376)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:573)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1497)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1879)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1755)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:604)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:256)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:150)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:174)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:153)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:196)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515)
at java.base/java.lang.Thread.run(Thread.java:833)
WARNING: Cannot invoke "Object.getClass()" because "resource" is null
In Payara 6.2023.10 it started to work