You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Ceki Gulcu <ce...@qos.ch> on 2008/11/24 19:58:53 UTC

sample application

Hello all,

After successfully following the "5-minute Tutorial on Enterprise
Application Development with Eclipse and Geronimo" [1] I would like to
build an ear file (ready for deployment in Geronimo) from Maven
pom.xml files, similar to the "mytime" project part of the Geronimo
sample appliccations.

Unfortunately, I am having trouble building the "mytime" sample
application. I obtained it via Subversion at [2]. For one, it takes a
very long time to build, in the order of several hours.

Looking at the pom files, one can see that,

org.apache.geronimo.samples:mytime depends on
org.apache.geronimo.samples:samples:2.12 .pom which in turn depends on
org.apache.geronimo.samples:samples-parent-2.1.2 pom which in turn depends on
org.apache.geronimo.genesis.config:project-config:1.4:pom  which depends on
org.apache.geronimo.genesis.config:config:1.4:pom which in turn depends on
org.apache.geronimo.genesis:genesis:1.4:pom etc...

 From a pedagogical point of view, requiring that many dependencies
makes it hard to follow this sample application.

Is there a sample or maven archetype for a Enterprise Application
Project, compatible with Geronimo, for mere mortals?

Many thanks in advance,

[1] http://tinyurl.com/5jj6zo
[2] http://svn.apache.org/repos/asf/geronimo/samples/trunk/samples

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

Re: sample application

Posted by Ceki Gulcu <ce...@qos.ch>.
Hello David,

I was claiming that the 5 poms were confusing me, not that they took
too long to download. I did know that the sample applications
demonstrated "predeploying" into geronimo as geronimo plugins.

 > To me the main interest of the samples is as geronimo plugins, but we
 > might be able to come up with a profile that would avoid building the
 > plugins and pulling down most of geronimo.

That would be nice indeed.

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

Re: SLF4J in geronimo

Posted by Ceki Gulcu <ce...@qos.ch>.

David Jencks wrote:
> 
> On Nov 27, 2008, at 9:05 AM, Ceki Gulcu wrote:
>>
>> Thus, it seems to me that Geronimo is keeping one instance of SLF4J
>> classes for its own use and another instance for the applications it
>> hosts. Is my hypothesis correct?
> 
> Geronimo is not doing this intentionally.  I don't know why this would 
> be happening.  If you can figure out I'd like to know why.
> 
> One thing to note is that if you are starting geronimo via gshell 2 vms 
> are starting -- one for gshell, and one for geronimo.  I think the 
> gsh-classworlds.conf file is only affecting the gshell classpath, not 
> the geronimo classpath.
> 
> Normally the procedure for upgrading jars is explained here:  
> http://cwiki.apache.org/GMOxDOC22/how-to-upgrade-jars-and-swap-modules.html
> 
> However I believe the slf4j classes are loaded extremely early so 
> logging is available during most of server startup so this procedure may 
> not work for them.
> 
> One sure way to get the classes you want is to change the slf4j version 
> in the root pom and build your own geronimo snapshot.
> 
> Could I ask what you are investigating?
Hi David,

I am starting geronimo using the 'start-server' server script which
later invokes the 'gsh' script which than launches a JVM using
$GSHELL_HOME/lib/boot/gshell-bootstrap.jar

So, it appears that I was unknowingly launching gshell.

Thank you for link to the "how-to-upgrade-jars-and-swap-modules" page.

I am trying to solve the old "logging separation" problem, described
in [1].

In the simplest case, the logging separation problem can be solved by
placing a cop of slf4j+binding jars within application. Easy as
pie. However, under certain circumstances, a copy of slf4j+binding
jars are already present *or* must be present on shared class
path. The former case occurs when the server itself uses slf4j (as in
geronimo or jetty). Jetty's class loader hides SLF4J to the class
loader of hosted applications. See [2] for details.

Let me digress for the length of the next paragraph.

