Error A Org.apache.log4j.consoleappender Object Is Not Assignable To A
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company error the class "org.apache.log4j.appender" was loaded by Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs could not instantiate appender named Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, could not instantiate appender named "console" just like you, helping each other. Join them; it only takes a minute: Sign up log4j:ERROR A “org.apache.log4j.ConsoleAppender” object is not assignable to a “org.apache.log4j.Appender” variable up vote 10 down vote favorite 1 I am making a log4j.properties example web app using gradle. I used log4j in this app. When I build the project I am getting error... log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable. log4j:ERROR The class "org.apache.log4j.Appender" was loaded by log4j:ERROR [org.powermock.core.classloader.MockClassLoader@16a40b2] whereas object of type log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [sun.misc.Launcher$AppClassLoader@5e3a78ad]. log4j:ERROR Could not instantiate appender named "stdout". I still did not find a good answer. And I forgot to say, My project build correctly and show log massages correctly. It doesn't work only on test classes. java exception logging log4j gradle share|improve this question edited Jan 16 '14 at 4:58 asked Jan 13 '14 at 11:58 kasunsk 7331720 The ConsoleAppender class is somehow getting loaded by a classloader from PowerMock and not correctly linked to the base Appender type. –chrylis Jan 13 '14 at 12:06 add a comment| 3 Answers 3 active oldest votes up vote 7 down vote accepted Adding this annotation works for me. @PowerMockIgnore("org.apache.log4j.*") share|improve this answer answered Oct 2 '14 at 15:13 ToYonos 6,13721428 add a comment| up vote 3 down vote Your classpath contains 2 copies of log4j library. Exclude one and try again. share|improve this answer answered Jan 13 '14 at 12:24 artplastika 1,5702827 I just have used log4j-1.2.17 , slf4j-log4j12-1.7.5 with slf4j-api-1.7.5. And slf4j is facade. –kasunsk Jan 16 '14 at 4:38 add a comment| up vote 3 down vote There is a Clear answer here. :D When we have a final method and slf4j loggers in our classes. We have to use powermock in our test class. Because of this we have to use @MockPolicy(Slf4jMockPolicy.class) with particuler imports at the test class which we used Powermock. share|improve this answer edited Jan 17 '14 at 6:20 answered Jan 16 '14 at 11:53 kasunsk 733
Search Forums Home » Liferay Portal » English » 1. Installation / Deployment / Setup Recent Posts Statistics RSS (Opens New Window) Answer (Unmark) Mark as an Answer Threads [ Previous | Next ] Temporary solution for the log4j classloader ERROR for Liferay plugins Frank Yu May 3, 2010 5:49 PM http://stackoverflow.com/questions/21090735/log4jerror-a-org-apache-log4j-consoleappender-object-is-not-assignable-to-a RE: Temporary solution for the log4j classloader ERROR for Liferay plugins Firas BD November 11, 2011 6:41 AM RE: Temporary solution for the log4j classloader ERROR for Liferay plugins Jose Jimenez March 26, 2015 6:21 AM Temporary solution for the https://web.liferay.com/community/forums/-/message_boards/message/4922841 log4j classloader ERROR for Liferay plugins May 3, 2010 5:49 PM Answer Frank Yu Rank: New Member Posts: 14 Join Date: June 30, 2008 Recent Posts Portlets such as solr-web-5.2.7.1.war don't have log4j.jar, logging.properties, and log4j.properties packaged in the war file.When the portlet is hot deployed in Liferay, however, the above three files are added by Liferay to the following folders:tomcat-6.0.18\webapps\solr-web\WEB-INF\classes\log4j.propertiestomcat-6.0.18\webapps\solr-web\WEB-INF\classes\logging.propertiestomcat-6.0.18\webapps\solr-web\WEB-INF\lib\log4j.jarBecause the portlets and Liferay core use two different classloaders (WebappClassLoader and StandardClassLoader), you will see the following error message in Tomcat console:log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.log4j:ERROR The class "org.apache.log4j.Appender" was loaded bylog4j:ERROR [WebappClassLoader delegate: false repositories: /WEB-INF/classes/----------> Parent Classloader:org.apache.catalina.loader.StandardClassLoader@1ac1fe4] whereas object of typelog4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [WebappClassLoader delegate: false
is not assignable to a "org.apache.log4j.Appender"10-1Atle PrangeJul 01, 2016I am developing https://developer.jboss.org/thread/198505 a plugin. When i use mvn package to "hot-reload" the plugin i get could not the following messages in the console: My plugin does not depend on log4j, nor does it seem to pull in any transitive dependencies of log4j: (all dependencies to could not instantiate log4j are provided, and are pulled in by atlassian-plugin) Checking org.apache.logging.log4j: which are the only two maven dependencies i can image contain the org.apache.log4j.Appender.I do not understand why the classloader for my plugin loads the log4j classes at all, since i am not using log4j in my code. Am i missing something? confluenceconfluence-developmentCommentCommentAdd your comment...Sign up or log in to answerWatchRelated questions Powered by Atlassian Confluence 5.7.3, Team Collaboration Software Printed by Atlassian Confluence 5.7.3, Team Collaboration Software. Report a bug Atlassian News Atlassian
not work correctly without it enabled. Please turn JavaScript back on and reload this page. All Places > JBoss AS > Installation, Configuration & Deployment > Discussions Please enter a title. You can not post a blank message. Please type your message and try again. 2 Replies Latest reply on Jun 28, 2012 11:02 AM by António Ribeiro Log4j configuration rajasekharba Apr 17, 2012 3:31 PM Hi,I have added following appender to the jboss-log4j.xml and calling logger like below and getting error message. No log4j.jar included in code or libararyError message : 15:15:30,000 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.15:15:30,000 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by15:15:30,000 ERROR [STDERR] log4j:ERROR [BaseClassLoader@1116f9{vfszip:/C:/jboss-eap-5.1/jboss-as/server/default/deploy/abc.ear/}] whereas object of type15:15:30,000 ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.bootstrap.NoAnnotationURLClassLoader@19616c7].15:15:30,000 ERROR [STDERR] log4j:ERROR Could not instantiate appender named "FILE".Jboss-log4j.xml - appender-------------------------------------