I noticed that today, too. From the looks of it, I don't think any of those
warnings are a big deal. They're just indicating that those scanned plugins
can't be used because they depend on optional dependencies. This is
actually part of why I support using a more modular architecture over an
optional class-based approach like we have now. In such a modular
architecture, you'd only use the JARs containing the plugins you want
(which should speed up plugin search).

tl;dr: those warning messages look harmless and might be better off placed
in the INFO level. That, or we could maintain a list of optional class
names related to the optional plugins that we can filter for in those log
messages for more information (e.g., log that certain plugins can't be
loaded due to missing dependencies and an informative message on how to
handle that).

WARNING: OSGi rambling and brainstorming below!

Then again, in an OSGi bundle interface for log4j-core (e.g.,
log4j-core-bundle or even just use log4j-osgi as the location for this
code), we could scan over the annotated classes (@Plugin and such),
generate a plugins.dat (or use an existing OSGi file format like the XML
one for declarative services; it looks rather compatible with our existing
plugin architecture) for each bundle, and then the OSGi bundle that
integrates them all (core bundle, not the API) can just load those XML
files and use OSGi's declarative services management to load log4j plugins
as necessary.


On 23 March 2014 16:55, Remko Popma <[email protected]> wrote:

> If I run a simple HelloWorld log test program, with a log4j2.xml config
> that has
> <Configuration status="warn">
>
> then I get _a lot_ of warnings (see below).
> They seem to be generated by ResolverUtil#addIfMatching when loading
> plugins.
> Just wondering: has this always been the case, or is this caused by a
> recent change?
>
> C:\Users\remko\workspace\log4j-perf\bin>java -cp
> .;..\lib\log4j-api-2.0-rc2-SNAPSHOT.jar;..\lib\log4j-core-2.0-rc2-SNAPSHOT.jar;..\lib\disruptor-3.2.0.jar
> LOG4J2_537.HelloWorld
> 2014-03-24 06:48:31,491 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,493 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverter$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> com/fasterxml/jackson/core/type/TypeReference
> 2014-03-24 06:48:31,494 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,496 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,498 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> com/fasterxml/jackson/core/type/TypeReference
> 2014-03-24 06:48:31,499 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,500 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/LevelAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,502 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,503 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,505 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverter.class'
> due toa java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,506 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,512 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/nosql/mongodb/MongoDBConnection$1.class'
> due to a java.lang.NoClassDefFoundError with message: org/bson/Transformer
> 2014-03-24 06:48:31,626 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/AbstractJMSReceiver.class' due to a
> java.lang.NoClassDefFoundError withmessage: javax/jms/MessageListener
> 2014-03-24 06:48:31,634 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/JMSQueueReceiver.class' due to a
> java.lang.NoClassDefFoundError with message: javax/jms/MessageListener
> 2014-03-24 06:48:31,638 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/JMSTopicReceiver.class' due to a
> java.lang.NoClassDefFoundError with message: javax/jms/MessageListener
> 2014-03-24 06:48:31,644 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/SMTPManager$SMTPManagerFactory$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/mail/Authenticator
> 2014-03-24 06:48:31,669 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/servlet/ServletContainerInitializer
> 2014-03-24 06:48:31,670 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletContextListener.class' due
> to a java.lang.NoClassDefFoundError with message:
> javax/servlet/ServletContextListener
> 2014-03-24 06:48:31,671 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletFilter.class' due to a
> java.lang.NoClassDefFoundError with message: javax/servlet/Filter
> 2014-03-24 06:48:31,686 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,687 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverter$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> com/fasterxml/jackson/core/type/TypeReference
> 2014-03-24 06:48:31,689 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,690 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,691 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> com/fasterxml/jackson/core/type/TypeReference
> 2014-03-24 06:48:31,693 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,694 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/LevelAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,695 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,697 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,698 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverter.class'
> due toa java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,700 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,704 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/nosql/mongodb/MongoDBConnection$1.class'
> due to a java.lang.NoClassDefFoundError with message: org/bson/Transformer
> 2014-03-24 06:48:31,741 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/AbstractJMSReceiver.class' due to a
> java.lang.NoClassDefFoundError withmessage: javax/jms/MessageListener
> 2014-03-24 06:48:31,744 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/JMSQueueReceiver.class' due to a
> java.lang.NoClassDefFoundError with message: javax/jms/MessageListener
> 2014-03-24 06:48:31,747 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/JMSTopicReceiver.class' due to a
> java.lang.NoClassDefFoundError with message: javax/jms/MessageListener
> 2014-03-24 06:48:31,749 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/SMTPManager$SMTPManagerFactory$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/mail/Authenticator
> 2014-03-24 06:48:31,759 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/servlet/ServletContainerInitializer
> 2014-03-24 06:48:31,761 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletContextListener.class' due
> to a java.lang.NoClassDefFoundError with message:
> javax/servlet/ServletContextListener
> 2014-03-24 06:48:31,763 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletFilter.class' due to a
> java.lang.NoClassDefFoundError with message: javax/servlet/Filter
> 2014-03-24 06:48:31,789 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,790 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverter$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> com/fasterxml/jackson/core/type/TypeReference
> 2014-03-24 06:48:31,792 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,794 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,796 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> com/fasterxml/jackson/core/type/TypeReference
> 2014-03-24 06:48:31,798 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,800 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/LevelAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,801 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,803 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,804 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverter.class'
> due toa java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,805 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverter.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/persistence/AttributeConverter
> 2014-03-24 06:48:31,808 WARN Could not examine class
> 'org/apache/logging/log4j/core/appender/db/nosql/mongodb/MongoDBConnection$1.class'
> due to a java.lang.NoClassDefFoundError with message: org/bson/Transformer
> 2014-03-24 06:48:31,840 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/AbstractJMSReceiver.class' due to a
> java.lang.NoClassDefFoundError withmessage: javax/jms/MessageListener
> 2014-03-24 06:48:31,843 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/JMSQueueReceiver.class' due to a
> java.lang.NoClassDefFoundError with message: javax/jms/MessageListener
> 2014-03-24 06:48:31,845 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/JMSTopicReceiver.class' due to a
> java.lang.NoClassDefFoundError with message: javax/jms/MessageListener
> 2014-03-24 06:48:31,849 WARN Could not examine class
> 'org/apache/logging/log4j/core/net/SMTPManager$SMTPManagerFactory$1.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/mail/Authenticator
> 2014-03-24 06:48:31,865 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletContainerInitializer.class'
> due to a java.lang.NoClassDefFoundError with message:
> javax/servlet/ServletContainerInitializer
> 2014-03-24 06:48:31,866 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletContextListener.class' due
> to a java.lang.NoClassDefFoundError with message:
> javax/servlet/ServletContextListener
> 2014-03-24 06:48:31,868 WARN Could not examine class
> 'org/apache/logging/log4j/core/web/Log4jServletFilter.class' due to a
> java.lang.NoClassDefFoundError with message: javax/servlet/Filter
> 06:48:31.945 INFO  LOG4J2_537.HelloWorld 28 main - Hello, World!
> C:\Users\remko\workspace\log4j-perf\bin>
>



-- 
Matt Sicker <[email protected]>

Reply via email to