![](/img/trans.png)
[英]Velocity 2.0: NoClassDefFoundError: org/apache/velocity/runtime/log/CommonsLogLogChute
[英]“NoClassDefFoundError” in Velocity
我在Java项目中使用Velocity生成源代码。 我将项目导出为jar文件,以便在其他项目中使用它。
这是我的速度属性文件的内容:
runtime.log.logsystem.class = org.apache.velocity.runtime.log.SystemLogChute
resource.loader =资源/
classpath.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
我收到此错误:
内部编译器错误:java.lang.NoClassDefFoundError:java.lang.Class.getDeclaredConstructors0(本地方法)处的org / apache / velocity / exception / ResourceNotFoundException
该类在构建期间就存在,但是它取决于环境,如果您在J2EE环境中工作,则即使存在类也可以获取NoClassDefFoundError,因为相应的类加载器可能看不到该类。
将所有依赖项放入WEB-INF/lib
并将它们添加到CLASSPATH
。
哪里放速度罐
First of all you have to decide whether you will use the dependency-free version
of velocity.jar or the version including all dependend jars. If you are not worried
about collisions with Avalon Logkit, Commons Collections or Jakarta Oro, using the jar
containing all dependencies is very convenient.
Putting the velocity jar in WEB-INF/lib your web application
will result in it's classes being available in the classpath for that web application.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.