我正在尝试部署我的应用程序,但它给了我一个错误: 无法实例化SLF4J LoggerFactory 报告的例外:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:75)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:197)
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:133)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72)
at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerFactory(BasePersistenceUnitInfo.java:452)
at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerFactory(BasePersistenceUnitInfo.java:445)
at weblogic.persistence.BasePersistenceUnitInfo.init(BasePersistenceUnitInfo.java:119)
at weblogic.persistence.BaseJPAIntegrationProvider.createPersistenceUnitInfo(BaseJPAIntegrationProvider.java:53)
at weblogic.persistence.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:420)
at weblogic.persistence.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:339)
at weblogic.persistence.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:67)
at weblogic.ejb.container.deployer.EJBModule.setupPersistenceUnitRegistry(EJBModule.java:190)
at weblogic.ejb.container.deployer.EJBModule$1.execute(EJBModule.java:297)
at weblogic.persistence.PersistenceUnitRegistryInitializer.setupPersistenceUnitRegistries(PersistenceUnitRegistryInitializer.java:62)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:394)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:295)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:172)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:167)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)
at weblogic.work.ContextWrap.run(ContextWrap.java:40)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
我在Maven Dependences中有jar-s:
weblogic中log4j jar的类路径:
log4j.xml(来自classpath):
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="LOGFILE" class="org.apache.log4j.FileAppender">
<param name="File" value="C:\\Work\\KEPLER\\KH_RRM\\log/rrm-web.log" />
<param name="Append" value="false" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p [%c{1}] %m%n"/>
</layout>
</appender>
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value=" %d{yyyy-MM-dd HH:mm:ss} [%t] %-5p [%c{1}] %m%n"/>
</layout>
</appender>
<root>
<priority value ="ALL" />
<appender-ref ref="STDOUT" />
<appender-ref ref="LOGFILE" />
</root>
</log4j:configuration>
我错了什么?我无法想象......请帮助我!谢谢!
答案 0 :(得分:2)
通常,因为这是maven相关问题,然后附加您的pom.xml(或其中的一部分)。这比附加屏幕截图更好:))
你的log4j依赖项提供了范围,这意味着你的服务器上已经存在log4j,并且不应该随应用程序一起安装。
答案 1 :(得分:0)
答案是:我正在部署到Adminserver,但我必须将我的应用程序部署到clustor,因为ServerStart中的ClassPath和Arguments设置不仅适用于Adminserver,它只适用于其他人。