我正在使用Ant构建我的项目并将其部署到JBoss。Ant正在使用jboss-home/server/default/lib jar进行构建。但在部署时,它给出错误:
java.lang.Error: Unresolved compilation problems:
The import org.apache.commons.lang3 cannot be resolved
StringUtils cannot be resolved
我使用commons-lang3-3.1.jar为StringUtils类通过以下Ant条目:
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar">
<include name="{jboss.home}/server/default/lib/commons-lang3-3.1.jar" />
对我来说,这似乎是编译错误,但我仍然可以提出一些建议。
- 尝试将'missing'库包含到您的应用程序中(例如,如果它是war打包,则将其放入web-inf/lib中,或者使用descriptor - application.xml或jboss-app.xml),看看会发生什么。
- 检查你的jboss是否正在使用lib:事实上,jar位于jboss目录中,并不意味着它将被实际加载。我不知道你使用的是什么版本的jboss,但是对于jboss as7,可以通过module.xml或通过特定的服务器配置文件(如standalone.xml)从模块中禁用任何jar。