Log4j2 SyslogAppender not working - java

I'm using Log4j version 2.1 (the latest stable version) and trying to use a Syslog appender to log to a syslog server. I'm using the configuration given at their official site (http://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender):
<Syslog name="RFC5424" format="RFC5424" host="localhost" port="514"
protocol="UDP" appName="MyApp" includeMDC="true"
facility="LOCAL0" enterpriseNumber="18060" newLine="true"
messageId="Audit" id="App"/>
When I start my app and do a LogManager.getLogger(), I get an error (stack trace bellow), so, before I report an error to their bug tracker, am I doing something wrong?
014-11-17 18:26:23,640 ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.SyslogAppender for element Syslog. java.lang.reflect.InvocationTargetException
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 org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:698)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:426)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:408)
at Log.<clinit>(Log.java:7)
Caused by: java.lang.IllegalArgumentException: No structured id name was supplied
at org.apache.logging.log4j.message.StructuredDataId.<init>(StructuredDataId.java:92)
at org.apache.logging.log4j.core.layout.Rfc5424Layout.<init>(Rfc5424Layout.java:139)
at org.apache.logging.log4j.core.layout.Rfc5424Layout.createLayout(Rfc5424Layout.java:657)
at org.apache.logging.log4j.core.appender.SyslogAppender.createAppender(SyslogAppender.java:133)
... 19 more

You need to include the mdcId attribute. e.g.:
<Syslog name="RFC5424" format="RFC5424" host="localhost" port="514"
protocol="UDP" appName="MyApp" mdcId="mdc" includeMDC="true"
facility="LOCAL0" enterpriseNumber="18060" newLine="true"
messageId="Audit" id="App"/>

Related

Error creating custom log file in Nifi logback

I'm trying to create a custom log file for my flow in Nifi; to achieve that I want to use the logback filters.
In my logback.conf I added a new appender called LLAB_FILE which filters the log message by its content:
<appender name="LLAB_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${org.apache.nifi.bootstrap.config.log.dir}/llab-transform.log</file>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator>
<expression>return message.contains("LLAB_TRANSFORM");</expression>
</evaluator>
<OnMismatch>DENY</OnMismatch>
<OnMatch>ACCEPT</OnMatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${org.apache.nifi.bootstrap.config.log.dir}/llab-transform_%d.%i.log</fileNamePattern>
<maxFileSize>100MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<immediateFlush>true</immediateFlush>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date~%level~%msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="LLAB_FILE"/>
</root>
However this configuration gives the following error when Nifi starts:
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/codehaus/janino/ScriptEvaluator
at ch.qos.logback.core.boolex.JaninoEventEvaluatorBase.start(JaninoEventEvaluatorBase.java:57)
at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:161)
at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
at org.apache.nifi.bootstrap.RunNiFi.<init>(RunNiFi.java:134)
at org.apache.nifi.bootstrap.RunNiFi.main(RunNiFi.java:231)
Caused by: java.lang.ClassNotFoundException: org.codehaus.janino.ScriptEvaluator
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 20 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/janino/ScriptEvaluator
at ch.qos.logback.core.boolex.JaninoEventEvaluatorBase.start(JaninoEventEvaluatorBase.java:57)
at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:161)
at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
at org.apache.nifi.bootstrap.RunNiFi.<init>(RunNiFi.java:134)
at org.apache.nifi.bootstrap.RunNiFi.main(RunNiFi.java:231)
Caused by: java.lang.ClassNotFoundException: org.codehaus.janino.ScriptEvaluator
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
How can I fix this? I don't want to process the logs throw a nifi's flow.
Thanks,
Temp
http://logback.qos.ch/manual/filters.html#JaninoEventEvaluator
JaninoEventEvaluator requires the Janino library.
Please see the corresponding section of the setup document.
actually any evaluator requires additional library

Logstash not reading spring properties correctly

