在 Eclipse 中进行完整发布时获取 0 字节 .jar 文件

Getting a 0 byte .jar file while doing full publish in Eclipse

我正在使用 Eclipse Galileo(内部版本号:20100218-1602)和 JBoss EAP 4.3 运行时和 jdk1.6.0_29.

我将我的资源添加到服务器,然后 "Full Publish" 我的资源。状态从 "Republished" 变为 "Synchronized",一切似乎都很好。

我右击我的服务器,点击"Start"。启动过程中出现错误。

--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@cac31a84 { url=file:*repository*/server/default/deploy/*project*_srv_mod_vin_int.war/ }
  deployer: MBeanProxyExt[jboss.web:service=WebServer]
  status: Deployment FAILED reason: URL file:*repository*/server/default/deploy/*project*_srv_mod_vin_int.war/ deployment failed
  state: FAILED
  watch: file:*repository*/server/default/deploy/*project*_srv_mod_vin_int.war/WEB-INF/web.xml
  altDD: null
  lastDeployed: 1448379140991
  lastModified: 1448378977301
  mbeans:

--- MBeans waiting for other MBeans ---  
ObjectName: jboss.web.deployment:war=*project*_srv_mod_vin_int.war,id=->893183356  
  State: FAILED  
  Reason: org.jboss.deployment.DeploymentException: URL file:*repository*/server/default/deploy/*project*_srv_mod_vin_int.war/ deployment failed

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---  
ObjectName: jboss.web.deployment:war=*project*_srv_mod_vin_int.war,id=-893183356  
  State: FAILED  
  Reason: org.jboss.deployment.DeploymentException: URL file:*repository*/server/default/deploy/*project*_srv_mod_vin_int.war/ deployment failed

在查看 eclipse 控制台日志时,我发现以下异常:

[24 nov. 2015 16:32:21,538] - [ERROR] - [THREAD main] - org.springframework.web.context.ContextLoader[org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:353)] - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:fmwk-application-context_module_service.xml]
Offending resource: class path resource [application-context_module_service.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [fmwk-application-context_module_service.xml]; nested exception is java.io.FileNotFoundException: class path resource [fmwk-application-context_module_service.xml] cannot be opened because it does not exist

文件application-context_module_service.xml引用了fmwk-application-context_module_service.xml:

<import resource="classpath:fmwk-application-context_module_service.xml" />

文件 fmwk-application-context_module_service.xml 确实存在于我的项目中。

在存储库 server\default\deploy\project_srv_mod_vin_int.war\WEB-INF\lib[= 中对我的服务器进行了一些研究之后61=] 我发现我的一个 jar 文件,project_srv_mod_vin_framework.jar,通常包含文件 fmwk-application-context_module_service.xml Ko 尺寸为 0。

在这种情况下,我将 0 Ko jar 文件替换为从我的 maven 任务中获得的正确 jar 文件(右键单击并且 "Export" 也很好)并且它有效。但是,我想了解这里发生了什么,为什么我要发布一个 0 Ko jar 文件,以及我可以做些什么来避免这个技巧

所以,在那之后,我进入我的工作区 .metadata.plugins\org.jboss.ide.eclipse.as.core\JBoss_EAP_4.3_Runtime_Server1300265697099\log 文件,我发现一个异常:

!SESSION 2015-11-24 15:13:39.287
-----------------------------------------------  
eclipse.buildId=unknown  
java.version=1.6.0_29  
java.vendor=Sun Microsystems Inc.  
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR  
Framework arguments:  -product org.eclipse.epp.package.jee.product  
Command-line arguments:  -os win32 -ws win32 -arch x86 -product  org.eclipse.epp.package.jee.product  

!ENTRY org.jboss.ide.eclipse.as.core 0 33685505 2015-11-24 16:29:37.364  
!MESSAGE 595 files modified in module *project*_srv_mod_vin_int

!ENTRY org.jboss.ide.eclipse.as.core 0 33685505 2015-11-24 16:29:37.588  
!MESSAGE 276 files modified in module *project*_srv_mod_vin_services

!ENTRY org.jboss.ide.eclipse.as.core 4 33685506 2015-11-24 16:29:37.596  
!MESSAGE Full publish failed for module *project*_srv_mod_vin_framework  
!SUBENTRY 1 org.jboss.ide.eclipse.as.core 4 33685513 2015-11-24 16:29:37.596  
!MESSAGE unable to assemble module *project*_srv_mod_vin_framework  
!STACK 0  
java.util.zip.ZipException: ZIP file must have at least one entry  
    at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)  
    at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)  
    at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)  
    at org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager.finished(ModulePackager.java:59)  
    at org.jboss.ide.eclipse.as.core.publishers.PublishUtil.packModuleIntoJar(PublishUtil.java:234)  
    at org.jboss.ide.eclipse.as.core.publishers.JstPublisher.fullPublish(JstPublisher.java:121)  
    at org.jboss.ide.eclipse.as.core.publishers.JstPublisher.publishModule(JstPublisher.java:93)  
    at org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod.publishModule(LocalPublishMethod.java:71)  
    at org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior.publishModule(DeployableServerBehavior.java:65)  
    at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:949)  
    at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1039)  
    at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:872)  
    at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:708)  
    at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:2731)  
    at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:278)  
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)  

我想我得到了 ZipException 因为之前出了点问题,我没有任何东西可以放入我的存档文件中?

然后我去.metadata.plugins\org.eclipse.wst.server.core\publish\publish.dat

在这个文件中,我发现提到了 application-context_module_service.xmlnot fmwk-应用-context_module_service.xml.

之所以找不到它是因为我有一个类似的项目,它建立在相同的体系结构上,具有相同的 .xml 文件。这个发布正确并且 publish.dat 确实提到了 fmwk-application-context_module_service.xml.

两个项目在 fmwk-application-context_module_service.xml 引用上没有区别。

有人可以帮我解决这个问题吗?我对 .metadata 存储库中的最终日志文件进行了一些研究,这些文件可以准确说明遇到的错误是什么以及为什么我发布的 jar 的大小为 0 Ko,但除了我在此处公开的内容外,我没有发现任何其他内容。我无法继续这个 publish.dat 文件。

如果你能给我一点提示或帮助,我将不胜感激。 谢谢。

终于找到错误的根源了。它在 .settings/org.eclipse.wst.common.component.

合并后,此文件丢失了 <wb-module></wb-module><wb-ressource></wb-ressource>

我将文件还原为旧版本并且运行良好。