war file share classes

Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

war file share classes

Alin Simionoiu-4

Is there any way I can share classes between two or more war files?.

 

Example:

 

app1.war has this class com.test.package1.Package1Class

 

in app2.war I have a servlet that makes a call to Package1Class that is in app1.war.

 

How can I do this?. I see that I can define a list of packages as systemClasses. I tried and it doesn’t seem to work, maybe a miss configure something.

Is this the way to do it?

 

p.s

I prefer not to put all my common classes in a jar that will live in $JETTY_HOME/lib to be loaded at startup if is possible.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: war file share classes

Alin Simionoiu-4
Anybody?

________________________________________
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Alin
Simionoiu
Sent: Friday, July 20, 2007 5:26 PM
To: [hidden email]
Subject: [Jetty-support] war file share classes

Is there any way I can share classes between two or more war files?.

Example:

app1.war has this class com.test.package1.Package1Class

in app2.war I have a servlet that makes a call to Package1Class that is
in app1.war.

How can I do this?. I see that I can define a list of packages as
systemClasses. I tried and it doesn't seem to work, maybe a miss
configure something.
Is this the way to do it?

p.s
I prefer not to put all my common classes in a jar that will live in
$JETTY_HOME/lib to be loaded at startup if is possible.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: war file share classes

Jan Bartel
Alin,

If you want your webapps to share classes, then they must all be able to
access those classes from a common classloader.

The easiest, no brainer, guaranteed way to do it is to simply put them
into a jar in $jetty.home/lib/ext.

If you don't want to do that, then you can use the system property
jetty.class.path to specify extra common classpaths on the runline.

All the info you need on Jetty classloading is here:

http://docs.codehaus.org/display/JETTY/Classloading


regards
Jan

Alin Simionoiu wrote:

> Anybody?
>
> ________________________________________
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Alin
> Simionoiu
> Sent: Friday, July 20, 2007 5:26 PM
> To: [hidden email]
> Subject: [Jetty-support] war file share classes
>
> Is there any way I can share classes between two or more war files?.
>
> Example:
>
> app1.war has this class com.test.package1.Package1Class
>
> in app2.war I have a servlet that makes a call to Package1Class that is
> in app1.war.
>
> How can I do this?. I see that I can define a list of packages as
> systemClasses. I tried and it doesn't seem to work, maybe a miss
> configure something.
> Is this the way to do it?
>
> p.s
> I prefer not to put all my common classes in a jar that will live in
> $JETTY_HOME/lib to be loaded at startup if is possible.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>


--
Jan Bartel, Webtide LLC | [hidden email] | http://www.webtide.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: war file share classes

Alin Simionoiu-4
Jan,

Thank you for your response, it's pretty much what I thought.
 
I actually read that page before writing this email, and I also did some
research on jetty mailing lists.

 I tried setting the SystemClasses property with my own java packages
but it didn't work. My conclusion was that either what I want is not
possible or I didn't configure correctly the SystemClasses parameter (or
I completely misunderstood it's meaning).

Bottom line: there's no way to use a common classloader between two web
applications using just the war files (no jar's in lib/ext or some other
customer folder that is in jetty.class.path).
Right?

Regards,
Alin

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Jan
Bartel
Sent: Tuesday, July 24, 2007 4:41 PM
To: Jetty usage, help & informal support
Subject: Re: [Jetty-support] war file share classes

Alin,

If you want your webapps to share classes, then they must all be able to
access those classes from a common classloader.

The easiest, no brainer, guaranteed way to do it is to simply put them
into a jar in $jetty.home/lib/ext.

If you don't want to do that, then you can use the system property
jetty.class.path to specify extra common classpaths on the runline.

All the info you need on Jetty classloading is here:

http://docs.codehaus.org/display/JETTY/Classloading


regards
Jan

Alin Simionoiu wrote:

> Anybody?
>
> ________________________________________
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Alin
> Simionoiu
> Sent: Friday, July 20, 2007 5:26 PM
> To: [hidden email]
> Subject: [Jetty-support] war file share classes
>
> Is there any way I can share classes between two or more war files?.
>
> Example:
>
> app1.war has this class com.test.package1.Package1Class
>
> in app2.war I have a servlet that makes a call to Package1Class that
is

