Erro de Log4j ( ClassNotFoundException: org/apache/log4j/Category) com Hibernate+Struts 2.2.1.1

1 resposta
S

Estou enfrentando um problema que quando starto o tomcat (versão 7) me mostra a mensagem

GRAVE: Exception starting filter struts2 org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1309025 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;@1309025 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)) - Class: org.apache.commons.logging.impl.LogFactoryImpl File: LogFactoryImpl.java Method: newInstance Line: 543 - org/apache/commons/logging/impl/LogFactoryImpl.java:543:-1 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4542) at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5220) at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5215) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1309025 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;@1309025 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 com.opensymphony.xwork2.util.logging.commons.CommonsLoggerFactory.getLoggerImpl(CommonsLoggerFactory.java:29) at com.opensymphony.xwork2.util.logging.LoggerFactory.getLogger(LoggerFactory.java:42) at org.apache.struts2.config.DefaultSettings.<init>(DefaultSettings.java:46) at org.apache.struts2.config.Settings.getDefaultInstance(Settings.java:271) at org.apache.struts2.config.Settings.getInstance(Settings.java:111) at org.apache.struts2.config.LegacyPropertiesConfigurationProvider.register(LegacyPropertiesConfigurationProvider.java:67) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415) ... 14 more Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@1309025 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) ... 27 more Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getConstructor(Unknown Source) at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410) ... 28 more Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source ... 33 more

Mas o Log4J.jar já está no WEB-INF/, é a versão Log4J-1.2.15, será algum conflito com o tomcat 7 ou Struts 2.2.1.1

1 Resposta

S

Detalhes: Quando tiro o Log4j do lib consigo navegar pelo sistema mas quando tento salvar dá erro, quando coloco o jar no lib, nem entra no sitema.Provoca esse erro do log acima.

Essas são as classes que estão no lib -

antlr-2.7.6
commons-collections-3.1
dom4j-1.6.1
ejb3-persistence-3.4.0
hibernate-annotations-3.4.0
hibernate-commons-annotations-3.4.0
hibernate-core-3.4.0
javassist-3.4.GA
jta-1.1
log4j-1.2.15
postgreesql-8.2-504.jdbc2
slf4j-api-3.4.0
slf4j-log4j12-3.4.0
struts2-dojo-plugin-2.2.1.1

Criado 9 de junho de 2011
Ultima resposta 9 de jun. de 2011
Respostas 1
Participantes 1