So I have a quite simple logstash configuration that should read the host URL from spring. Although for some reason it is not working.
My logback-spring.xml looks sort of like this:
<springProperty name="logstashDestination" scope="context" source="service.logstash.host"/>
<appender class="net.logstash.logback.appender.LogstashTcpSocketAppender" name="LOGSTASH">
<destination>${logstashDestination}</destination>
<!-- encoder is required -->
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<customFields>{"service":"provisioning-engine-jane"}</customFields>
</encoder>
</appender>
In my application.properties I have these lines:
spring.profiles.active:sit
service.logstash.host:NaN
And in application-sit.properties I have this line:
service.logstash.host:api-test.local:9013
This makes the whole application crash with the error
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.util.PropertySetter#44cb3536 - Could not invoke method addDestination in class net.logstash.logback.appender.LogstashTcpSocketAppender with parameter of type java.lang.String java.lang.reflect.InvocationTargetException
ERROR in net.logstash.logback.appender.LogstashTcpSocketAppender[LOGSTASH] - No destination was configured. Use <destination> to add one or more destinations to the appender
The odd thing here is that if I add a bootstrap.properties file with some dummy data it starts. Issue with this is that the dummy data is overriding my environment specific logstash URL.
Anyone have any idea of why this might be happening?

javax.mail.NoSuchProviderException: when using Liberty 8.5.5.9 with Apache Commons Email 1.4

I've a web application which sending mail. To perform sending mail I use library which itself based on Apache Commons Email 1.4. When I've used Websphere Liberty 8.5.5.7 everything worked fine, but after I've upgraded to 8.5.5.9 it stopped to work and throwing an exception: javax.mail.NoSuchProviderException the full stack trace I posted at the end of the question.
Again, I've tried to run it on both installations of Websphere Liberty 8.5.5.7 and 8.5.5.9, on first one it works fine on second it's broken. I've tried to look what the difference and it looks that Liberty itself has com.ibm.ws.javax.mail-1.5_1.5.xx.jar package which interfere with Java javax-mail-1.5.2 which used by commons-email 1.4, see its pom.xml here.
After some debugging I've paid attention that:
Liberty 8.5.5.9 uses com.ibm.ws.javax.mail-1.5_1.5.12.jar while Liberty 8.5.5.7 uses com.ibm.ws.javax.mail-1.5_1.5.10.jar possible this is caused to my bug.
So, my question is how can I eliminate the influence of com.ibm.ws.javax.mail which comes together with liberty to make it work or is there another workaround?
Also, where can I submit bug report for Liberty Team?
Update:
It looks that Liberty has JavaMail 1.5 feature which can be enabled or disabled, I didn't enable it explicitly, it looks that on of my features enabled it implicitly, this is my features list:
<featureManager>
<feature>jdbc-4.1</feature>
<feature>adminCenter-1.0</feature>
<feature>jndi-1.0</feature>
<feature>localConnector-1.0</feature>
<feature>servlet-3.1</feature>
<feature>ssl-1.0</feature>
<feature>jaxrs-2.0</feature>
<feature>cdi-1.2</feature>
<feature>ejbLite-3.2</feature>
<feature>jsf-2.2</feature>
</featureManager>
Update 2
I've solved this issue by using this article: Overriding a provided API with an alternative version
Just make in your server.xml the following changes:
<application id="" name="Scholar" type="ear" location="scholar.ear">
<classloader delegation="parentLast" />
</application>
And now your libraries will receive higher precedence then Liberty's libraries.
Full stack trace of the exception:
org.apache.commons.mail.EmailException: Sending the email to the following server failed : relay.******.com:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421) ~[commons-email-1.4.jar:1.4]
at org.apache.commons.mail.Email.send(Email.java:1448) ~[commons-email-1.4.jar:1.4]
at my.package.mailer.sendHtmlMail(IBMMail.java:96) ~[classes/:?]
at my.package.mailer.EmailGateway.sendMail(EmailGateway.java:24) [classes/:?]
at my.package.mailer.EventMailGateway.eventCreatedNotification(EventMailGateway.java:52) [classes/:?]
at **********.restful.EventsAPI.saveEvent(EventsAPI.java:99) [classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_45]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.performInvocation(LibertyJaxRsServerFactoryBean.java:636) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.performInvocation(LibertyJaxRsInvoker.java:115) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97) [cxf-core-3.0.3.jar:3.0.3]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:210) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200) [cxf-rt-frontend-jaxrs-3.0.3.jar:3.0.3]
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:381) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) [cxf-rt-frontend-jaxrs-3.0.3.jar:3.0.3]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.0.3.jar:3.0.3]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.0.3.jar:3.0.3]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) [cxf-core-3.0.3.jar:3.0.3]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:124) [com.ibm.ws.jaxrs-2.0.common_1.0.12.jar:3.0.3]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:256) [cxf-rt-transports-http-3.0.3.jar:3.0.3]
at com.ibm.ws.jaxrs20.endpoint.AbstractJaxRsWebEndpoint.invoke(AbstractJaxRsWebEndpoint.java:134) [com.ibm.ws.jaxrs-2.0.common_1.0.12.jar:?]
at com.ibm.websphere.jaxrs.server.IBMRestServlet.handleRequest(IBMRestServlet.java:149) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at com.ibm.websphere.jaxrs.server.IBMRestServlet.doPost(IBMRestServlet.java:107) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [com.ibm.ws.javaee.servlet.3.1_1.0.12.jar:?]
at com.ibm.websphere.jaxrs.server.IBMRestServlet.service(IBMRestServlet.java:99) [com.ibm.ws.jaxrs-2.0.server_1.0.12.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:778) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1161) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:82) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:928) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262) [com.ibm.ws.webcontainer_1.1.12.jar:?]
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:341) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256) [com.ibm.ws.transport.http_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929) [com.ibm.ws.channelfw_1.0.12.jar:?]
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018) [com.ibm.ws.channelfw_1.0.12.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: javax.mail.NoSuchProviderException: smtp
at javax.mail.Session.getService(Session.java:820) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:742) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:682) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:662) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Session.getTransport(Session.java:719) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Transport.send0(Transport.java:248) ~[javax.mail-1.5.2.jar:1.5.2]
at javax.mail.Transport.send(Transport.java:124) ~[javax.mail-1.5.2.jar:1.5.2]
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411) ~[commons-email-1.4.jar:1.4]
... 48 more
I've solved this issue by using this article: Overriding a provided API with an alternative version
Just make in your server.xml the following changes:
<application id="" name="Scholar" type="ear" location="scholar.ear">
<classloader delegation="parentLast" />
</application>
And now your libraries will receive higher precedence then Liberty's libraries.
I hit javax.mail.NoSuchProviderException: smtp after updating from Liberty 8.5.5.8 to 8.5.5.9. Adding <feature>javaMail-1.5</feature> to my server.xml worked for me.

