dmitry
dmitry

Reputation: 5049

glassfish3 deploy error: Application ... is already deployed in this domain

I am trying to deploy my war file into glassfish 3, but it fails to do so:

./asadmin deploy --force=true myapp.war
remote failure: Error occurred during deployment: Application myapp is already 
deployed in this domain. Please use create-application-ref command to create 
application reference on target server. Please see server.log for more 
details.
Command deploy failed.

server.log says basically the same message and nothing else. I've set logging level to FINEST and it is still just the same, a lot of messages about parsing web.xml and then boom:

[#|2018-03-27T14:09:43.912+0400|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=122;_ThreadName=Thread-2;|Application myapp is already deployed in this domain. Please use create-application-ref command to create application reference on target server|#]

But if I do undeploy myapp is not found, neither it is shown by asadmin list-applications. Is there any way to understand what is wrong and fix it?

UPDATE: So far I ended up reading glassfish sources, and this is very time consuming. No answer found up to now, though. Humanity, this is one of those rare cases when I really need your help :)

Upvotes: 2

Views: 2206

Answers (3)

helvete
helvete

Reputation: 2673

I encountered the same problem and @dmitry's solution works for me.

Just to be clear I had to delete the lines starting with -> from within my domain.xml template in order to be able to autodeploy w/out problems; as seen in these snippets:

  <servers>                                                                        
    <server config-ref="server-config" name="server">                              
->    <application-ref ref="portal" virtual-servers="server"></application-ref> 
      <application-ref ref="__admingui" virtual-servers="__asadmin"></application-ref>
      <resource-ref ref="jdbc/__TimerPool"></resource-ref>                         
      <resource-ref ref="jdbc/__default"></resource-ref>                           
      <resource-ref ref="jdbc/__derby"></resource-ref>                             
      <resource-ref ref="concurrent/__defaultManagedExecutorService"></resource-ref>
      <resource-ref ref="concurrent/__defaultManagedScheduledExecutorService"></res ... >

and

  <applications>                                                                   
->  <application context-root="/portal" deployment-time="3867" object-type="user" ... >
->    <property name="archiveType" value="war"></property>                         
->    <property name="cdiDevModeEnabled" value="false"></property>                 
->    <property name="appLocation" value="${com.sun.aas.instanceRootURI}/applic ... " >
->    <property name="defaultAppName" value="portal"></property>                   
->    <module name="portal">                                                       
->      <engine sniffer="cdi"></engine>                                            
->      <engine sniffer="security"></engine>                                       
->      <engine sniffer="web"></engine>                                            
->    </module>                                                                    
->  </application>                                                                 
  </applications>

Upvotes: 0

Jordan A. Silva C.
Jordan A. Silva C.

Reputation: 1

deploy by glasfish console

error>Application … is already deployed in this domain

Applications>Application Targets>Manage Targets

select your target>save

Upvotes: 0

dmitry
dmitry

Reputation: 5049

Ok, this was outrageously stupid and completely because I wanted to skip details about glassfish in general.

My problem was that I manually added <application> into domain.xml, completely sure that it is done manually. I have supported glassfish hosted apps a lot, redeployed, reconfigured, but never added a new app.

No any clue was given by asadmin and server.log to understand it quickly, so I'd spent 4 hours reading glassfish sources before I had a hint. Finally I removed <application> tag that I added myself and everything worked fine.

Upvotes: 3

Related Questions