> in app1.war.
>
> How can I do this?. I see that I can define a list of packages as
> systemClasses. I tried and it doesn't seem to work, maybe a miss
> configure something.
> Is this the way to do it?
>
> p.s
> I prefer not to put all my common classes in a jar that will live in
> $JETTY_HOME/lib to be loaded at startup if is possible.
>
>
------------------------------------------------------------------------
-
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a
browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>


--
Jan Bartel, Webtide LLC | [hidden email] | http://www.webtide.com

------------------------------------------------------------------------
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: war file share classes

Jan Bartel
Alin,

You'd have to write a custom classloader that permitted the classes from
one webapp to be visible to the other (which is pretty much what the whole
j2ee architecture is trying to avoid :-) ), and then tell Jetty to use that
classloader instead of the default (see WebAppContext.setClassLoader(ClassLoader)).

BTW the SystemClasses parameter says which classes cannot be overridden by
classes within a webapp - eg classes in java, javax.servlet packages. By not
being overridden it means that they will be obtained from the system classloader
and NOT the webapps' classloader. So, unless you have your shared classes on
the system classpath, setting the SystemClasses parameter isn't going to do
you any good anyway.

regards
Jan

Alin Simionoiu wrote:

> Jan,
>
> Thank you for your response, it's pretty much what I thought.
>  
> I actually read that page before writing this email, and I also did some
> research on jetty mailing lists.
>
>  I tried setting the SystemClasses property with my own java packages
> but it didn't work. My conclusion was that either what I want is not
> possible or I didn't configure correctly the SystemClasses parameter (or
> I completely misunderstood it's meaning).
>
> Bottom line: there's no way to use a common classloader between two web
> applications using just the war files (no jar's in lib/ext or some other
> customer folder that is in jetty.class.path).
> Right?
>
> Regards,
> Alin
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Jan
> Bartel
> Sent: Tuesday, July 24, 2007 4:41 PM
> To: Jetty usage, help & informal support
> Subject: Re: [Jetty-support] war file share classes
>
> Alin,
>
> If you want your webapps to share classes, then they must all be able to
> access those classes from a common classloader.
>
> The easiest, no brainer, guaranteed way to do it is to simply put them
> into a jar in $jetty.home/lib/ext.
>
> If you don't want to do that, then you can use the system property
> jetty.class.path to specify extra common classpaths on the runline.
>
> All the info you need on Jetty classloading is here:
>
> http://docs.codehaus.org/display/JETTY/Classloading
>
>
> regards
> Jan
>
> Alin Simionoiu wrote:
>> Anybody?
>>
>> ________________________________________
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of Alin
>> Simionoiu
>> Sent: Friday, July 20, 2007 5:26 PM
>> To: [hidden email]
>> Subject: [Jetty-support] war file share classes
>>
>> Is there any way I can share classes between two or more war files?.
>>
>> Example:
>>
>> app1.war has this class com.test.package1.Package1Class
>>
>> in app2.war I have a servlet that makes a call to Package1Class that
> is
>> in app1.war.
>>
>> How can I do this?. I see that I can define a list of packages as
>> systemClasses. I tried and it doesn't seem to work, maybe a miss
>> configure something.
>> Is this the way to do it?
>>
>> p.s
>> I prefer not to put all my common classes in a jar that will live in
>> $JETTY_HOME/lib to be loaded at startup if is possible.
>>
>>
> ------------------------------------------------------------------------
> -
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems?  Stop.
>> Now Search log events and configuration files using AJAX and a
> browser.
>> Download your FREE copy of Splunk now >>  http://get.splunk.com/
>> _______________________________________________
>> Jetty-support mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jetty-support
>>
>
>


--
Jan Bartel, Webtide LLC | [hidden email] | http://www.webtide.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: war file share classes

malini
This post has NOT been accepted by the mailing list yet.
Hello Jan,
   Though its been years since it was answered, I just want to confirm this..

I have two webApps say war1 and war 2. These two war files shares common functionalities. Hence, I packed these functionalities into a JAR file and access it using manifest file. Is this can be used or should I prefer custom class loader?

Thanks in advance :-)