2

I was able to deploy my WAR the first time I placed it under domains/domain1/autodeploy dir. However, after making some changes and redeploying the WAR to the autodeploy dir, the changes were not picked up. I even deleted domains/domain1/applications/myapp (where myapp corresponds to the myapp.jar being deployed) but the WAR was not redeployed. The server was started and stopped via asadmin:

asadmin start-domain
asadmin stop-domain

What am I doing wrong so that the app does not get redeployed?

UPDATE: I tried manually (re)deploying (also using --force option) the WAR but got the following error in server.log:

[#|2013-03-17T20:47:36.177-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=72;_ThreadName=Thread-2;|Application with name myprojectname is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name|#]

I do not know how to unregister/undeploy an app that's been once deployed. I tried removing all the references to my app in domain.xml but it didn't work. This seems like a very basic bug in the software.

amphibient
  • 29,770
  • 54
  • 146
  • 240

3 Answers3

11

I know this was answered long ago, but in case anyone else gets here via google like I did, I have another possible answer ...

After encountering this same issue, I found the following ... the autodeploy/.autodeploystatus directory still had a file referencing the application I was trying to redeploy by copying the war into the autodeploy directory. I had to delete the file in the autodeploy/.autodeploystatus directory, then my application was deployed when the war was copied into the autodeploy directory.

Hope that helps.

NOTE: Apparently, it is obvious to others who use glassfish that you have to delete all this stuff from the hidden .autodeploystatus directory to get your re-deploys to work. Why is it obvious to them? We may never know.

Vernon
  • 411
  • 3
  • 9
3

You can undeploy via asadamin with:

asadmin undeploy yourapplication

You can also visit the glassfish admin console http://localhost:4848 and undeploy via the graphical interface (look at Applications).

In general the re-autodeployment should work, but I would recommend using the normal deploy method or an incremental redeployment by some IDE like NetBeans...

unwichtich
  • 13,712
  • 4
  • 53
  • 66
  • 1
    I tried what you say but it told me that no such app existed. But when I tried to redeploy it, it told me it existed. #puzzled – amphibient Mar 18 '13 at 14:43
0

Exactly the same problem reappears for an application running to be deployed in Payara 5.2021.10 (perhaps for other recent versions > 5.193) within a docker container.

The problem happens every time the docker container restarts - the deployment fails with a message:

Application with name {applicationName} is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name

The problem can be fixed by a forced redeploy. Place something like this into a Dockerfile of the application image:

ENV DEPLOY_PROPS="--force=true"

This environment variable allows to set custom parameters to asadmin's deploy command. How exactly is it applied can be seen in the script that generates the deploy commands, that is being run from within the container's entrypoint.

helvete
  • 2,455
  • 13
  • 33
  • 37