我正在使用JBoss 7.1.1并尝试使用Apache Commons Lang 3.3部署WAR文件。 JAR位于我的WAR文件中的WEB-INF / lib文件夹中。但是,当我运行我的Web应用程序时,我得到以下错误/异常,我认为这是因为JBoss正在使用它自己的旧的commons-lang库。如何在不修改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)
谢谢, - 戴夫
答案 0 :(得分:0)
对我而言,您的代码(或至少org.mainco.subco.dido.service.TrainingSessionServiceImpl
中的代码)仍然使用较旧版本的commons-lang。如果您查看Javadoc for commons-lang 3,则会看到代码位于org.apache.commons.lang3
而不是org.apache.commons.lang3
。