Look at workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/xxx/deploy. The 'xxx' contains the serverver name and a random number. For example, on my laptop it is "JBoss_5.1_Runtime_Server1282924151531"
This location is passed to the deployer mbean.
Thanks. I will try to understand this deployer mbean.
Could you tell me where I can read how to deploy an ear myself in this way?
You can use twiddle like this to deploy anything:
twiddle invoke "jboss.system:service=MainDeployer" deploy /some/path/myapp.ear
You can read about twiddle in the JBoss AS docs. But basically:
- invoke - tells twiddle that you want to call an mbean method
- "jboss.system:service=MainDeployer" - the name of the mbean (the quotes are important in Windows)
- deploy - the operation on the mbean. The operation's parameters follow. For the deploy operation there is only one parameter - the full path to the app to deploy, in this case /some/path/myapp.ear
I think that even the MainDeployer is described in the docs, but you can always view the available operations in the jmx-console.
I know this works for 4.2.x and 5.x. Haven't tried it with 6.x
I should also mention that there is one caveat to deploying apops this way - when you restart the app server you will have to redeploy the application. The app server does not keep track of any apps deployed in this fashion.
Of course, if you really like this mechanism, then I recommend setting up a custom run script that starts the app server, checks for when it is running (or simply waits for xx seconds), and then deploys the app.
Thanks again, Peter. I will let you know if I succeeded with twiddle.
I also have another question. When I deploy in eclipse with right click project -> Run as -> Run on server, there is no *-ds.xml file created in eclipse's workspace, so the deployment fails. But 'ant create-project archive' created persistence-dev.xml, so it is there. Have I forgotten something to do?
Using "project -> Run as -> Run on server" will not place a *-ds.xml file on the server. That is because there is no "data source project" available in Eclipse - such a project would let to define yoru data source connection and then deploy the *-ds.xml file for you. Though I think that having a "data source facet" that you could apply to a web or enterprise app project woulkd be helpful - such as facet would do the same as the imaginary "data source project" I mentioned - it is probably worth suggesting in the Tools forum.
The reasons that the Ant script works is that in Ant you can do anything you want and thuse the script contains the necessary steps to deploy the *-ds.xml file. Actually, your text in this regards is a little vague. I cannot tell if you just mean that persistence-ds.xml was only generated by the Ant script or whether it was also deployed by the script. I assumed deployed, but reading it again I think that assumption is incorrect. Just because an Ant script generates a particular file does not mean that Eclipse knows that it should deploy it. For an enterprise app, Eclipse will deploy only the EAR.
I usually get around this in one of two ways. First, I never ever let Eclipse do any builds or deployment - I use only Maven or Ant (and often a combination of the two). Thus since I any doing eveyrhting via srcipts for the command line I have full control over exactly what I want done and when. The few times I have used Eclipse for deploy (usually only for experimentation purposes, I never use this on any development projects) I will deploy the *-ds.xml file manually outside of Eclipse. This often involves building once (since my *-ds.xml source files are always templates with embedded properties that need to be expanded) and then copying the *-ds.xml file to the server/xxx/deploy directory.