Glassfish 5在部署时会创建EAR文件的空临时副本

时间:2019-07-17 15:24:05

标签: java deployment glassfish ear java-ee-8

我正在尝试将EAR文件部署到Glassfish 5服务器。确切的版本是GlassFish Server Open Source Edition 5.0 (build 25)。部署是通过管理GUI完成的,并列出了已放置在域的applib文件夹中的另一个库。尝试部署时,它立即失败,并显示以下消息形式:Error occurred during deployment: java.io.IOException: invalid zip file: file:/C:/glassfish5/glassfish/tmp/(ear_file_name).ear. Please see server.log for more details.

文件名将是EAR文件的名称,后跟某种形式的时间戳或随机数。我检查了temp目录,可以看到在那里创建了一个0字节大小的EAR文件。最初,这是Windows临时文件夹,我怀疑是访问问题,因此我将JVM设置为对临时文件使用其他文件夹,如上所示。这也失败了。我尝试用具有管理员权限的用户运行Glassfish,再次失败了。

该如何解决?

部署时来自服务器的日志文件如下:

[2019-07-17T17:16:48.174+0200] [glassfish 5.0] [INFO] [] [org.glassfish.admingui] [tid: _ThreadID=46 _ThreadName=admin-listener(4)] [timeMillis: 1563376608174] [levelValue: 800] [[
  GUI deployment: uploadToTempfile]]

[2019-07-17T17:16:48.175+0200] [glassfish 5.0] [INFO] [] [org.glassfish.admingui] [tid: _ThreadID=46 _ThreadName=admin-listener(4)] [timeMillis: 1563376608175] [levelValue: 800] [[
  uploadFileName=Test-app-ear-3.0.0.0-SNAPSHOT.ear]]

[2019-07-17T17:16:48.177+0200] [glassfish 5.0] [INFO] [] [] [tid: _ThreadID=46 _ThreadName=Thread-8] [timeMillis: 1563376608177] [levelValue: 800] [[
  ================== availabilityEnabled  skipped ]]

[2019-07-17T17:16:48.183+0200] [glassfish 5.0] [WARNING] [NCLS-DEPLOYMENT-00019] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=47 _ThreadName=admin-listener(5)] [timeMillis: 1563376608183] [levelValue: 900] [[
  file open failure; file = file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear]]

[2019-07-17T17:16:48.183+0200] [glassfish 5.0] [WARNING] [NCLS-DEPLOYMENT-00020] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=47 _ThreadName=admin-listener(5)] [timeMillis: 1563376608183] [levelValue: 900] [[
  exception message:  zip file is empty -- invalid zip file: invalid zip file: file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear]]

[2019-07-17T17:16:48.185+0200] [glassfish 5.0] [WARNING] [NCLS-DEPLOYMENT-00019] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=47 _ThreadName=admin-listener(5)] [timeMillis: 1563376608185] [levelValue: 900] [[
  file open failure; file = file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear]]

[2019-07-17T17:16:48.185+0200] [glassfish 5.0] [WARNING] [NCLS-DEPLOYMENT-00020] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=47 _ThreadName=admin-listener(5)] [timeMillis: 1563376608185] [levelValue: 900] [[
  exception message:  zip file is empty -- invalid zip file: invalid zip file: file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear]]

[2019-07-17T17:16:48.187+0200] [glassfish 5.0] [WARNING] [NCLS-DEPLOYMENT-00019] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=47 _ThreadName=admin-listener(5)] [timeMillis: 1563376608187] [levelValue: 900] [[
  file open failure; file = file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear]]

[2019-07-17T17:16:48.187+0200] [glassfish 5.0] [WARNING] [NCLS-DEPLOYMENT-00020] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=47 _ThreadName=admin-listener(5)] [timeMillis: 1563376608187] [levelValue: 900] [[
  exception message:  zip file is empty -- invalid zip file: invalid zip file: file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear]]

[2019-07-17T17:16:48.187+0200] [glassfish 5.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=47 _ThreadName=admin-listener(5)] [timeMillis: 1563376608187] [levelValue: 1000] [[
  java.io.IOException: invalid zip file: file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear
java.io.IOException: invalid zip file: file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:582)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:573)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.createEntryEnumeration(InputJarArchive.java:451)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.entries(InputJarArchive.java:203)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.entries(InputJarArchive.java:182)
    at org.glassfish.internal.deployment.GenericHandler.expand(GenericHandler.java:91)
    at org.glassfish.javaee.full.deployment.EarHandler.expand(EarHandler.java:156)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.getContext(ApplicationLifecycle.java:1810)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.access$200(ApplicationLifecycle.java:115)
    at com.sun.enterprise.v3.server.ApplicationLifecycle$DeploymentContextBuidlerImpl.build(ApplicationLifecycle.java:1673)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:426)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Unknown Source)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:535)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Unknown Source)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
    at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:254)
    at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:232)
    at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:276)
    at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:134)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:377)
    at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)
    at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Unknown Source)
]]

[2019-07-17T17:16:48.192+0200] [glassfish 5.0] [INFO] [] [org.glassfish.admingui] [tid: _ThreadID=46 _ThreadName=admin-listener(4)] [timeMillis: 1563376608192] [levelValue: 800] [[
  Exception Occurred :Error occurred during deployment: java.io.IOException: invalid zip file: file:/C:/glassfish5/glassfish/tmp/Test-app-ear-31280879560892113076.0.0.0-SNAPSHOT.ear. Please see server.log for more details.]]

