webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Log4j2 async logging using disruptor 3.x

    Posted Fri September 25, 2020 11:46 AM

    Hi,
    I’m trying to implement log4j2 async logging by using async loggers and disruptor.
    I placed disruptor jar file under package/code/jars. But its not able to find it when I run my java service and throws below error. Can anyone please suggest.
    INFO | jvm 1 | 2020/09/25 00:18:32 | 2020-09-25 00:18:32,449 Log4j2-TF-27-ConfiguratonFileWatcher-13 ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.async.AsyncLoggerConfig for element AsyncLogger: java.lang.NoClassDefFoundError: com/lmax/disruptor/EventFactory java.lang.reflect.InvocationTargetException
    INFO | jvm 1 | 2020/09/25 00:18:32 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at java.lang.reflect.Method.invoke(Method.java:498)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:964)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:904)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:896)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:548)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:672)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.ConfiguratonFileWatcher$ReconfigurationRunnable.run(ConfiguratonFileWatcher.java:68)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at java.lang.Thread.run(Thread.java:748)
    INFO | jvm 1 | 2020/09/25 00:18:32 | Caused by: java.lang.NoClassDefFoundError: com/lmax/disruptor/EventFactory
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.getAsyncLoggerConfigDelegate(AbstractConfiguration.java:203)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.async.AsyncLoggerConfig.(AsyncLoggerConfig.java:91)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.async.AsyncLoggerConfig.createLogger(AsyncLoggerConfig.java:273)
    INFO | jvm 1 | 2020/09/25 00:18:32 | … 15 more
    INFO | jvm 1 | 2020/09/25 00:18:32 | Caused by: java.lang.ClassNotFoundException: com.lmax.disruptor.EventFactory cannot be found by org.apache.logging.log4j.core_2.11.2
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:511)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:414)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:153)
    INFO | jvm 1 | 2020/09/25 00:18:32 | at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    INFO | jvm 1 | 2020/09/25 00:18:32 | … 18 more
    INFO | jvm 1 | 2020/09/25 00:18:32 |


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Log4j2 async logging using disruptor 3.x

    Posted Thu October 15, 2020 09:42 AM

    Hi Manasa,

    was the package reloaded after placing the jar?

    Stopping and restarting the IS should do the trick, too.

    Regards,
    Holger


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 3.  RE: Log4j2 async logging using disruptor 3.x

    Posted Mon October 19, 2020 01:08 PM

    Thank you for the reply.Yes I have reloaded and restarted the server also. But not sure why is it unable to find the jars.
    Other than adding them under code/jars. I also added them in Build path.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 4.  RE: Log4j2 async logging using disruptor 3.x

    Posted Mon October 19, 2020 01:18 PM

    Hi Manasa,

    can you share some more details about your config, please?
    Is this also reported in the server.log of the IS or only in wrapper.log?

    Eventually you will have to update your osgi bundle config to add the new jars/bundles there.

    Regards,
    Holger


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 5.  RE: Log4j2 async logging using disruptor 3.x

    Posted Fri October 23, 2020 01:45 AM

    Hi Holger,

    Attached is the log4j config file I’m using.
    A bit of Java code as follows:
    Logger logger = LogManager.getLogger(“com.apple.b2b.appleIDLLog4j2.logging”);
    logger.info(“write anything”);

    It’s reported only in wrapper.log.log4j2.xml (1.3 KB)


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods