我正在JBossAS 7.1.1上构建一个JBoss Application Server模块。在尝试修改清单文件中的类路径时,我遇到了这个错误:
12:30:53,097 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "MyDeployableProject.war"
12:30:53,141 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."MyDeployableProject.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyDeployableProject.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "MyDeployableProject.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to get manifest for deployment "/opt/server/bin/jboss-as-7.1.1.Final/standalone/deployments/MyDeployableProject.war"
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:73) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:393) [classes.jar:1.6.0_31]
at java.util.jar.Manifest.read(Manifest.java:182) [classes.jar:1.6.0_31]
at java.util.jar.Manifest.<init>(Manifest.java:52) [classes.jar:1.6.0_31]
at org.jboss.vfs.VFSUtils.readManifest(VFSUtils.java:216)
at org.jboss.vfs.VFSUtils.getManifest(VFSUtils.java:199)
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:69) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 6 more
答案 0 :(得分:11)
事实证明,MANIFEST.MF
中的一个小错误导致了这个问题。该文件是:
Manifest-Version: 1.0
Class-Path:
原来,这个错误是由于Class-Path:
之后没有空格。这(只有一个不同的空间)是有效的:
Manifest-Version: 1.0
Class-Path:
希望这会让别人不知道。
答案 1 :(得分:6)
此外,您可以拥有以下内容:
Manifest-Version: 1.0
Dependencies: org.slf4j,org.apache.commons.logging
**,org.joda.time**
Built-By: Pablo
Build-Jdk: 1.6.0_30
Created-By: Apache Maven
Archiver-Version: Plexus Archiver
而不是
Manifest-Version: 1.0
Dependencies: org.slf4j,org.apache.commons.logging,org.joda.time
Built-By: Pablo
Build-Jdk: 1.6.0_30
Created-By: Apache Maven
Archiver-Version: Plexus Archiver
在这种情况下,请查看pom.xml
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<!-- IMPORTANT: All dependencies in te same line --> <Dependencies>org.slf4j,org.apache.commons.logging,org.joda.time</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<!-- IMPORTANT: All dependencies in te same line --> <Dependencies>org.slf4j,org.apache.commons.logging,org.joda.time</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>