You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Geronimo User <ge...@gmail.com> on 2006/12/12 22:41:40 UTC

How to detect a file changed in an exploded web app.

Hello:

I am trying to port an application from JBoss to Geronimo 1.1.1.
Some of what follows is from my memory not from existing deployments, so
there may be small errors in the examples.


In the JBoss application, there is an exploded .war deployed in the JBoss
deploy directory, like this:

C:\Program Files\jboss-4.0.3SP1\server\default\deploy\myapp.war\xml

A stand-alone application writes XML files into the xml directory every n
seconds, e.g.:

C:\Program Files\jboss-
4.0.3SP1\server\default\deploy\myapp.war\xml\Myfile.xml

A Flash applet retrieves the XML files using http, e.g.

http://localhost:8080/context-root/xml/MyFile.xml

and then processes the file and displays the data.

All works fine.


In Geronimo we've tried two approaches.



1. Deploy an exploded .war using the deployer.jar.
This creates an exploded .war in var\temp, e.g.

C:\Program Files\geronimo- 1.1.1\var\temp\my-app\xml

The stand-alone application writes XML files into that directory:

C:\Program Files\geronimo-1.1.1\var\temp\my-app\xml\MyFile.xml

However the browser can't find the XML files when they are requested,
giving a 404 error:

The requested resource (/my-app/xml/MyFile.xml) is not available.


2. Deploy an exploded .war in hot deploy mode, into the deploy directory:

C:\Program Files\geronimo-1.1.1\deploy\my-app\xml

The stand-alone application writes XML files into that directory.

Now the browser can locate and fetch the files.

However the problem now is that approximately every 10 seconds, Geronimo
re-deploys the .war application.

15:57:16,027 INFO  [Hot Deployer] Redeploying my-app
15:57:16,638 INFO  [DirectoryMonitor] Hot deployer notified that an artifact
was removed: com.mycompany/my-app/2.9/war
    Redeployed com.mycompany/my-app/2.9/war


How can we deploy this exploded .war so that
1. The browser can see fetch the most recent XML file written to the xml
directory.
2. Geronimo does not constantly re-deploy the application.

Thanks.

Re: How to detect a file changed in an exploded web app.

Posted by Hernan Cunico <hc...@gmail.com>.
I added some more examples for this command to the documentation 

http://cwiki.apache.org/GMOxDOC11/deployer-tool.html

Cheers!
Hernan

Geronimo User wrote:
> On 12/12/06, David Jencks <da...@yahoo.com> wrote:
>>
>> I can think of 2 things to try:
>>
>> 1. try deploying "offline"
> 
> Hello David:
> 
> I deployed my-app using this as suggested:
> 
> deploy.bat --user system --password manager --offline deploy --inPlace
> <app path>
> 
> It did seem to deploy correctly in Geronimo 1.1.1 when Geronimo was not 
> running.
> 
> Then I had to  do this:
> 
> deploy.bat --user system --password manager --offline start my-app
> ... Started  com.mycompany/my-app/2.9/war
> 
> The "start"  command is necessary because otherwise when I start  Geronimo,
> the application itself is in a "Stopped" state and can't be used.
> I found it interesting that I could start something in offline mode; I
> didn't expect
> that to work.
> 
> After both of  the above commands, when I start Geronimo, everything
> with respect  to this is fine.
> 
> I think this may be the solution to our issues; our installer can deploy
> this .war app in this way and this functionality will work as it should.
> 
> I will let you know if not ;-) and Hernan and David thanks for all your 
> help.
> 
> I would not have been able to decode the usefulness of --inPlace and
> --offline otherwise.
> 

Re: How to detect a file changed in an exploded web app.

Posted by Geronimo User <ge...@gmail.com>.
On 12/12/06, David Jencks <da...@yahoo.com> wrote:
>
> I can think of 2 things to try:
>
> 1. try deploying "offline"

Hello David:

I deployed my-app using this as suggested:

deploy.bat --user system --password manager --offline deploy --inPlace
<app path>

It did seem to deploy correctly in Geronimo 1.1.1 when Geronimo was not running.

Then I had to  do this:

deploy.bat --user system --password manager --offline start my-app
... Started  com.mycompany/my-app/2.9/war

The "start"  command is necessary because otherwise when I start  Geronimo,
the application itself is in a "Stopped" state and can't be used.
I found it interesting that I could start something in offline mode; I
didn't expect
that to work.

After both of  the above commands, when I start Geronimo, everything
with respect  to this is fine.

I think this may be the solution to our issues; our installer can deploy
this .war app in this way and this functionality will work as it should.

I will let you know if not ;-) and Hernan and David thanks for all your help.

I would not have been able to decode the usefulness of --inPlace and
--offline otherwise.

Re: How to detect a file changed in an exploded web app.

Posted by David Jencks <da...@yahoo.com>.
On Dec 12, 2006, at 2:55 PM, Geronimo User wrote:

> On 12/12/06, Hernan Cunico <hc...@gmail.com> wrote:
> Have you tried to deploy with the --inPlace option. It would be  
> some thing like this
>
> java -jar deployer.jar --user system --password manager deploy -- 
> inPlace <app_home>
>
> and point <app_home> to your exploded app dir.
>
> HTH
>
>  Hernan:
>
> Thanks, deploying the application with the --inPlace option did  
> solve my problem.
>
> I can now fetch the XML files using http://localhost:8080/context- 
> root/xml/MyFile.xml
> and because the application is not deployed in the "deploy" directory,
> Geronimo does not constantly redeploy it.
>
> However, my co-worker has given me another challenge.
>
> We need to deploy this exploded .war in an installer application,  
> and we cannot run
> Geronimo's deploy.bat or java -jar deployer.jar, because at the  
> time the customer
> runs our installer, Geronimo is not running. (Our installer also  
> installs Geronimo.)
>
> Is there an option we can put in some Geronimo configuration file,  
> in the app or out of it,
> so the installer can:
> 1. Explode this .war file somewhere on disk.
> 2. Have Geronimo know that this application has been "deployed in  
> place."

I can think of 2 things to try:

1. try deploying "offline"

> java -jar deployer.jar --user system --password manager --offline  
> deploy --inPlace <app_home>

I haven't tried this, and it may be broken in some versions of  
geronimo: I think it works in the upcoming 1.2.  This should have the  
same effect as deploying with geronimo running.

2. don't deploy inplace, but rather teach your xml update tool to  
copy the changed files into where geronimo deploys your app.  If you  
do this, you can predeploy the app into geronimo, package that server  
(including your app) and have your installer simply unpack the server  
with your app already there.  You can customize the geronimo copy to  
for instance only include the parts you use.

If your geronimo plan specifies the module id for your app as
<groupId>myco</groupId>
<artifactId>bigapp</artifactId>
<version>1.2.3</version>
<type>car</type>

then your app will be unpacked into <geronimo-home>/repository/myco/ 
bigapp/1.2.3/bigapp-1.2.3.car/

The quick easy way to do this is to unpack geronimo, deploy your app,  
and then zip up geronimo again.  If you want to do more  
customizations it's easier to use maven and make a custom assembly  
which is how we build the geronimo servers we distribute.  Let us  
know if you're interested and we can give you more pointers.

thanks
david jencks


>
> Thanks!
>


Re: How to detect a file changed in an exploded web app.

Posted by Geronimo User <ge...@gmail.com>.
On 12/12/06, Hernan Cunico <hc...@gmail.com> wrote:
>
> Have you tried to deploy with the --inPlace option. It would be some thing
> like this
>
> java -jar deployer.jar --user system --password manager deploy --inPlace
> <app_home>
>
> and point <app_home> to your exploded app dir.
>
> HTH


 Hernan:

Thanks, deploying the application with the --inPlace option did solve my
problem.

I can now fetch the XML files using
http://localhost:8080/context-root/xml/MyFile.xml
and because the application is not deployed in the "deploy" directory,
Geronimo does not constantly redeploy it.

However, my co-worker has given me another challenge.

We need to deploy this exploded .war in an installer application, and we
cannot run
Geronimo's deploy.bat or java -jar deployer.jar, because at the time the
customer
runs our installer, Geronimo is not running. (Our installer also installs
Geronimo.)

Is there an option we can put in some Geronimo configuration file, in the
app or out of it,
so the installer can:
1. Explode this .war file somewhere on disk.
2. Have Geronimo know that this application has been "deployed in place."

Thanks!

Re: How to detect a file changed in an exploded web app.

Posted by Hernan Cunico <hc...@gmail.com>.
Have you tried to deploy with the --inPlace option. It would be some thing like this

java -jar deployer.jar --user system --password manager deploy --inplace <app_home>

and point <app_home> to your exploded app dir.

HTH

Cheers!
Hernan

Geronimo User wrote:
> Hello:
> 
> I am trying to port an application from JBoss to Geronimo 1.1.1.
> Some of what follows is from my memory not from existing deployments, so
> there may be small errors in the examples.
> 
> 
> In the JBoss application, there is an exploded .war deployed in the 
> JBoss deploy directory, like this:
> 
> C:\Program Files\jboss-4.0.3SP1\server\default\deploy\myapp.war\xml
> 
> A stand-alone application writes XML files into the xml directory every 
> n seconds, e.g.:
> 
> C:\Program 
> Files\jboss-4.0.3SP1\server\default\deploy\myapp.war\xml\Myfile.xml
> 
> A Flash applet retrieves the XML files using http, e.g.
> 
> http://localhost:8080/context-root/xml/MyFile.xml 
> <http://localhost:8080/context-root/xml/MyFile.xml>
> 
> and then processes the file and displays the data.
> 
> All works fine.
> 
> 
> In Geronimo we've tried two approaches.
> 
> 
> 
> 1. Deploy an exploded .war using the deployer.jar.
> This creates an exploded .war in var\temp, e.g.
> 
> C:\Program Files\geronimo- 1.1.1\var\temp\my-app\xml
> 
> The stand-alone application writes XML files into that directory:
> 
> C:\Program Files\geronimo-1.1.1\var\temp\my-app\xml\MyFile.xml
> 
> However the browser can't find the XML files when they are requested,
> giving a 404 error:
> 
> The requested resource (/my-app/xml/MyFile.xml) is not available.
> 
> 
> 2. Deploy an exploded .war in hot deploy mode, into the deploy directory:
> 
> C:\Program Files\geronimo-1.1.1\deploy\my-app\xml
> 
> The stand-alone application writes XML files into that directory.
> 
> Now the browser can locate and fetch the files.
> 
> However the problem now is that approximately every 10 seconds, Geronimo 
> re-deploys the .war application.
> 
> 15:57:16,027 INFO  [Hot Deployer] Redeploying my-app
> 15:57:16,638 INFO  [DirectoryMonitor] Hot deployer notified that an 
> artifact was removed: com.mycompany/my-app/2.9/war
>     Redeployed com.mycompany/my-app/2.9/war
> 
> 
> How can we deploy this exploded .war so that
> 1. The browser can see fetch the most recent XML file written to the xml 
> directory.
> 2. Geronimo does not constantly re-deploy the application.
> 
> Thanks.