在Weblogic 12c上部署Spring Security SAML扩展的问题

时间:2014-09-05 17:15:46

标签: java spring-security saml-2.0 weblogic12c spring-saml

我试图在Weblogic 12c上部署示例应用程序。我可以在Tomcat中运行它,但是当我尝试将其部署到Weblogic时,我收到以下错误:

  

SEVERE:上下文初始化失败java.lang.NoClassDefFoundError:   组织/阿帕奇/ log4j的/记录器

我检查了pom.xml,我知道log4j包含在依赖项中。这是堆栈跟踪:

  

SEVERE:上下文初始化失败java.lang.NoClassDefFoundError:   org / apache / log4j / Logger at   org.opensaml.xml.XMLConfigurator。(XMLConfigurator.java:60)at   org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:195)     at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91)     在org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)at   org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)     在   org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)     在   org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:676)     在   org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)     在   org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)     在   org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)     在   org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)     在   weblogic.servlet.internal.EventsManager $ FireContextListenerAction.run(EventsManager.java:678)     在   weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)     在   weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)     在   weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)     在   weblogic.servlet.internal.EventsManager.executeContextListener(EventsManager.java:243)     在   weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:200)     在   weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:185)     在   weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1838)     在   weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2876)     在   weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661)     在   weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:823)     在   weblogic.application.internal.ExtensibleModuleWrapper $ StartStateChange.next(ExtensibleModuleWrapper.java:360)     在   weblogic.application.internal.ExtensibleModuleWrapper $ StartStateChange.next(ExtensibleModuleWrapper.java:356)     在   weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)     在   weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)     在   weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)     在   weblogic.application.internal.flow.ModuleStateDriver $ 3.next(ModuleStateDriver.java:216)     在   weblogic.application.internal.flow.ModuleStateDriver $ 3.next(ModuleStateDriver.java:211)     在   weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)     在   weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:73)     在   weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)     在   weblogic.application.internal.BaseDeployment $ 2.next(BaseDeployment.java:729)     在   weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)     在   weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)     在   weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)     在   weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)     在   weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)     在   weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:226)     在   weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:418)     在   weblogic.management.deploy.internal.DeploymentAdapter $ 1.doActivate(DeploymentAdapter.java:51)     在   weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)     在   weblogic.management.deploy.internal.AppTransition $ 2.transitionApp(AppTransition.java:30)     在   weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)     在   weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)     在   weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)     在   weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:210)     在   weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:118)     在   weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)     在sun.reflect.GeneratedMethodAccessor5.invoke(未知来源)at   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:606)at   org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)     在   org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)     在org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)     在   org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)     在   org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)     在   org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)     在   org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)     在   org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)     在   org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)     在   org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)     在org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)     在   org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)     在org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)     在   org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)     在   org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)     在   org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)     在   org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)     在   org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)     在   org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)     在   org.glassfish.hk2.runlevel.internal.CurrentTaskFuture $ QueueRunner.oneJob(CurrentTaskFuture.java:1162)     在   org.glassfish.hk2.runlevel.internal.CurrentTaskFuture $ QueueRunner.run(CurrentTaskFuture.java:1147)     在   weblogic.work.SelfTuningWorkManagerImpl $ WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)     在weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)at   weblogic.work.ExecuteThread.run(ExecuteThread.java:263)引起:   java.lang.ClassNotFoundException:org.apache.log4j.Logger at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)at   java.security.AccessController.doPrivileged(Native Method)at   java.net.URLClassLoader.findClass(URLClassLoader.java:354)at   java.lang.ClassLoader.loadClass(ClassLoader.java:425)at   sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)at at   java.lang.ClassLoader.loadClass(ClassLoader.java:358)... 76更多

     

    (XMLConfigurator.java:60)at   org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:195)     at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91)     在org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)at   org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)     截断。请参阅日志文件以获取完整的堆栈跟踪引起的:   java.lang.ClassNotFoundException:org.apache.log4j.Logger at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)at   java.security.AccessController.doPrivileged(Native Method)at   java.net.URLClassLoader.findClass(URLClassLoader.java:354)at   java.lang.ClassLoader.loadClass(ClassLoader.java:425)截断。看到   完整堆栈跟踪的日志文件

     
    

(XMLConfigurator.java:60)at     org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:195)       at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91)       在org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)at     org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)       截断。请参阅日志文件以获取完整的堆栈跟踪引起的:     java.lang.ClassNotFoundException:org.apache.log4j.Logger at     java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)at     java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)at     java.security.AccessController.doPrivileged(Native Method)at     java.net.URLClassLoader.findClass(URLClassLoader.java:354)at     java.lang.ClassLoader.loadClass(ClassLoader.java:425)截断。看到     完整堆栈跟踪的日志文件          (XMLConfigurator.java:60)at     org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:195)       at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91)       在org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)at     org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)       截断。请参阅日志文件以获取完整的堆栈跟踪引起的:     java.lang.ClassNotFoundException:org.apache.log4j.Logger at     java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)at     java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)at     java.security.AccessController.doPrivileged(Native Method)at     java.net.URLClassLoader.findClass(URLClassLoader.java:354)at     java.lang.ClassLoader.loadClass(ClassLoader.java:425)截断。看到     完整堆栈跟踪的日志文件      2014年9月5日上午11:20:17 org.springframework.web.servlet.FrameworkServlet initServletBean INFO:     FrameworkServlet' saml&#39 ;:初始化开始(XMLConfigurator.java:60)at     org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:195)       at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:91)       在org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)at     org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)       截断。请参阅日志文件以获取完整的堆栈跟踪引起的:     java.lang.ClassNotFoundException:org.apache.log4j.Logger at     java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)at     java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)at     java.security.AccessController.doPrivileged(Native Method)at     java.net.URLClassLoader.findClass(URLClassLoader.java:354)at     java.lang.ClassLoader.loadClass(ClassLoader.java:425)截断。看到     完整堆栈跟踪的日志文件

  

为什么这会在Weblogic上轰炸?提前谢谢!

2 个答案:

答案 0 :(得分:1)

可能的原因:

a)它包含在依赖项中,但Log4j jar不存在于类路径中,或已移动。请检查它是否存在于类路径中。

b)这通常是由于在webapp库(WEB-INF / lib)中导入了应用程序服务器中已有的JAR。

  

如果Java虚拟机或ClassLoader实例尝试,则抛出该异常   加载类的定义(作为普通方法调用的一部分或   作为使用新表达式创建新实例的一部分)和否   可以找到班级的定义。

     

当前正在执行的搜索类定义存在   编译了类,但无法再找到定义。

另见:

在Weblogic中部署期间。

nested exception is java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence

答案 1 :(得分:0)

确保log4j.jar实际上在战争中(我猜它是一个由maven构建的Web应用程序)。