In the case of Tomcat 5.x, commons-logging.jar is present on the
shared class path, and due to the dynamic nature of commons-logging,
causing leakage of commons-logging loggers into web-applications using
commons-logging and embedding their own copy of commons-logging
jars. This leakage impedes proper garbage collection of stopped
web-applications. Tomcat 6.x does suffer from this problem because it
relies on "org.apache.juli", a commons-logging clone, for logging. The
fact that o.a.juli resides in a different package avoids leakage of
tomcat's loggers into the web-app, unless application developers also
start using "org.apache.juli" in their web-apps.

Coming back to SLF4J, even if the container does not use SLF4J, if
shared libraries residing on a shared class path relies on SLF4J,
SLF4J jar must be brought up to the level of the shared class path.

Thus, there are circumstances where SLF4J jars must be present on the
shared class path. In order to avoid mixing logs between various
hosted applications, we must have a way of separating logging
environments event if the SLF4J classes are loaded only once in memory
in the whole JVM. Enter "context selectors" (in logback) and
"repository selectors" in log4j.

So, to answer your question, I was investigating the behavior of
logback context selectors in Geronimo, in particular the
ContextJNDISelector. However, I did not get very far because there are
too many pieces missing in my understanding of Geronimo, in particular
its class loading model. Nevertheless, I think we should collaborate
on the logging separation problem so as to be prepared when users come
knocking on our respective doors.

We could also declare victory, now.

Assuming that "application class loader"+-- in Geronimo follow the me-first
(aka child-first) delegation model, and if applications embed their
own copy of slf4j+binding jars within the application, then their
logging environment will be unaffected by Geronimo. (They will load
their own copy of SLF4J+binding classes into memory). Ignoring the
problem of logging in shared libraries, we could declare that there is
no problem instead of being bogged down in the logging quagmire. Note
that under the same scenario, JCL's dynamic binding model suffers from leakages.

+--
"Application class loader" is the class loader used to load a particular hosted 
applications. Typically, application class loader is a child of the class loader 
used by Gerinomo to load its own classes.

[1] http://logback.qos.ch/snapshot/manual/loggingSeparation.html
Note /snapshot/ in the URL indicating that the URL is only temporary.

[2] http://docs.codehaus.org/display/JETTY/Classloading

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

Re: SLF4J in geronimo

Posted by Jason Dillon <ja...@planet57.com>.
On Nov 29, 2008, at 5:59 AM, David Jencks wrote:
> One thing to note is that if you are starting geronimo via gshell 2  
> vms are starting -- one for gshell, and one for geronimo.  I think  
> the gsh-classworlds.conf file is only affecting the gshell  
> classpath, not the geronimo classpath.

Correct, the classpath for the server is in the server.jar's manifest  
(unfortunately).

--jason

Re: SLF4J in geronimo

Posted by David Jencks <da...@yahoo.com>.
On Nov 27, 2008, at 9:05 AM, Ceki Gulcu wrote:

>
> Hello all,
>
> I am trying to understand how Geronimo deals with slf4j
> classes. First, I am totally unfamiliar with Geronimo's class loader
> architecture. For obscure reasons, I have placed slf4j-api-1.5.6.jar
> in $JAVA_HOME/jre/lib/ext and have commented out the following lines
> from gsh-classworlds.conf
>
>    #load ${gshell.home}/lib/slf4j-api-*.jar
>    #load ${gshell.home}/lib/slf4j-log4j12-*.jar
>    #load ${gshell.home}/lib/jcl104-over-slf4j-*.jar
>    #load ${gshell.home}/lib/log4j-*.jar
>
> Admittedly, placing slf4j classes under jre/lib/ext is not something
> one should do. However, it allows me to override Geronimo's copy of
> SLF4J with my own, as well as exporting slf4j classes to applications
> running under Geronimo.
>
> In this unusual setting Geronimo initializes itself
> successfully. However, when a web-app contained in an .ear file
> initializes, a *new* instance of SLF4J classes are loaded into
> memory. The ear file does does not contain slf4j-api.jar, not in the
> ear nor in the war file. I have checked and double checked this.
>
> Thus, it seems to me that Geronimo is keeping one instance of SLF4J
> classes for its own use and another instance for the applications it
> hosts. Is my hypothesis correct?

