Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a maven EAR application through netbeans to glassfish fails

I am trying to deploy a maven EAR application to a Glassfish 3 server through Netbeans using right click -> debug and it fails with: GlassFish Server, deploy, Error writing request body to server, false

The output is:

BUILD SUCCESS
------------------------------------------------------------------------
Total time: 0.977 s
Finished at: 2017-10-02T21:00:19+03:00
Final Memory: 9M/393M
------------------------------------------------------------------------
Deploying on GlassFish Server
profile mode: false
debug mode: false
force redeploy: true

Distributing /path/to/ear.ear
GlassFish Server, deploy, Error writing request body to server, false

The Glassfish log contains no logging information.

The Netbeans IDE log contains the following:

INFO [glassfish]: Requested Entity: public id = -//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN, system id = http://glassfish.org/dtds/glassfish-resources_1_5.dtd
INFO [null]: Last record repeated again.
WARNING [glassfish-eecommon]: Deployment plan not supported in GlassfishConfiguration.save()
INFO [org.netbeans.modules.glassfish.tooling.admin.RunnerHttpDeploy]: IO exception caught in handleSend() method:
java.io.IOException: Error writing request body to server
    at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3518)
    at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3501)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
    at java.util.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:255)
    at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:360)
    at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:238)
    at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:377)
[catch] at org.netbeans.modules.glassfish.tooling.admin.RunnerHttpDeploy.handleSend(RunnerHttpDeploy.java:267)
    at org.netbeans.modules.glassfish.tooling.admin.Runner.handleHTTPConnection(Runner.java:828)
    at org.netbeans.modules.glassfish.tooling.admin.Runner.call(Runner.java:939)
    at org.netbeans.modules.glassfish.tooling.admin.Runner.call(Runner.java:73)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
INFO [org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment]
The module has not been deployed.
See the server log for details.
[catch] at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:259)
    at org.netbeans.modules.maven.j2ee.execution.DeploymentHelper.perform(DeploymentHelper.java:208)
    at org.netbeans.modules.maven.j2ee.execution.CoSAlternativeExecutorImpl.execute(CoSAlternativeExecutorImpl.java:90)
    at org.netbeans.modules.maven.cos.CoSAlternativeExecutor.execute(CoSAlternativeExecutor.java:87)
    at org.netbeans.modules.maven.cos.CosChecker.checkRunMainClass(CosChecker.java:209)
    at org.netbeans.modules.maven.cos.CosChecker.checkRunConfig(CosChecker.java:163)
    at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:225)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
INFO [glassfish]: Requested Entity: public id = -//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN, system id = http://glassfish.org/dtds/glassfish-resources_1_5.dtd
INFO [null]: Last record repeated again.
WARNING [glassfish-eecommon]: Deployment plan not supported in GlassfishConfiguration.save()
INFO [org.netbeans.modules.glassfish.tooling.admin.RunnerHttpDeploy]: IO exception caught in handleSend() method:
java.io.IOException: Error writing request body to server
    at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3518)
    at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3501)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
    at java.util.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:255)
    at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:360)
    at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:238)
    at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:377)
[catch] at org.netbeans.modules.glassfish.tooling.admin.RunnerHttpDeploy.handleSend(RunnerHttpDeploy.java:267)
    at org.netbeans.modules.glassfish.tooling.admin.Runner.handleHTTPConnection(Runner.java:828)
    at org.netbeans.modules.glassfish.tooling.admin.Runner.call(Runner.java:939)
    at org.netbeans.modules.glassfish.tooling.admin.Runner.call(Runner.java:73)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
INFO [org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment]
The module has not been deployed.
See the server log for details.
[catch] at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:259)
    at org.netbeans.modules.maven.j2ee.execution.DeploymentHelper.perform(DeploymentHelper.java:208)
    at org.netbeans.modules.maven.j2ee.execution.ExecutionChecker.executionResult(ExecutionChecker.java:93)
    at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:315)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)

Netbeans version: 8.2
Glassfish version: 3.1.2.2 (build 5)
Platform: reproducible on both Windows10 + Debian9
Maven version: 3.3.9
JDK: 1.7.0_80
Glassfish secure admin is enabled

The EAR produced can be normally deployed to Glassfish using the asadmin command. It is only when trying to deploy it through Netbeans that it fails so.

EDIT

It seems that when secure admin is disabled i am able to perform the deployment through Netbeans. I have come across some problems with the secure admin and ssl.

This is the best answer i could find that described the issue i am experiencing: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206913035-Glassfish-3-1-remote-deploy-not-working (even though it is for another IDE).

This is not an accepted solution though because the secure admin is a requirement for everyday dev work.


EDIT 2

After experimenting a bit more i have observed the following:

Since the Glassfish logs are empty, and the netbeans IDE log contains an error having to do with HttpUrlConnection i think that after netbeans finishes the build process it fails to write the EAR to the socket.

  • I have experimented with other EAR projects (generated a new maven EAR from netbeans) and it deploys OK to Glassfish.

  • I have come across an article that mentions a bug in Netbeans failing to write archives of a certain size. I have tried to generate a new maven project with a large final EAR size but it deploys OK. The bug is quite old and has since been fixed: https://netbeans.org/bugzilla/show_bug.cgi?id=206946


EDIT 3

After experimenting with the POM file and removing all dependencies and trying adding one by one back in it seems that this issue is triggered by the inclusion of an EJB dependency.

Including a depencency of type ejb and declaring it as an ejbModule in the maven ear plugin modules section seems to be triggering the issue.

<dependency>
    <groupId>com.foo</groupId>
    <artifactId>BAR</artifactId>
    <version>1.0</version>
    <type>ejb</type>
</dependency>
.
.
.
.
<ejbModule>
    <groupId>com.foo</groupId>
    <artifactId>BAR</artifactId>
    <altDeploymentDescriptor>AltDD.xml</altDeploymentDescriptor>
</ejbModule>

I still don't know why this issue is triggered. I have read online that there might be an issue with file size but i have been unable to reproduce it.

like image 304
sm0ke21 Avatar asked Oct 02 '17 18:10

sm0ke21


1 Answers

This might be happening on Netbeans when stopped on a breakpoint, and then some deployments might tend to fail immediately.

The BUG-253630 mentions a reproducible scenario for such as use case:-

1. Run app with DoS off (DoS state MODULE_NOT_DEPLOYED)
2. Debug it
3. App stopped at breakpoint
4. Change source (DoS state SERVER_STATE_UNSUPPORTED)
5. Continue with the app (release breakpoint, detach JPDA)
6. Change source (DoS state MODULE_UPDATED)

Also, make sure that for remote administration you will have to set an admin password before performing the actual enabling:

asadmin change-admin-password --domain_name [DOMAIN_NAME]
asadmin enable-secure-admin --port [PORT_NAME]

..and apart from just that, you can even try setting the password as empty if that might help as well.

like image 144
Naman Avatar answered Sep 27 '22 20:09

Naman