On Mon, 20 Sep 2010 18:42:04 -0700 (PDT)
 Kevin Ng <nkm.ke...@live.com> wrote:

Thank you for replying...
I'm a newbie, can you further guide me in solving this problem?
Question:
1. How to configure child-first classloading for webapps?

Depends on what server you use.  Given that you use JBoss, I suggest looking this up in the JBoss docs.  I don't personally use JBoss, but I know it supports child-first classloading as a configuration option.  Ask in a JBoss forum if you are unable to find this in the JBoss docs.

2. How to place both my custom Filter **and** log4j.jar in WEB-INF/lib?

Not really sure how to say this any more clearly?....

WEB-INF/lib/log4j.jar
WEB-INF/lib/myJarContainingLog4jCustomFilterClass.jar


Jake


Kevin.


Jacob Kjome wrote:

It's pretty clear that your "log4j.TransFilter" is loaded by a ClassLoader
that is
a child of the ClassLoader that loads log4j.jar.  Your class must be
loaded by the
same, or parent, classloader to that of Log4j.

So, for instance, if Log4j is loaded from some global lib directory in
JBoss, then
you probably should place your custom Filter class/jar in that same
directory, as
it will definitely not be found if loaded from, for instance, WEB-INF/lib
(unless
you configure child-first classloading for webapps and place BOTH your
custom
Filter **and** log4j.jar in WEB-INF/lib).


Jake


On 9/20/2010 1:49 AM, Kevin Ng wrote:
TransFilter is a custom filter that I have created, a .java file. This
run fine as Java Application. When I tried to convert into JBoss log4j
and error occur. File located: ../server/default/conf/log4j.xml Error
occur: log4j:ERROR Could not instantiate class [log4j.TransFilter].
java.lang.ClassNotFoundException: log4j.TransFilter at
java.net.URLClassLoader$1.run(URLClassLoader.java:199) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:187) at
java.lang.ClassLoader.loadClass(ClassLoader.java:289) at
java.lang.ClassLoader.loadClass(ClassLoader.java:235) at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:141) at
org.apache.log4j.helpers.Loader.loadClass(Loader.java:160) at
org.apache.log4j.helpers.OptionConverter.instantiateByClassName(Optio
nConverter.java:309) at
org.apache.log4j.xml.DOMConfigurator.parseFilters(DOMConfigurator.jav
a:269) at
org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.ja
va:190) at
org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurat
or.java:140) at
org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfi
gurator.java:153) at
org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOM
Configurator.java:415) at
org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:3
84) at
org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:783) at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:666) at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:616) at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:602) at
org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:6 97)
------------------------------------------------------------------------
View this message in context: Problem on Log4j: How to include custom
into JBoss (log4j.xml)?
<http://old.nabble.com/Problem-on-Log4j%3A-How-to-include-custom-%3Cfilter-%3E-into-JBoss-%28log4j.xml%29--tp29756960p29756960.html>
Sent from the Log4j - Dev mailing list archive
<http://old.nabble.com/Log4j---Dev-f153.html> at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org




--
View this message in context: http://old.nabble.com/Problem-on-Log4j%3A-How-to-include-custom-%3Cfilter-%3E-into-JBoss-%28log4j.xml%29--tp29756960p29765396.html
Sent from the Log4j - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to