tags:

views:

451

answers:

5

Hi! I need a windows shell script which will redeploy my .ear file. I wrote one:

net stop "JBAS50SVC"
copy /y O:\TEMP\app.ear C:\jboss-4.2.3.GA\server\default\deploy\app.ear
net start "JBAS50SVC"

But the problem is that when I try to stop the JBoss service it does not fully unload itself (my suggestion), so when I start it there's no app deployed in JBoss.

A: 

You might want to check the JBoss community wiki on this, there are undoubtedly easier and more reliable methods than a batch file.

Stopping the server should not undeploy the application - that wouldn't make much sense.

matt b
I stop the service just to copy my new .ear file. I don't want to use autodeploy feature, because in this case JBoss becomes very slow after a month or two.
axgusev
+1  A: 

You can just COPY/RENAME the EAR file to deploy directory. JBoss will automatically take care of re-deployment for you.

Pablo Santa Cruz
+1  A: 

As mentioned earlier jboss automatically deploys everything you copy into the deploy directory by default.

If not, check if you are working on a vhost that doesnt autodeploy ear files.

<Host name="vhost2" autoDeploy="false" .... />

other than that, I feel like this is a totally different error due to the fact that jboss takes care of deployment for you. Please check the log files for startup errors of your application.

Stefan Ernst
Yes, jboss automatically deploys files, but when I use autodeploy feature and JBoss has been working for month or more it becomes very slow.
axgusev
A: 

Typically to redeploy an application that is self-contained in an ear in jboss just requires replacing the ear. If there is more to the application (such as classes that have to go in the jboss lib directory) then it may require a restart.

In terms of how to restart it, it depends what you are using to start jboss as a service. Some service starters do not actually control the jvm after they start it, so restarting the service just starts a second instance. You can shutdown jboss with the shutdown script in the JBOSS_HOME/bin directory (shutdown.bat) and then deploy and restart the service. Be sure to pause when you do this, as the shutdown command will issue the shutdown request, the server may still be running.

Yishai
Thank you! Seems that this is what I was looking for.
axgusev
A: 

You mentioned that JBoss becomes very slow when you use autoDeploy and keep the server running for a month or more. That's likely to be because your permanent generation memory is filling up over time. See this related question.

I think you'd be best served by using the autoDeploy feature as other suggest, and restarting the entire server periodically to clear out PermGen. There's several ways to track PermGen utilization; I add the following to JAVA_OPTS in run.conf:

-XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -Xloggc:$LOGDIR/gc.log
pra
Thank you! Seems that this is the only viable solution.
axgusev