开发者

java.net.BindException: No free port within range in Glassfish 3.1

开发者 https://www.devze.com 2023-03-16 14:17 出处:网络
Today I have deployed an app to our product开发者_C百科ion application server GlassfishV3 through Jenkins CI to the autodeploy folder. The app server went down, and I cannot bring it back up.

Today I have deployed an app to our product开发者_C百科ion application server GlassfishV3 through Jenkins CI to the autodeploy folder. The app server went down, and I cannot bring it back up.

My goal is to have the server up and running the same as prior to deploying the application. This is what I have done:

  1. First find the PID of the process running at port 4848: nestat -nlept
  2. Then kill the PID by doing kill -9 PID
  3. Remove the war file that Jenkinks just put in the autodeploy directory just in case if that is the problem.
  4. Start the server again by doing ./asadmin start-domain domain1
  5. The server takes FOREVER to start !!! In fact it never starts successfully as I cannot access the admin console at 4848 or any of the other apps that were already running. However, it leaves a process running at 4848.
  6. I looked at the jvm.log and server.log and I found a java.net.BindException:No free port within range.........

So my questions are as follows:

  1. Do you know what is going on?
  2. Do you know how to fix it?
  3. Do you know of a way to speed up the ./asadmin start-domain domain1 process?

Note: In our QA app server (Same version, same OS, Same Java, Same Grails) it does not happen. Really frustrated with this issue.

Thanks a lot for your help. Any help would be very much appreciated as this is a production issue that has several applications down for a few hours already.

  • Dario


I can deploy my application now, basically it boiled down to increasing the MaxPermSize jvm option

Under the config folder, edit domain.xml and change the default size to this:

-XX:MaxPermSize=256m

You can always increase it as necessary.

Also, if that is not enough you can also change the max heap size in that same file

-Xmx512m . I have left it as is but if required you can change that to 6g or more on a 64 bit OS. On a 32 bit OS it will only recognize up to 3.5g.

Hope this helps somebody else in the future, as this issue kept me at work until 9:00PM

UPDATE:

I had peformance issues again and I found this other solution in Joshi's tech blog: http://joshitech.blogspot.com/2009/09/glassfish-application-server.html

Basically add the following jvm options in the domain.xml. It should increase Glassfish boot up and deployment performance:

<jvm-options>-server</jvm-options>
<jvm-options>-Xms3000m</jvm-options>
<jvm-options>-Xmx3000m</jvm-options>
<jvm-options>-XX:MaxPermSize=192m</jvm-options> 
<jvm-options>-XX:NewRatio=2</jvm-options> 
<jvm-options>-XX:+AggressiveHeap</jvm-options>
<jvm-options>-XX:+AggressiveOpts</jvm-options>
<jvm-options>-XX:+UseParallelGC</jvm-options>
<jvm-options>-XX:+UseParallelOldGC</jvm-options>
<jvm-options>-XX:ParallelGCThreads=5</jvm-options>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号