10
Ноя
2016

java.lang.ClassNotFoundException: org.apache.commons.lang.xwork.StringUtils

Привет, столкнулся с странной проблемой.

Нужно было поднять версию Struts2 c 2.2.1 до 2.3.х

После чего полезли ошибки:

[10/11/2016 05:01:28 PM] WARN  log - Failed startup of context [email protected]@4593aeea/,file:/C:/project/web/
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerBuilder$4
File: ContainerBuilder.java
Method: create
Line: 132 - com/opensymphony/xwork2/inject/ContainerBuilder.java:132:-1
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:483)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:74)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:668)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:204)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:994)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:588)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:380)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:92)
    at org.eclipse.jetty.server.Server.doStart(Server.java:242)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
    at com.kpclabs.test.ProcessingPortalWebRunner.main(ProcessingPortalWebRunner.java:28)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)
    at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
    at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:514)
    at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:524)
    at com.opensymphony.xwork2.inject.ContainerImpl$9.call(ContainerImpl.java:555)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:584)
    at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:553)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:232)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:68)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
    ... 14 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:502)
    at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:539)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:593)
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:537)
    at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)
    at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)
    ... 24 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:447)
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)
    ... 29 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:426)
    ... 30 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/xwork/StringUtils
    at org.apache.struts2.spring.StrutsSpringObjectFactory.<init>(StrutsSpringObjectFactory.java:104)
    ... 35 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.xwork.StringUtils
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

pom.xml:

<dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-json-plugin</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.struts</groupId>
                    <artifactId>struts2-junit-plugin</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-junit-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>  
        <dependency>
            <groupId>org.apache.struts.xwork</groupId>
            <artifactId>xwork-core</artifactId>
            <version>${struts2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Ну и

<struts2.version>2.3.7</struts2.version>

Никак не могу решить. Может кто подсказать направление?

Источник: https://ru.stackoverflow.com/questions/589522/java-lang-classnotfoundexception-org-apache-commons-lang-xwork-stringutils

Тебе может это понравится...

Добавить комментарий