Transitive log4j2 dependency - configuration failing

Im working on a project that has log4j2 as a transitive dependency.
I was having this error
ERROR StatusLogger No log4j2 configuration file found. Using default
configuration: logging only errors to the console.
So I created a new log4j2.xml file under src/main/resources and I tried with the Default Apache's configuration.
Here:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
Now when I build my project this warns (errors) prompts:
2015-02-11 17:02:52,375 WARN JNDI lookup class is not available because this JRE does not support JNDI. JNDI string lookups will not be available, continuing configuration. java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.lookup.JndiLookup to org.apache.logging.log4j.core.lookup.StrLookup
at java.lang.Class.cast(Class.java:3133)
at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:163)
at org.apache.logging.log4j.core.util.Loader.newCheckedInstanceOf(Loader.java:311)
at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:92)
at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:104)
at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:55)
at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:375)
at org.apache.logging.log4j.core.layout.PatternLayout.createDefaultLayout(PatternLayout.java:280)
at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.<init>(ConsoleAppender.java:116)
at org.apache.logging.log4j.core.appender.ConsoleAppender.newBuilder(ConsoleAppender.java:111)
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 org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.createBuilder(PluginBuilder.java:158)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:118)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:698)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:102)
at org.apache.logging.log4j.jcl.LogAdapter.getContext(LogAdapter.java:39)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:40)
at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:55)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
at org.mule.util.IOUtils.<clinit>(IOUtils.java:33)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.getExamplesFile(JavaDocAnnotationVerifier.java:222)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.validateSampleTag(JavaDocAnnotationVerifier.java:199)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.validateMethod(JavaDocAnnotationVerifier.java:143)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.verify(JavaDocAnnotationVerifier.java:74)
at org.mule.devkit.verifiers.SimpleJavaDocAnnotationVerifier.verify(SimpleJavaDocAnnotationVerifier.java:17)
at org.mule.devkit.apt.AbstractAnnotationProcessor.doVerify(AbstractAnnotationProcessor.java:462)
at org.mule.devkit.apt.AbstractAnnotationProcessor.verifyModule(AbstractAnnotationProcessor.java:307)
at org.mule.devkit.apt.AbstractAnnotationProcessor.runVerifiers(AbstractAnnotationProcessor.java:185)
at org.mule.devkit.apt.AbstractAnnotationProcessor.doProcess(AbstractAnnotationProcessor.java:413)
at org.mule.devkit.apt.AbstractAnnotationProcessor.process(AbstractAnnotationProcessor.java:140)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
at com.sun.tools.javac.main.Main.compile(Main.java:439)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
at org.mule.devkit.maven.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:231)
at org.mule.devkit.maven.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:149)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
2015-02-11 17:02:52,379 WARN JMX runtime input lookup class is not available because this JRE does not support JMX. JMX lookups will not be available, continuing configuration. java.lang.ClassCastException: Cannot cast org.apache.logging.log4j.core.lookup.JmxRuntimeInputArgumentsLookup to org.apache.logging.log4j.core.lookup.StrLookup
at java.lang.Class.cast(Class.java:3133)
at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(LoaderUtil.java:163)
at org.apache.logging.log4j.core.util.Loader.newCheckedInstanceOf(Loader.java:311)
at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:103)
at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:104)
at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:55)
at org.apache.logging.log4j.core.layout.PatternLayout$Builder.build(PatternLayout.java:375)
at org.apache.logging.log4j.core.layout.PatternLayout.createDefaultLayout(PatternLayout.java:280)
at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.<init>(ConsoleAppender.java:116)
at org.apache.logging.log4j.core.appender.ConsoleAppender.newBuilder(ConsoleAppender.java:111)
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 org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.createBuilder(PluginBuilder.java:158)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:118)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:698)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:102)
at org.apache.logging.log4j.jcl.LogAdapter.getContext(LogAdapter.java:39)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:40)
at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:55)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
at org.mule.util.IOUtils.<clinit>(IOUtils.java:33)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.getExamplesFile(JavaDocAnnotationVerifier.java:222)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.validateSampleTag(JavaDocAnnotationVerifier.java:199)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.validateMethod(JavaDocAnnotationVerifier.java:143)
at org.mule.devkit.generation.javadoc.JavaDocAnnotationVerifier.verify(JavaDocAnnotationVerifier.java:74)
at org.mule.devkit.verifiers.SimpleJavaDocAnnotationVerifier.verify(SimpleJavaDocAnnotationVerifier.java:17)
at org.mule.devkit.apt.AbstractAnnotationProcessor.doVerify(AbstractAnnotationProcessor.java:462)
at org.mule.devkit.apt.AbstractAnnotationProcessor.verifyModule(AbstractAnnotationProcessor.java:307)
at org.mule.devkit.apt.AbstractAnnotationProcessor.runVerifiers(AbstractAnnotationProcessor.java:185)
at org.mule.devkit.apt.AbstractAnnotationProcessor.doProcess(AbstractAnnotationProcessor.java:413)
at org.mule.devkit.apt.AbstractAnnotationProcessor.process(AbstractAnnotationProcessor.java:140)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
at com.sun.tools.javac.main.Main.compile(Main.java:439)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
at org.mule.devkit.maven.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:231)
at org.mule.devkit.maven.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:149)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Currently dependency versions:
What could be causing this?
Thanks in advance.
Juan c:
This is not a problem. The Interpolator class is trying to enable various kinds of lookups: for example env:propertyName lookups for environment variables, sys:propertyName for Java system properties, jndi:propertyName for JNDI properties, etc.
If JNDI is not available you will see this warning. Configuration will continue after this message is logged.
You can raise a request on the log4j2 Jira issue tracker to make this look less like an error (with hindsight the stack trace is confusing and unnecessary here).
Perhaps the project also loads another log4j2 configuration somewhere that depends on the JMX properties. You can get more information about what Log4j is doing by enabling DEBUG or TRACE status on your config file like shown here
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG" name="example-config">
</Configuration>
Also try setting the default StatusLogger for Log4j to DEBUG by passing in a system property when running the application:
java -DLog4jDefaultStatusLevel=DEBUG MyApp
Also, are you sure that there are no 1.2 dependencies in the classpath? If there are, they might conflict with the 1.2-2.1 bridge.

