Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glassfish 5 creates empty temporary copy of EAR file on deploy

I'm trying to deploy an EAR file to a Glassfish 5 server. The exact version is GlassFish Server Open Source Edition 5.0 (build 25). The deploy is done via the admin GUI and lists one additional library that has been placed in the domain's applib folder. When attempting to deploy, it immediately fails with a message of the form 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.

The file name will be that of the EAR file with some form of timestamp or random number after it. I checked in the temp directory and can see that an EAR file of 0 bytes in size was created there. Initially this was the Windows temp folder and I suspected an access issue, so I set the JVM to use a different folder for temporary files as you can see above. This failed as well. I tried running Glassfish with a user with admin rights, again to no avail.

What can be done to fix this?

Additional information:

  • The EAR file is on the same host as the Glassfish server, it's not uploaded to the Glassfish admin console via some remote host. I'm opening the GUI on the localhost (it's a Windows machine I'm accessing via remote desktop).
  • I'm not deploying via Netbeans. I'm deploying via the Glassfish admin console, default port 4848. The browser is Google Chrome.
  • Deploying via command line using the deploy command in the asadmin prompt (or directly via asadmin deploy --libraries=[jar in applibs] [ear file]) works fine.

The log file from the server at the time of deploying is below:

[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.]]
like image 996
G_H Avatar asked Jul 17 '19 15:07

G_H


1 Answers

It's possible this could simply be a symptom of an external resource (like a JDBC connection) which is configured in NetBeans but not in Glassfish. I downloaded a sample EAR and threw it into a fresh installation from 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|#]

And note the temp file is deleted in the last log message upon successful deployment.

An alternate explanation might be that your upload is failing. You could copy your EAR file to the same server as the software and attempt your deployment via the CLI or again via the GUI through "Local Packaged File or Directory That Is Accessible from GlassFish Server".

My successful request:

 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

Successful response:

 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

Maybe distantly related:

  • Glassfish 4, different deployment *cli)/exception message: glassfish: while deploying the app IOException: invalid zip file
like image 101
Jon Sampson Avatar answered Oct 17 '22 07:10

Jon Sampson