quality@glassfish.java.net

Re: My first tests with FishCAT ...ouch

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Fri, 09 Oct 2009 16:07:35 -0700

Hi Jose,

regarding the following stack trace from your original email:

<stacktrace>
GRAVE: log4j:ERROR Could not read configuration file from URL [
file:/C:/Archivos de
programa/glassfishv3-b65/glassfish/domains/domain1/generated/jsp/org.internna.iwebmvc_iwebmvc-demo_war_2.0-SNAPSHOT/loader/log4j.properties].
*
*GRAVE: java.io.FileNotFoundException: C:\Archivos de
programa\glassfishv3-b65\glassfish\domains\domain1\generated\jsp\org.internna.iwebmvc_iwebmvc-demo_war_2.0-SNAPSHOT\loader\log4j.properties
(El sistema no puede hallar la ruta especificada)*
*GRAVE: at java.io.FileInputStream.open(Native Method)*
*GRAVE: at
java.io.FileInputStream.<init>(FileInputStream.java:106)*
*GRAVE: at
java.io.FileInputStream.<init>(FileInputStream.java:66)*
*GRAVE: at
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
*
*GRAVE: at
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
*
*GRAVE: at java.net.URL.openStream(URL.java:1009)*
*GRAVE: at
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:433)
*
*GRAVE: at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:470)
*
*GRAVE: at
org.apache.log4j.LogManager.<clinit>(LogManager.java:122)*
</stacktrace>


this is what's going on:

log4j's LogManager attempts to load the log4j.properties resource from
your webapp using the getResource method of its classloader.

However, the classloader can't find this resource because it is
provided in the wrong place, where the classloader can't see it!

Your app bundles this resource under WEB-INF, but in order for its
classloader to be able to see it, it must be bundled under
WEB-INF/classes or inside a JAR file inside WEB-INF/lib.

After moving log4j.properties from WEB-INF to WEB-INF/classes,
repacking your app, and deploying it again, the stacktrace went away.

I am now seeing a different error, though:

log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not
assignable to a "org.apache.log4j.Appender" variable.|#]
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by |#]
log4j:ERROR [org.glassfish.web.loader.WebappClassLoader_at_dbe8cd]
whereas object of type |#]
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by
[org.glassfish.web.loader.WebappClassLoader_at_1e9247a].|#]

I'm investigating, but if you could follow my advise and repackage
your app as described above and see what you get, that would be great!

Thanks,

Jan

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: quality-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: quality-help_at_glassfish.dev.java.net
>
>
>