You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by jmmoon <db...@gmail.com> on 2015/08/12 01:51:07 UTC

Question about TomcatWebAppBuilder in Tomee

Hi~ all.
Actually I have a question about TomcatWebAppBuilder behavior. 

At the line number 605 of org.apache.tomee.catalina.TomcatWebAppBuilder in
Tomee 1.7.1 
standardContext.setDelegate(true); is excuted. 

Although There is the comment about that code, I can not understand this
behavior. 
In case of ear, the classLoader is a instance of URLClassLoaderFirst which
loads clssses in the 
ear\lib, ejb.jar etc. 

When standardContext.setDelegate(true); is called 
WebAppClassLoader does not look up WEB-INF directory first. 
It just delegates to the parent classloader URLClassLoaderFirst. 

This makes some classloading problem. For example, in case of using
slf4j-log4j, 
slf4j is loaded in the ${TomeeInstallDir}\lib and log4j library is loaded in
the WEB-INF 
so, log4j does not work well. 

I have had much googling about this problem, I have found
"opejb.classloader.force-load=..." 
in the System.properties, but it doesn't work. 

Finally I deleted standardContext.setDelegate(true); line, then everything
became perpect. 

But I think tomee team have a reason to call this line and I worry that
threre might be 
a side-effect after deleting this line. 

I appreciate if I have an answer. 
Thank you. 



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Question-about-TomcatWebAppBuilder-in-Tomee-tp4675841.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Question about TomcatWebAppBuilder in Tomee

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

Slf4j is treated a bit particularly in tomee in the sense you have to
provide slf4j impl along with slf4j api (same classloader) to be sure it
works. ears can get slf4j as provided in them.

maybe reproduce your issue on a github project and we can discuss on a
concrete case.



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-11 16:51 GMT-07:00 jmmoon <db...@gmail.com>:

> Hi~ all.
> Actually I have a question about TomcatWebAppBuilder behavior.
>
> At the line number 605 of org.apache.tomee.catalina.TomcatWebAppBuilder in
> Tomee 1.7.1
> standardContext.setDelegate(true); is excuted.
>
> Although There is the comment about that code, I can not understand this
> behavior.
> In case of ear, the classLoader is a instance of URLClassLoaderFirst which
> loads clssses in the
> ear\lib, ejb.jar etc.
>
> When standardContext.setDelegate(true); is called
> WebAppClassLoader does not look up WEB-INF directory first.
> It just delegates to the parent classloader URLClassLoaderFirst.
>
> This makes some classloading problem. For example, in case of using
> slf4j-log4j,
> slf4j is loaded in the ${TomeeInstallDir}\lib and log4j library is loaded
> in
> the WEB-INF
> so, log4j does not work well.
>
> I have had much googling about this problem, I have found
> "opejb.classloader.force-load=..."
> in the System.properties, but it doesn't work.
>
> Finally I deleted standardContext.setDelegate(true); line, then everything
> became perpect.
>
> But I think tomee team have a reason to call this line and I worry that
> threre might be
> a side-effect after deleting this line.
>
> I appreciate if I have an answer.
> Thank you.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Question-about-TomcatWebAppBuilder-in-Tomee-tp4675841.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>