0

我正在使用 JBoss 7.1.1 并尝试使用 Apache Commons Lang 3.3 部署 WAR 文件。JAR 位于我的 WAR 文件中的 WEB-INF/lib 文件夹中。但是,当我运行我的 Web 应用程序时,我收到以下错误/异常,我认为这是因为 JBoss 正在使用它自己的旧 commons-lang library 。如何在不修改 JBoss 安装的情况下覆盖 JBoss commons lang 模块?

java.lang.NoClassDefFoundError: org/apache/commons/lang/RandomStringUtils
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createTrainingLink(TrainingSessionServiceImpl.java:387)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.addUserLinks(TrainingSessionServiceImpl.java:352)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createOrUpdateTrainingSessionFromOrder(TrainingSessionServiceImpl.java:205)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createTrainingSessions(TrainingSessionServiceImpl.java:162)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createOrUpdateTrainingSessions(TrainingSessionServiceImpl.java:124)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    $Proxy132.createOrUpdateTrainingSessions(Unknown Source)
    org.mainco.subco.dido.quartz.ProcessPDWorker.work(ProcessPDWorker.java:23)
    org.mainco.subco.dido.controller.IndexController.refreshPD(IndexController.java:40)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
        org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

root cause
java.lang.ClassNotFoundException: org.apache.commons.lang.RandomStringUtils from [Module "deployment.didoclient.war:main" from Service Module Loader]
    org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
    org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createTrainingLink(TrainingSessionServiceImpl.java:387)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.addUserLinks(TrainingSessionServiceImpl.java:352)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createOrUpdateTrainingSessionFromOrder(TrainingSessionServiceImpl.java:205)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createTrainingSessions(TrainingSessionServiceImpl.java:162)
    org.mainco.subco.dido.service.TrainingSessionServiceImpl.createOrUpdateTrainingSessions(TrainingSessionServiceImpl.java:124)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    $Proxy132.createOrUpdateTrainingSessions(Unknown Source)
    org.mainco.subco.dido.quartz.ProcessPDWorker.work(ProcessPDWorker.java:23)
    org.mainco.subco.dido.controller.IndexController.refreshPD(IndexController.java:40)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
        org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

谢谢, - 戴夫

4

1 回答 1

0

在我看来,您的代码(或至少 中的代码org.mainco.subco.dido.service.TrainingSessionServiceImpl)似乎仍在使用旧版本的 commons-lang。如果您查看commons-lang 3 的 Javadoc,您会看到代码在下面org.apache.commons.lang3而不是org.apache.commons.lang3.

于 2013-01-21T20:47:35.847 回答