Geronimo is not doing this intentionally.  I don't know why this would  
be happening.  If you can figure out I'd like to know why.

One thing to note is that if you are starting geronimo via gshell 2  
vms are starting -- one for gshell, and one for geronimo.  I think the  
gsh-classworlds.conf file is only affecting the gshell classpath, not  
the geronimo classpath.

Normally the procedure for upgrading jars is explained here:  http://cwiki.apache.org/GMOxDOC22/how-to-upgrade-jars-and-swap-modules.html

However I believe the slf4j classes are loaded extremely early so  
logging is available during most of server startup so this procedure  
may not work for them.

One sure way to get the classes you want is to change the slf4j  
version in the root pom and build your own geronimo snapshot.

Could I ask what you are investigating?

many thanks
david jencks

>
> -- 
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework  
> for Java.
> http://logback.qos.ch


SLF4J in geronimo

Posted by Ceki Gulcu <ce...@qos.ch>.
Hello all,

I am trying to understand how Geronimo deals with slf4j
classes. First, I am totally unfamiliar with Geronimo's class loader
architecture. For obscure reasons, I have placed slf4j-api-1.5.6.jar
in $JAVA_HOME/jre/lib/ext and have commented out the following lines
from gsh-classworlds.conf

     #load ${gshell.home}/lib/slf4j-api-*.jar
     #load ${gshell.home}/lib/slf4j-log4j12-*.jar
     #load ${gshell.home}/lib/jcl104-over-slf4j-*.jar
     #load ${gshell.home}/lib/log4j-*.jar

Admittedly, placing slf4j classes under jre/lib/ext is not something
one should do. However, it allows me to override Geronimo's copy of
SLF4J with my own, as well as exporting slf4j classes to applications
running under Geronimo.

In this unusual setting Geronimo initializes itself
successfully. However, when a web-app contained in an .ear file
initializes, a *new* instance of SLF4J classes are loaded into
memory. The ear file does does not contain slf4j-api.jar, not in the
ear nor in the war file. I have checked and double checked this.

Thus, it seems to me that Geronimo is keeping one instance of SLF4J
classes for its own use and another instance for the applications it
hosts. Is my hypothesis correct?
-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

Re: sample application

Posted by David Jencks <da...@yahoo.com>.
Ceki,

I think you are claiming that downloading about 5 poms is taking 2  
hours which is highly unlikely for a total size of about 10 kb no  
matter what your internet connection or maven repo you are using.   
What you may not realize is that the samples are not only simple  
javaee applications but also demonstrate "predeploying" them into  
geronimo as geronimo plugins.  This involves downloading most of the  
geronimo jars from the maven repo as well.   I think this is pulling  
down 50-100mb which with a slow repo could possibly take a couple hours.

After you've built the sample once is a second build faster?

To me the main interest of the samples is as geronimo plugins, but we  
might be able to come up with a profile that would avoid building the  
plugins and pulling down most of geronimo.

thanks
david jencks

On Nov 25, 2008, at 9:22 AM, Ceki Gulcu wrote:

> Hello Donald,
>
> Thank you for your response.  I frequently build Maven projects
> without problems so I don't think my set up is the issue. In any case,
> my point is that the sample applications included in Geronimo have
> many external references to pom files. Admittedly, I am not familiar
> with Geronimo so please take my comments as the first impressions of a
> newbie.
>
> I have attached a trivial Enterprise Application to GERONIMO-4429. It
> is very similar to Geronimo's own 'mytime' application but without the
> external references to pom.xml files.
>
>
>
> Donald Woods wrote:
>> Continuing the discussion started in GERONIMO-4429...
>> How is your environment setup -
>> What version of Maven (should be 2.0.9)?
>> What version of Java (should be Java SE 5)?
>> How much memory does your machine have (probably need 1GB)?
>> -Donald
>
> -- 
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework  
> for Java.
> http://logback.qos.ch


Re: sample application

Posted by Ceki Gulcu <ce...@qos.ch>.
Hello Donald,