Hazelcast on Glassfish as an OSGI bundle

Good day. I have some difficulties using the Hazelcast in Glassfish OSGi environment.
I have an OSGi bundle, which provides some EJBs and intended to be deployed on glassfish. This bundle uses Hazelcast and imports some hazelcast packages. I don't want to embed hazelcast jar so I tried to deploy it in Glassfish prior to deploying the subj. bundle.
$ asadmin deploy --type=osgi minimal-json-0.9.1.jar
$ asadmin deploy --type=osgi hazelcast-3.3.3.jar
Hazelcast deployed successfully. But when I deploy my bundle, and when one of the EJBs from this bundle tries to create a HazelcastInstance, I get the following exception:
org.glassfish.osgijavaeebase.DeploymentException: Deployment of xxx.xxx.platon-cache [398] failed because of following reason: Failed while deploying bundle xxx.xxx.platon-cache [398] : java.lang.RuntimeException: Failed to deploy bundle [ xxx.xxx.platon-cache [398] ], root cause: Exception while loading the app
at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:127)
at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:109)
at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:153)
at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:150)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Failed to deploy bundle [ xxx.xxx.platon-cache [398] ], root cause: Exception while loading the app
at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:198)
at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:120)
at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:123)
... 9 more
Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton HazelcastService
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:656)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:396)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:185)
... 11 more
Caused by: javax.ejb.CreateException: Initialization failed for Singleton HazelcastService
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:483)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:81)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:654)
... 22 more
Caused by: java.lang.IllegalArgumentException: PortableFactory[-17] is already registered! com.hazelcast.concurrent.atomiclong.client.AtomicLongPortableHook$1#682d1719 -> com.hazelcast.concurrent.atomiclong.client.AtomicLongPortableHook$1#68479fbd
at com.hazelcast.nio.serialization.PortableHookLoader.register(PortableHookLoader.java:84)
at com.hazelcast.nio.serialization.PortableHookLoader.load(PortableHookLoader.java:51)
at com.hazelcast.nio.serialization.PortableHookLoader.<init>(PortableHookLoader.java:41)
at com.hazelcast.nio.serialization.SerializationServiceImpl.<init>(SerializationServiceImpl.java:119)
at com.hazelcast.nio.serialization.SerializationServiceBuilder.build(SerializationServiceBuilder.java:175)
at com.hazelcast.instance.Node.createSerializationService(Node.java:195)
at com.hazelcast.instance.Node.<init>(Node.java:142)
at com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:120)
at com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:153)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:136)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:112)
at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:58)
at xxx.xxx.platon.cache.HazelcastService.init(HazelcastService.java:18)
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.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1035)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
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.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
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.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:412)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:375)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:1949)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:475)
... 24 more
]]
The hazelcast instance is created in the only place, so there shouldn't be any conflicts with some other hazelcast cluster. Everything works correctly in non-osgi environment.
The hazelcast config is the simpliest one:
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.1.xsd" xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>dev</name>
<password>dev-pass</password>
</group>
<network>
<port auto-increment="true" port-count="100">5701</port>
<outbound-ports>
<ports>0</ports>
</outbound-ports>
<join>
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
<tcp-ip enabled="true">
<interface>127.0.0.1</interface>
</tcp-ip>
</join>
</network>
</hazelcast>
What is the reason of this exception?
it smells very much like this issue: https://github.com/hazelcast/hazelcast/issues/3922.
Can you please try it with the latest Hazelcast 3.3.4-SNAPSHOT? It should be fixed there.
EDIT: This workaround is not needed anymore; Latest releases of both 3.3 and 3.4 branches include this fix.

Categories