我使用Velocity在Java項目中生成源代碼。我將項目導出爲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:org/apache/velocity/exception/ResourceNotFoundException java.lang.Class.getDeclaredConstructors0(Native Method)Velocity中的「NoClassDefFoundError」
0
A
回答
0
該類在構建期間存在,但它取決於環境,如果您在J2EE環境中工作比您可以獲得NoClassD efFoundError即使存在類,因爲它可能對相應的類加載器不可見。
將所有依賴關係置於WEB-INF/lib
並將它們添加到CLASSPATH
。
Where to Put the Velocity Jar
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.
相關問題
- 1. FragmentMapActivity中的NoClassDefFoundError
- 2. Jadex中的NoClassDefFoundError
- 3. j2me中的NoClassDefFoundError
- 4. RAD中的NoClassDefFoundError
- 5. SpriteKit中的Velocity字段
- 6. Eclipse中的Apache Velocity錯誤[Java,Eclipse Luna,Velocity 2.0,VelocityView,Tomcat 7]
- 7. Castor庫中的NoClassDefFoundError
- 8. 的NoClassDefFoundError
- 9. NoClassDefFoundError
- 10. NoClassDefFoundError
- 11. NoClassDefFoundError
- 12. - NoClassDefFoundError
- 13. 索引在Velocity報告中?
- 14. 在Velocity中添加天數
- 15. velocity(test instanceof)
- 16. Velocity $ fn docs
- 17. Memcached和Velocity
- 18. Apache Velocity $ vs $!{}
- 19. Apache Velocity + Servlet 3.0
- 20. Velocity vs Apache Tiles
- 21. Velocity vs. FreeMarker
- 22. Freemarker vs. Velocity
- 23. IntelliJ IDEA Velocity ResourceNotFoundException
- 24. Eclipse + Apache Velocity Engine?
- 25. 的Android - NoClassDefFoundError的
- 26. Glassfish中的休眠 - Ejb3Configuration NoClassDefFoundError
- 27. Cocos2D示例中的NoClassDefFoundError
- 28. NoClassDefFoundError的:java.applet.Applet中....畢加索
- 29. jar依賴中的Gradle NoClassDefFoundError
- 30. 命令行中的Java NoClassDefFoundError