1 个答案:

答案 0 :(得分:2)

这很可能只是外部资源(例如JDBC连接)的症状,该外部资源是在NetBeans中配置的,而不是在Glassfish中配置的。我下载了一个示例EAR并将其放入全新安装中来自glassfish-5.0-b25.zip。

[#|2019-07-24T10:58:13.700-0400|INFO|glassfish 5.0|org.glassfish.admingui|_ThreadID=45;_ThreadName=admin-listener(5);_TimeMillis=1563980293700;_LevelValue=800;|
   GUI deployment: uploadToTempfile|#]
[#|2019-07-24T10:58:13.728-0400|INFO|glassfish 5.0|org.glassfish.admingui|_ThreadID=45;_ThreadName=admin-listener(5);_TimeMillis=1563980293728;_LevelValue=800;|
   uploadFileName=EnterpriseHelloWorld.ear|#]
[#|2019-07-24T10:58:13.801-0400|INFO|glassfish 5.0||_ThreadID=45;_ThreadName=Thread-9;_TimeMillis=1563980293801;_LevelValue=800;|
   ================== availabilityEnabled  skipped |#]
[#|2019-07-24T10:58:14.136-0400|INFO|glassfish 5.0|javax.enterprise.system.tools.deployment.common|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980294136;_LevelValue=800;|
   visiting unvisited references|#]
[#|2019-07-24T10:58:14.705-0400|INFO|glassfish 5.0|javax.enterprise.system.tools.deployment.common|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980294705;_LevelValue=800;|
   visiting unvisited references|#]
[#|2019-07-24T10:58:14.740-0400|INFO|glassfish 5.0|javax.enterprise.system.tools.deployment.common|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980294740;_LevelValue=800;|
   visiting unvisited references|#]
[#|2019-07-24T10:58:14.899-0400|INFO|glassfish 5.0|javax.enterprise.system.tools.deployment.common|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980294899;_LevelValue=800;|
   visiting unvisited references|#]
[#|2019-07-24T10:58:14.916-0400|INFO|glassfish 5.0|javax.enterprise.system.tools.deployment.common|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980294916;_LevelValue=800;|
   visiting unvisited references|#]
[#|2019-07-24T10:58:15.753-0400|INFO|glassfish 5.0|javax.enterprise.web|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980295753;_LevelValue=800;_MessageID=AS-WEB-GLUE-00172;|
   Loading application [EnterpriseHelloWorld#HelloWorldSecond.war] at [HelloWorldSecond]|#]
[#|2019-07-24T10:58:15.893-0400|INFO|glassfish 5.0|javax.enterprise.web|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980295893;_LevelValue=800;_MessageID=AS-WEB-GLUE-00172;|
   Loading application [EnterpriseHelloWorld#HelloWorldFirst.war] at [HelloWorldFirst]|#]
[#|2019-07-24T10:58:16.012-0400|INFO|glassfish 5.0|javax.enterprise.system.core|_ThreadID=43;_ThreadName=admin-listener(3);_TimeMillis=1563980296012;_LevelValue=800;|
   EnterpriseHelloWorld was successfully deployed in 2,141 milliseconds.|#]
[#|2019-07-24T10:58:16.026-0400|INFO|glassfish 5.0|org.glassfish.admingui|_ThreadID=45;_ThreadName=admin-listener(5);_TimeMillis=1563980296026;_LevelValue=800;|
   Deleting the file uploaded to Temp Directory|#]

请注意,成功部署后,临时文件会在最后一条日志消息中删除。

另一种解释可能是您的上传失败。 您可以将EAR文件复制到与该软件相同的服务器上,然后通过CLI或通过“可从GlassFish Server访问的本地打包文件或目录”通过GUI再次尝试进行部署。

我的成功请求:

 POST /common/applications/uploadFrame.jsf?form:title2:bottomButtons:uploadButton=Processing...&bare=false HTTP/1.1
 Host: localhost:4848
 Connection: keep-alive
 Content-Length: 10829
 Pragma: no-cache
 Cache-Control: no-cache
 Origin: http://localhost:4848
 Upgrade-Insecure-Requests: 1
 Content-Type: multipart/form-data; boundary=--- WebKitFormBoundary9H3ItsEmMdnioMNr
 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
 Referer: http://localhost:4848/common/applications/uploadFrame.jsf
 Accept-Encoding: gzip, deflate, br
 Accept-Language: en-US,en;q=0.9
 Cookie: _common_applications_uploadFrame.jsf=left:0&top:442&badCookieChars:%28%2C%29%2C%3C%2C%3E%2C@%2C%2C%2C%3B%2C%3A%2C%5C%2C%22%2C/%2C%5B%2C%5D%2C%3F%2C%3D%2C%7B%2C%7D%2C%20%2C%09; JSESSIONID=48e99f5126d248fdaffc92470a22; treeForm_tree-hi=treeForm:tree:applications

成功的响应:

 HTTP/1.1 302 Found
 Server: GlassFish Server Open Source Edition  5.0 
 X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition  5.0  Java/Oracle Corporation/1.8)
 Location: http://localhost:4848/common/removeFrame.jsf?/common/applications/applications.jsf&&alertType=&alertSummary=&alertDetail=&bare=true
 Content-Language: en-US
 Content-Type: text/html;charset=UTF-8
 Content-Length: 301

也许遥远相关: