You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Barry van Someren <go...@gmail.com> on 2005/10/23 22:16:01 UTC

Deploying exploded WAR's

Hi there,

The deploy instructions show how to deploy WAR's only deals with packed WAR's.
Can you also deploy exploded WAR's in Geronimo (just like you can do
with Tomcat)?
And what about creating flat files? (writing in the deployed/work directory)
I'm trying out some open source projects to see how well they work
under Geronimo (to add to the samples matrix)
I'm only learning here, sorry ;-)

Greets,

Barry

Re: Deploying exploded WAR's

Posted by Barry van Someren <go...@gmail.com>.
This discussion was never really meant as a bug report or feature
request, but it's always good to look at improving whats out there.
Such a provider might be nice and I was thinking of something like that.

Perhaps I can pick this up as my first GBean?

On 10/24/05, David Jencks <da...@yahoo.com> wrote:
>
> On Oct 23, 2005, at 11:32 PM, Barry van Someren wrote:
>
> > David,
> >
> > My experience with persistance in webapps has been with using
> > databases.
> > I recently ran into a JSP based Wiki that uses flat files (most likely
> > in the working directory) to persist data.
> >
> > Now I remember that back at my old company we used Tomcat for a
> > project and it would let you add files to the working directory that
> > would persist between runs.
> > When you used JBoss, it wouldn't (and I reasoned that it's fair from a
> > security point of view)
> > So I'm kind of asking how Geronimo handles this and what is the best
> > way of persisting if you insist on flat files.
>
> Well, I would avoid having your application save anything in its own
> unpacked directory at all costs: this is just asking for trouble, for
> instance, when you deploy the next upgrade :-).
>
> I recommend creating a subdirectory under var (e.g. var/myAppData).
> Unfortunately AFAIK finding this at runtime is a bit involved.
>
> private static final ObjectName SERVER_INFO =
> ObjectName.getInstance("geronimo.server:
> J2EEApplication=null,J2EEModule=org/apache/geronimo/
> System,J2EEServer=geronimo,j2eeType=GBean,name=ServerInfo");
>
> Kernel kernel = KernelRegistry.getSingleKernel();
> File dir = (FIle)kernel.invoke(SERVER_INFO, "resolve", new Object[]
> {"var/myAppData"}, new String[] {String.class.getName()});
>
> There might be an easier way to get this but I don't know what it is.
>
> It would be nice to provide a better way :-)  Perhaps we could write a
> URLHandler that would resolve for us?  serverinfo://var/myAppData  Any
> other ideas?
>
> thanks
> david jencks
>
> >
> > Greetings,
> >
> > Barry
> >
> >
> > On 10/24/05, David Jencks <da...@yahoo.com> wrote:
> >>
> >> On Oct 23, 2005, at 1:16 PM, Barry van Someren wrote:
> >>
> >>> Hi there,
> >>>
> >>> The deploy instructions show how to deploy WAR's only deals with
> >>> packed WAR's.
> >>> Can you also deploy exploded WAR's in Geronimo (just like you can do
> >>> with Tomcat)?
> >>
> >> I think so.  Note that any war or ear with a war inside will get
> >> unpacked into the config-store.  I think if you modify jsps or static
> >> content there the changes will get picked up.
> >>
> >> We've had a plan for a while to make it possible to deploy a war so
> >> that jsps and static content are picked up from the original source
> >> location rather than a deployed copy.  This would let you work on your
> >> jsps in your IDE in the location your SCM system knows about yet see
> >> the changes immediately.  I'm not sure if anyone has had the time to
> >> expose this functionality yet.  I would think this would be more
> >> useful
> >> than an "unpacked war" deploy feature.
> >>
> >>> And what about creating flat files? (writing in the deployed/work
> >>> directory)
> >>
> >> Could you explain what you have in mind here in more detail?
> >>
> >>> I'm trying out some open source projects to see how well they work
> >>> under Geronimo (to add to the samples matrix)
> >>
> >> Great!
> >>> I'm only learning here, sorry ;-)
> >>
> >> Well, hopefully I'm learning here too :-)
> >>
> >> thanks
> >> david jencks
> >>
> >>>
> >>> Greets,
> >>>
> >>> Barry
> >>>
> >>
> >>
> >
>
>

Re: Deploying exploded WAR's

Posted by David Jencks <da...@yahoo.com>.
On Oct 23, 2005, at 11:32 PM, Barry van Someren wrote:

> David,
>
> My experience with persistance in webapps has been with using  
> databases.
> I recently ran into a JSP based Wiki that uses flat files (most likely
> in the working directory) to persist data.
>
> Now I remember that back at my old company we used Tomcat for a
> project and it would let you add files to the working directory that
> would persist between runs.
> When you used JBoss, it wouldn't (and I reasoned that it's fair from a
> security point of view)
> So I'm kind of asking how Geronimo handles this and what is the best
> way of persisting if you insist on flat files.

Well, I would avoid having your application save anything in its own  
unpacked directory at all costs: this is just asking for trouble, for  
instance, when you deploy the next upgrade :-).

I recommend creating a subdirectory under var (e.g. var/myAppData).   
Unfortunately AFAIK finding this at runtime is a bit involved.

private static final ObjectName SERVER_INFO =  
ObjectName.getInstance("geronimo.server: 
J2EEApplication=null,J2EEModule=org/apache/geronimo/ 
System,J2EEServer=geronimo,j2eeType=GBean,name=ServerInfo");

Kernel kernel = KernelRegistry.getSingleKernel();
File dir = (FIle)kernel.invoke(SERVER_INFO, "resolve", new Object[]  
{"var/myAppData"}, new String[] {String.class.getName()});

There might be an easier way to get this but I don't know what it is.

It would be nice to provide a better way :-)  Perhaps we could write a  
URLHandler that would resolve for us?  serverinfo://var/myAppData  Any  
other ideas?

thanks
david jencks

>
> Greetings,
>
> Barry
>
>
> On 10/24/05, David Jencks <da...@yahoo.com> wrote:
>>
>> On Oct 23, 2005, at 1:16 PM, Barry van Someren wrote:
>>
>>> Hi there,
>>>
>>> The deploy instructions show how to deploy WAR's only deals with
>>> packed WAR's.
>>> Can you also deploy exploded WAR's in Geronimo (just like you can do
>>> with Tomcat)?
>>
>> I think so.  Note that any war or ear with a war inside will get
>> unpacked into the config-store.  I think if you modify jsps or static
>> content there the changes will get picked up.
>>
>> We've had a plan for a while to make it possible to deploy a war so
>> that jsps and static content are picked up from the original source
>> location rather than a deployed copy.  This would let you work on your
>> jsps in your IDE in the location your SCM system knows about yet see
>> the changes immediately.  I'm not sure if anyone has had the time to
>> expose this functionality yet.  I would think this would be more  
>> useful
>> than an "unpacked war" deploy feature.
>>
>>> And what about creating flat files? (writing in the deployed/work
>>> directory)
>>
>> Could you explain what you have in mind here in more detail?
>>
>>> I'm trying out some open source projects to see how well they work
>>> under Geronimo (to add to the samples matrix)
>>
>> Great!
>>> I'm only learning here, sorry ;-)
>>
>> Well, hopefully I'm learning here too :-)
>>
>> thanks
>> david jencks
>>
>>>
>>> Greets,
>>>
>>> Barry
>>>
>>
>>
>


Re: Deploying exploded WAR's

Posted by Barry van Someren <go...@gmail.com>.
Hi,

I never really thought of that actually.
Makes sense that if you would use flat file persistance, that you'd
write to the home directory as you are bound to have rights there and
the App server won't touch it.
However, I'd never do that (I learned to use a database for things
such as persistance) but it might be a good idea if you were to make
something like an image gallery where you have large amounts of binary
data floating around.

Note that I'm just testing existing WebApps and seeing how they work
within Geronimo (see the samples discussion)
I never bothered to check my home directory though, thanks ;-)

As for hot-editing configuration and current classes.. well it should
be possible, but not by editting files in the WAR (but this is outside
the scope of this discussion)

Regards,

Barry

On 10/24/05, Miguel A Paraz <mp...@gmail.com> wrote:
> On 10/24/05, Miguel A Paraz <mp...@gmail.com> wrote:
> > I think you should use a directory outside ${user.home} ...
>
> Sorry, I meant, a directory inside ${user.home}.
>