Thank you for your response.  I frequently build Maven projects
without problems so I don't think my set up is the issue. In any case,
my point is that the sample applications included in Geronimo have
many external references to pom files. Admittedly, I am not familiar
with Geronimo so please take my comments as the first impressions of a
newbie.

I have attached a trivial Enterprise Application to GERONIMO-4429. It
is very similar to Geronimo's own 'mytime' application but without the
external references to pom.xml files.


Donald Woods wrote:
> Continuing the discussion started in GERONIMO-4429...
> 
> How is your environment setup -
> What version of Maven (should be 2.0.9)?
> What version of Java (should be Java SE 5)?
> How much memory does your machine have (probably need 1GB)?
> 
> 
> -Donald
> 

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch

Re: sample application

Posted by Donald Woods <dw...@apache.org>.
Continuing the discussion started in GERONIMO-4429...

How is your environment setup -
What version of Maven (should be 2.0.9)?
What version of Java (should be Java SE 5)?
How much memory does your machine have (probably need 1GB)?


-Donald

Ceki Gulcu wrote:
> 
> Hello all,
> 
> After successfully following the "5-minute Tutorial on Enterprise
> Application Development with Eclipse and Geronimo" [1] I would like to
> build an ear file (ready for deployment in Geronimo) from Maven
> pom.xml files, similar to the "mytime" project part of the Geronimo
> sample appliccations.
> 
> Unfortunately, I am having trouble building the "mytime" sample
> application. I obtained it via Subversion at [2]. For one, it takes a
> very long time to build, in the order of several hours.
> 
> Looking at the pom files, one can see that,
> 
> org.apache.geronimo.samples:mytime depends on
> org.apache.geronimo.samples:samples:2.12 .pom which in turn depends on
> org.apache.geronimo.samples:samples-parent-2.1.2 pom which in turn 
> depends on
> org.apache.geronimo.genesis.config:project-config:1.4:pom  which depends on
> org.apache.geronimo.genesis.config:config:1.4:pom which in turn depends on
> org.apache.geronimo.genesis:genesis:1.4:pom etc...
> 
>  From a pedagogical point of view, requiring that many dependencies
> makes it hard to follow this sample application.
> 
> Is there a sample or maven archetype for a Enterprise Application
> Project, compatible with Geronimo, for mere mortals?
> 
> Many thanks in advance,
> 
> [1] http://tinyurl.com/5jj6zo
> [2] http://svn.apache.org/repos/asf/geronimo/samples/trunk/samples
> 

Re: sample application

Posted by Donald Woods <dw...@apache.org>.
You could also try specifying a Maven mirror which is closer to your 
location -
http://docs.codehaus.org/display/MAVENUSER/Mirrors+Repositories


-Donald


Ceki Gulcu wrote:
> 
> Hello all,
> 
> After successfully following the "5-minute Tutorial on Enterprise
> Application Development with Eclipse and Geronimo" [1] I would like to
> build an ear file (ready for deployment in Geronimo) from Maven
> pom.xml files, similar to the "mytime" project part of the Geronimo
> sample appliccations.
> 
> Unfortunately, I am having trouble building the "mytime" sample
> application. I obtained it via Subversion at [2]. For one, it takes a
> very long time to build, in the order of several hours.
> 
> Looking at the pom files, one can see that,
> 
> org.apache.geronimo.samples:mytime depends on
> org.apache.geronimo.samples:samples:2.12 .pom which in turn depends on
> org.apache.geronimo.samples:samples-parent-2.1.2 pom which in turn 
> depends on
> org.apache.geronimo.genesis.config:project-config:1.4:pom  which depends on
> org.apache.geronimo.genesis.config:config:1.4:pom which in turn depends on
> org.apache.geronimo.genesis:genesis:1.4:pom etc...
> 
>  From a pedagogical point of view, requiring that many dependencies
> makes it hard to follow this sample application.
> 
> Is there a sample or maven archetype for a Enterprise Application
> Project, compatible with Geronimo, for mere mortals?
> 
> Many thanks in advance,
> 
> [1] http://tinyurl.com/5jj6zo
> [2] http://svn.apache.org/repos/asf/geronimo/samples/trunk/samples
>