关于spring中commons-attributes-compiler.jar的使用问题

   昨天用spring做了个定时器,用于定时扫描某通讯公司外网ftp服务器的约定路径下是否有我需要的文件并下载到本公司服务器上。记得以前做过类似的一个定时器,觉得手到擒来的事情,没想到又折腾了大半天,就是因为spring中commons-attributes-compiler.jar的使用问题。
   问题是这样的:扫面和下载程序,触发类和函数,web.xml和spring配置文件,这些准备工作都已经完成,就是在服务器启动的时候报错:

INFO: Deploying web application archive GRCC.war 
Sep 14, 2007 13:22:18 AM org.apache.catalina.util.ExtensionValidator validateManifestResources 
INFO: ExtensionValidator[/GRCC][commons-attributes-api.jar]: Required extension "ant" not found. 
Sep 14, 2007 13:22:18 AM org.apache.catalina.util.ExtensionValidator validateManifestResources 
INFO: ExtensionValidator[/GRCC][commons-attributes-compiler.jar]: Required extension "ant" not found. 
Sep 14, 2007 13:22:18 AM org.apache.catalina.util.ExtensionValidator validateManifestResources 
INFO: ExtensionValidator[/GRCC][commons-attributes-compiler.jar]: Required extension "javadoc" not found. 
Sep 14, 2007 13:22:18 AM org.apache.catalina.util.ExtensionValidator validateManifestResources 
INFO: ExtensionValidator[/GRCC]: Failure to find 3 required extension(s). 
   Sep 14, 2007 13:22:18 AM org.apache.catalina.core.StandardContext start 
SEVERE: Error getConfigured 
Sep 14, 2007 13:22:18 AM org.apache.catalina.core.StandardContext start 
SEVERE: Context [/GRCC startup failed due to previous errors 
Sep 14, 2007 13:22:18 AM org.apache.catalina.core.StandardContext stop 
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/GRCC] has not been started

并导致本项目无法启动!
    从错误可以看出,commons-attributes-compiler.jar需要的"ant","javadoc","qdox"无法找到,我又检查了数遍,ant和qdox这些jar包我都已经加lib里了,可spring就是视而不见!我郁闷了好久,最后实在不行了,我决定解压commons-attributes-compiler.jar,看看它的庐山真面目,里面还真不复杂:META-INF\MANIFEST.MF,compile\org\apache\commons\attributes\anttasks.properties,LICENSE.txt,,
NOTICE.txt,后两个肯定是说明性的文件,我没有理会;第二个是属性文件,我看格式和注释都没有什么不妥;就MANIFEST.MF里面内容较多,并且有异常之处(我标出了):

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3 
Created-By: Apache Maven
Built-By: hen
Package: org.apache.commons.attributes.compiler
Build-Jdk: 1.4.2_05
Extension-Name: commons-attributes-compiler
Specification-Title: Attribute Compiler
Specification-Vendor: The Apache Software Foundation
Implementation-Title: org.apache.commons.attributes.compiler
Implementation-Vendor: The Apache Software Foundation
Implementation-Version: 2.2
Extension-List: ant qdox commons-attributes-api javadoc
ant-Extension-Name: ant
ant-Implementation-Version: 1.5
ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.
5.jar
qdox-Extension-Name: qdox
qdox-Implementation-Version: 1.5
qdox-Implementation-URL: http://www.ibiblio.org/maven/qdox/jars/qdox-1.
5.jar
commons-attributes-api-Extension-Name: commons-attributes-api
commons-attributes-api-Implementation-Version: 2.2
commons-attributes-api-Implementation-URL: http://www.ibiblio.org/maven/commons-attributes/jars/commons-attributes-api-2.2
.jar
javadoc-Extension-Name: javadoc
javadoc-Implementation-Version: 1.4
javadoc-Implementation-URL: http://www.ibiblio.org/maven/javadoc/jars/javadoc-1.4
.jar
Implementation-Vendor-Id: org.apache
X-Compile-Source-JDK: 1.4
X-Compile-Target-JDK: 1.4

这里的URL后面的值被换行符隔开了,显然,如果让我们自己,是不会这么干的。于是,做修改如下:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3 
Created-By: Apache Maven
Built-By: hen
Package: org.apache.commons.attributes.compiler
Build-Jdk: 1.4.2_05
Extension-Name: commons-attributes-compiler
Specification-Title: Attribute Compiler
Specification-Vendor: The Apache Software Foundation
Implementation-Title: org.apache.commons.attributes.compiler
Implementation-Vendor: The Apache Software Foundation
Implementation-Version: 2.2
Extension-List: ant qdox commons-attributes-api javadoc
ant-Extension-Name: ant
ant-Implementation-Version: 1.5
ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5.jar
qdox-Extension-Name: qdox
qdox-Implementation-Version: 1.5
qdox-Implementation-URL: http://www.ibiblio.org/maven/qdox/jars/qdox-1.5.jar
commons-attributes-api-Extension-Name: commons-attributes-api
commons-attributes-api-Implementation-Version: 2.2
commons-attributes-api-Implementation-URL: http://www.ibiblio.org/maven/commons-attributes/jars/commons-attributes-api-2.2.jar
javadoc-Extension-Name: javadoc
javadoc-Implementation-Version: 1.4
javadoc-Implementation-URL: http://www.ibiblio.org/maven/javadoc/jars/javadoc-1.4.jar
Implementation-Vendor-Id: org.apache
X-Compile-Source-JDK: 1.4
X-Compile-Target-JDK: 1.4

重新打成jar包,添加到项目lib中,启动运行,一切OK!

     可是,以前写定时器也没遇到这种情况啊,我想这跟spring的版本有关系吧;今天用的spring2.0,可是谁把MANIFEST.MF中的URL弄错的呢?我想不应该是官方的bug吧,可能是我不是在官网上下的spring开发包,有机会看看官网上是否也是这个样子。不管怎么说,项目还是在波澜不惊中顺利进行。。。




     本文转自NightWolves 51CTO博客,原文链接:http://blog.51cto.com/yangfei520/403521,如需转载请自行联系原作者



上一篇:IOS之学习笔记六(可变形参)


下一篇:H3C V7 AC https页面无法重定向问题处理经验总结