You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Marcin Zajączkowski <ms...@wp.pl> on 2013/12/19 00:02:18 UTC
ClassCastException when using log4j2 with gradle-tomcat-plugin
Hi,
I'm playing with log4j2 and today I've found the issue when I tried to
use it with gradle-tomcat-plugin [1]. In the web application with Spring
4 when the context is starting I've got:
> java.lang.ClassCastException:
> org.apache.logging.log4j.core.web.Log4jServletContainerInitializer
> cannot be cast to javax.servlet.ServletContainerInitializer on startup.
I reported an issue [2] to the plugin author also with simple quickstart
application [3] which reproduces the problem, but we have no clue why it
happens.
Maybe you have any hints?
[1] - https://github.com/bmuschko/gradle-tomcat-plugin/
[2] - https://github.com/bmuschko/gradle-tomcat-plugin/issues/78
[3] -
https://github.com/szpak/code-examples-and-poc/tree/master/gradle-tomcat-plugin-log4j2-poc
Marcin
--
http://blog.solidsoft.info/ - Working code is not enough
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: ClassCastException when using log4j2 with gradle-tomcat-plugin
Posted by Marcin Zajączkowski <ms...@wp.pl>.
On 2013-12-19 02:48, Olivier Lamy wrote:
> I believe it's a classloader issue with the plugin.
> javax.servlet.ServletContainerInitializer is probably loading with
> your application (no idea how it works with gradle but the dependency
> should be marked as provided )
Good shot! Accidentally servlet-api jar was included in the war archive.
Thanks for your help
Marcin
> On 19 December 2013 10:02, Marcin Zajączkowski <ms...@wp.pl> wrote:
>> Hi,
>>
>> I'm playing with log4j2 and today I've found the issue when I tried to
>> use it with gradle-tomcat-plugin [1]. In the web application with Spring
>> 4 when the context is starting I've got:
>>
>>> java.lang.ClassCastException:
>>> org.apache.logging.log4j.core.web.Log4jServletContainerInitializer
>>> cannot be cast to javax.servlet.ServletContainerInitializer on startup.
>>
>> I reported an issue [2] to the plugin author also with simple quickstart
>> application [3] which reproduces the problem, but we have no clue why it
>> happens.
>>
>> Maybe you have any hints?
>>
>>
>> [1] - https://github.com/bmuschko/gradle-tomcat-plugin/
>> [2] - https://github.com/bmuschko/gradle-tomcat-plugin/issues/78
>> [3] -
>> https://github.com/szpak/code-examples-and-poc/tree/master/gradle-tomcat-plugin-log4j2-poc
>>
>> Marcin
--
http://blog.solidsoft.info/ - Working code is not enough
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: ClassCastException when using log4j2 with gradle-tomcat-plugin
Posted by Olivier Lamy <ol...@apache.org>.
I believe it's a classloader issue with the plugin.
javax.servlet.ServletContainerInitializer is probably loading with
your application (no idea how it works with gradle but the dependency
should be marked as provided )
On 19 December 2013 10:02, Marcin Zajączkowski <ms...@wp.pl> wrote:
> Hi,
>
> I'm playing with log4j2 and today I've found the issue when I tried to
> use it with gradle-tomcat-plugin [1]. In the web application with Spring
> 4 when the context is starting I've got:
>
>> java.lang.ClassCastException:
>> org.apache.logging.log4j.core.web.Log4jServletContainerInitializer
>> cannot be cast to javax.servlet.ServletContainerInitializer on startup.
>
> I reported an issue [2] to the plugin author also with simple quickstart
> application [3] which reproduces the problem, but we have no clue why it
> happens.
>
> Maybe you have any hints?
>
>
> [1] - https://github.com/bmuschko/gradle-tomcat-plugin/
> [2] - https://github.com/bmuschko/gradle-tomcat-plugin/issues/78
> [3] -
> https://github.com/szpak/code-examples-and-poc/tree/master/gradle-tomcat-plugin-log4j2-poc
>
> Marcin
>
> --
> http://blog.solidsoft.info/ - Working code is not enough
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
--
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org