geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poulin, Maxime" <maxime.pou...@cgi.com>
Subject RE: Log4j problem with my ear - more generally a class loader question.
Date Thu, 30 Nov 2006 20:37:43 GMT
Actually, I rewrote my xmls with the dep: thing.
ger-app.xml

<application 
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
       http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
       version="1.4">
       configId="efxRootConfig"
       inverseClassloading="true"
       application-name="efx"       
       >
   <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
     <dep:moduleId>
       <dep:groupId>efx</dep:groupId>
       <dep:artifactId>efx</dep:artifactId>
       <dep:version>1.0</dep:version>
       <dep:type>car</dep:type>
     </dep:moduleId>

     <dep:dependencies/>

  	<dep:hidden-classes>
     <dep:filter>org.apache.log4j.</dep:filter>
     <dep:filter>org.apache.commons.logging.</dep:filter>
   	</dep:hidden-classes>

   </dep:environment>       
    <module>
	    <web>
    	    <web-uri>chapel.war</web-uri>
        	<context-root>/chapel</context-root>
        </web>
	</module>
</application>

ger-web.xml

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
   xmlns:naming="http://geronimo.apache.org/xml/ns/naming">
   
   <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
  		<dep:moduleId> 
  			<dep:groupId>geronimo</dep:groupId>
  			<dep:artifactId>chapel</dep:artifactId>
  			<dep:version>1.1</dep:version> 
  			<dep:type>war</dep:type> 
		</dep:moduleId>
	</dep:environment>
	<context-root>/chapel</context-root>
</web-app>


-----Original Message-----
From: Poulin, Maxime [mailto:maxime.poulin@cgi.com] 
Sent: Thursday, November 30, 2006 3:12 PM
To: user@geronimo.apache.org
Subject: RE: Log4j problem with my ear - more generally a class loader
question.

Well I tried it but this is what I get :
--
log4j:WARN No appenders could be found for logger
(com.zerobase.chaplin.ChaplinStartupListener).
log4j:WARN Please initialize the log4j system properly.
--- 

Really don't get it.

Here is the structure :
chapel (webapp) ->
	Has three libraries :
	chaplin-common.jar
	chaplin-fx.jar
	struts.jar
The startup listener (see trace above) is in chaplin-common.jar . It
performes the init call for log4j.

the ear contains all the jars for the business logic and architecture.
chaplin-common.jar and chaplin-fx.jar need the jars from the ear to
work. Including the zbutils.jar which contains my appender and actually
all the real log4j initialization.

here are my xmls :
geronimo-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 
	xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" 
	xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1" 
	xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1" 
	xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1"

	>
  
	<environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
  		<moduleId> 
  			<groupId>geronimo</groupId>
  			<artifactId>chapel</artifactId>
  			<version>1.1</version> 
  			<type>war</type> 
		</moduleId>
	</environment>
	<context-root>/chapel</context-root>
  
</web-app>


and my geronimo-application.xml:

<application 
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
       http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
       version="1.4">
       configId="efxRootConfig"
       inverseClassloading="true"
       application-name="efx"       
       >
    <environment>
	    <module>
    	    <web>
        	    <web-uri>chapel.war</web-uri>
            	<context-root>/chapel</context-root>
	        </web>
    	</module>
		<hidden-classes>
            <filter>org.apache.commons.logging</filter>
            <filter>org.apache.log4j</filter>
		</hidden-classes>      	
    </environment>
       
</application>


Sub-question, this is a naive one. Why do you use dependencies for all
your tags ? (Precision: I've been working mostly on websphere to change
our web application into an enterprise application and now I am working
on the same thing for geronimo so I am quite new on this container).

Max.

-----Original Message-----
From: David Jencks [mailto:david_jencks@yahoo.com]
Sent: Thursday, November 30, 2006 12:56 PM
To: user@geronimo.apache.org
Subject: Re: Log4j problem with my ear - more generally a class loader
question.

The first thing to try is to use the hidden-classes element in your
geronimo deployment plan to not import geronimo's log4j and commons-
logging classes.

Your geronimo-application.xml plan should start something like this:

<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/
application-1.1">
   <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/
deployment-1.1">
     <dep:moduleId>
       <dep:groupId>org.chapel</dep:groupId>
       <dep:artifactId>Chapel-jetty</dep:artifactId>
       <dep:version>1.0-SNAPSHOT</dep:version>
       <dep:type>car</dep:type>
     </dep:moduleId>
     <dep:dependencies/>


  <dep:hidden-classes>
     <dep:filter>org.apache.log4j.</dep:filter>
     <dep:filter>org.apache.commons.logging.</dep:filter>
   </dep:hidden-classes>

   </dep:environment>

...

hope this helps.

david jencks


On Nov 30, 2006, at 8:42 AM, Poulin, Maxime wrote:

> Greetings !
>
> So I am trying the very painful task of building one single ear file 
> that would work properly under websphere, geronimo and some others.
>
> The ear contains 1 web app called Chapel, a few EJBs and 2 j2ee client

> apps.
>
> As we deploy on multiple containers (some of them don't have log4j), 
> we keep the log4j and apache commons-logging in the ear file.
>
> Now here is my problem. I created my own log4j appender which I wish 
> to use. The jar containing this appender is contained in the ear just 
> like log4j etc. Now when log4j is initialized, it is geronimo's log4j 
> that is used, and it does not find my custom appender (class not 
> found). I guess that geronimo's log4j is higher in the hierarchy, and 
> does not look down.
>
> So either I make my jar visible to geronimo's log4j or I tell geronimo

> to use my own log4j instead of his for my ear.
>
> I need advice on this, advice, comments or experience. Could you tip 
> me ?
>
> Advices on geronimo's class loaders are also welcomed.
>
> Thank you very much.
>
> Maxime Poulin
> CGI - CGIFX
> 514-228-8800 ext.2860

Mime
View raw message