Re: Deploying exploded WAR's

Posted by Miguel A Paraz <mp...@gmail.com>.
On 10/24/05, Miguel A Paraz <mp...@gmail.com> wrote:
> I think you should use a directory outside ${user.home} ...

Sorry, I meant, a directory inside ${user.home}.

Re: Deploying exploded WAR's

Posted by Miguel A Paraz <mp...@gmail.com>.
On 10/24/05, Barry van Someren <go...@gmail.com> wrote:
> My experience with persistance in webapps has been with using databases.
> I recently ran into a JSP based Wiki that uses flat files (most likely
> in the working directory) to persist data.

I think you should use a directory outside ${user.home} ... the WAR
structure should be immutable even if it's unpacked. The only reason
to allow unpacked archives should be to edit config files, and only if
the webapp is undeployed. I don't think it's a good idea to allow hot
editing of files. IMHO of course.

Re: Deploying exploded WAR's

Posted by Barry van Someren <go...@gmail.com>.
David,

My experience with persistance in webapps has been with using databases.
I recently ran into a JSP based Wiki that uses flat files (most likely
in the working directory) to persist data.

Now I remember that back at my old company we used Tomcat for a
project and it would let you add files to the working directory that
would persist between runs.
When you used JBoss, it wouldn't (and I reasoned that it's fair from a
security point of view)
So I'm kind of asking how Geronimo handles this and what is the best
way of persisting if you insist on flat files.

Greetings,

Barry


On 10/24/05, David Jencks <da...@yahoo.com> wrote:
>
> On Oct 23, 2005, at 1:16 PM, Barry van Someren wrote:
>
> > Hi there,
> >
> > The deploy instructions show how to deploy WAR's only deals with
> > packed WAR's.
> > Can you also deploy exploded WAR's in Geronimo (just like you can do
> > with Tomcat)?
>
> I think so.  Note that any war or ear with a war inside will get
> unpacked into the config-store.  I think if you modify jsps or static
> content there the changes will get picked up.
>
> We've had a plan for a while to make it possible to deploy a war so
> that jsps and static content are picked up from the original source
> location rather than a deployed copy.  This would let you work on your
> jsps in your IDE in the location your SCM system knows about yet see
> the changes immediately.  I'm not sure if anyone has had the time to
> expose this functionality yet.  I would think this would be more useful
> than an "unpacked war" deploy feature.
>
> > And what about creating flat files? (writing in the deployed/work
> > directory)
>
> Could you explain what you have in mind here in more detail?
>
> > I'm trying out some open source projects to see how well they work
> > under Geronimo (to add to the samples matrix)
>
> Great!
> > I'm only learning here, sorry ;-)
>
> Well, hopefully I'm learning here too :-)
>
> thanks
> david jencks
>
> >
> > Greets,
> >
> > Barry
> >
>
>

Re: Deploying exploded WAR's

Posted by David Jencks <da...@yahoo.com>.
On Oct 23, 2005, at 1:16 PM, Barry van Someren wrote:

> Hi there,
>
> The deploy instructions show how to deploy WAR's only deals with 
> packed WAR's.
> Can you also deploy exploded WAR's in Geronimo (just like you can do
> with Tomcat)?

I think so.  Note that any war or ear with a war inside will get 
unpacked into the config-store.  I think if you modify jsps or static 
content there the changes will get picked up.

We've had a plan for a while to make it possible to deploy a war so 
that jsps and static content are picked up from the original source 
location rather than a deployed copy.  This would let you work on your 
jsps in your IDE in the location your SCM system knows about yet see 
the changes immediately.  I'm not sure if anyone has had the time to  
expose this functionality yet.  I would think this would be more useful 
than an "unpacked war" deploy feature.

> And what about creating flat files? (writing in the deployed/work 
> directory)

Could you explain what you have in mind here in more detail?

> I'm trying out some open source projects to see how well they work
> under Geronimo (to add to the samples matrix)

Great!
> I'm only learning here, sorry ;-)

Well, hopefully I'm learning here too :-)

thanks
david jencks

>
> Greets,
>
> Barry
>