从蚂蚁迁移到maven

时间:2015-10-23 10:05:19

标签: java maven ant velocity

我已经使用速度框架工作将我的项目从ant迁移到Maven,但我收到了以下错误:

SEVERE: Servlet /Labman threw load() exception
java.lang.ClassNotFoundException: org.apache.commons.lang.text.StrLookup
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    at org.apache.turbine.services.BaseServiceBroker.<init>(BaseServiceBroker.java:93)
    at org.apache.turbine.services.TurbineServices.<init>(TurbineServices.java:164)
    at org.apache.turbine.services.TurbineServices.<clinit>(TurbineServices.java:147)
    at org.apache.turbine.Turbine.<init>(Turbine.java:170)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at java.lang.Class.newInstance(Class.java:379)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:143)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

2 个答案:

答案 0 :(得分:0)

您可能在pom.xml中遗漏了这个:

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>

只需将其添加到标记<dependencies>下即可。

答案 1 :(得分:0)

如错误消息所示:

  

java.lang.ClassNotFoundException:   org / apache / commons / lang / text / StrLookup

这意味着,您的依赖项中缺少了 commons-lang 这个Apache:

因此您必须在pom中添加以下内容:

  
<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>  
</dependency>  

此外,如果您使用的是 commons-lang3 ,但它的包名称为 org / apache / commons / lang3