[ http://jira.codehaus.org/browse/MOJO-489?page=comments#action_82088 ] Anagnostopoulos Kostis commented on MOJO-489: ---------------------------------------------
Here is a *better description and solution* of the problem: When using a library which has a transitive dependency to log4j, the commons-logging of hibernate thinks that is should use it, and logs into non-existent log4j categories (due to hibernate's log messages). The solution would be to include a 'commons-logging.properties' file into the classpath having just the single property below, as described here: http://jakarta.apache.org/commons/logging/guide.html#Configuration {code} org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger {code} > [maven-hibernate3-plugin] Plugin does not include log4j into its dependencies > ----------------------------------------------------------------------------- > > Key: MOJO-489 > URL: http://jira.codehaus.org/browse/MOJO-489 > Project: Mojo > Issue Type: Bug > Components: hibernate3 > Environment: svn rev: 2271 > 1.0-SNAPSHOT > Reporter: Anagnostopoulos Kostis > Assigned To: Johann Reyes > Attachments: hibernate3-log4j-problem.tar > > > Hi (probably Johann), > Starting from this Monday, 2006-08-21, when i use the plugin, it throws > ClassNotFounbdError for Log4j Configurator: > java.lang.ExceptionInInitializerError > at > org.codehaus.mojo.hibernate3.exporter.SchemaExportMojo.doSchemaExport(SchemaExportMojo.java:63) > at > org.codehaus.mojo.hibernate3.exporter.SchemaExportMojo.doExecute(SchemaExportMojo.java:51) > at > org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:59) > at > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) > at > org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) > at org.codehaus.classworlds.Launcher.main(Launcher.java:375) > Caused by: org.apache.commons.logging.LogConfigurationException: > org.apache.commons.logging.LogConfigurationException: No suitable Log > constructor [Ljava.lang.Class;@11d565f for > org.apache.commons.logging.impl.Log4JLogger (Caused by > java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by > org.apache.commons.logging.LogConfigurationException: No suitable Log > constructor [Ljava.lang.Class;@11d565f for > org.apache.commons.logging.impl.Log4JLogger (Caused by > java.lang.NoClassDefFoundError: org/apache/log4j/Category)) > at > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543) > at > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235) > at > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209) > at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351) > at > org.hibernate.tool.hbm2ddl.SchemaExport.<clinit>(SchemaExport.java:42) > ... 21 more > Caused by: org.apache.commons.logging.LogConfigurationException: No suitable > Log constructor [Ljava.lang.Class;@11d565f for > org.apache.commons.logging.impl.Log4JLogger (Caused by > java.lang.NoClassDefFoundError: org/apache/log4j/Category) > at > org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413) > at > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) > ... 25 more > Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category > at java.lang.Class.getDeclaredConstructors0(Native Method) > at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328) > at java.lang.Class.getConstructor0(Class.java:2640) > at java.lang.Class.getConstructor(Class.java:1629) > at > org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410) > When i added log4j in plugin's dependencies: > log4j:WARN No appenders could be found for logger > (org.hibernate.cfg.annotations.Version). > log4j:WARN Please initialize the log4j system properly. > If i'm not totally wrong, both log4j and a default log4j.properties file for > at least "org.hibernate" should be included. > Regards, > Kostis -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
