You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Darren Davison (JIRA)" <ji...@apache.org> on 2009/11/11 22:07:52 UTC

[jira] Created: (SMX4-424) ClassNotFoundException attempting to use Log4J LoggingEvent

ClassNotFoundException attempting to use Log4J LoggingEvent
-----------------------------------------------------------

                 Key: SMX4-424
                 URL: https://issues.apache.org/activemq/browse/SMX4-424
             Project: ServiceMix 4
          Issue Type: Bug
            Reporter: Darren Davison


I have configured applications to use Log4J's JMSAppender in order to log messages on a queue as follows;

{noformat}
log4j.appender.jms=org.apache.log4j.net.JMSAppender
log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
log4j.appender.jms.ProviderURL=tcp://localhost:61616
log4j.appender.jms.TopicBindingName=logTopic
log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory
{noformat}

Each application logging statement adds a new message to topic://logTopic on the broker.  I have a bundle deployed that attempts to route the messages from this topic with camel;

{code}
from("activemq:topic:logTopic")
  .convertBodyTo(String.class)
  .to("log:foo?level=DEBUG&showProperties=true&showHeaders=true");
{code}

When using servicemix 4 (Fuse 4.1.0.4), a stack trace is seen with the following message (enhanced using felix.log.level=4);


{noformat}Caused by: java.lang.ClassNotFoundException: *** Class 'org.apache.log4j.spi.LoggingEvent' 
was not found because bundle 56 does not import 'org.apache.log4j.spi' even though bundle 84 
does export it. To resolve this issue, add an import for 'org.apache.log4j.spi' to bundle 56. ***
{noformat}

Bundles as follows;

{noformat}smx@root:/> osgi/list|grep 56
[  56] [Active     ] [       ] [   60] activemq-core (5.3.0.fuse)

smx@root:/> osgi/list|grep 84
[  84] [Active     ] [       ] [    8] OPS4J Pax Logging - API (1.3.0)
{noformat}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SMX4-424) ClassNotFoundException attempting to use Log4J LoggingEvent

Posted by "Gert Vanthienen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMX4-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gert Vanthienen updated SMX4-424:
---------------------------------

    Attachment: SMX4-424.diff

I think the message on the CNFE is correct: if you look at the stack traces, you'll notice that it's ActiveMQ's ClassLoadingAwareObjectInputStream class that is trying to load the org.apache.log4j.spi.LoggingEvent class.  

With the current OSGi bundle configuration for activemq-core, it can not access that class.  The easy solution would be to add a dynamic import to the activemq-core bundle as in the attached SMX4-424.diff file.  Another option would be to modify the ClassLoadingAwareObjectInputStream class to use OSGi's FrameworkUtil class to determine the correct classloader.

> ClassNotFoundException attempting to use Log4J LoggingEvent
> -----------------------------------------------------------
>
>                 Key: SMX4-424
>                 URL: https://issues.apache.org/activemq/browse/SMX4-424
>             Project: ServiceMix 4
>          Issue Type: Bug
>            Reporter: Darren Davison
>         Attachments: amq-error.log, amq-headers.log, SMX4-424.diff
>
>
> I have configured applications to use Log4J's JMSAppender in order to log messages on a queue as follows;
> {noformat}
> log4j.appender.jms=org.apache.log4j.net.JMSAppender
> log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
> log4j.appender.jms.ProviderURL=tcp://localhost:61616
> log4j.appender.jms.TopicBindingName=logTopic
> log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory
> {noformat}
> Each application logging statement adds a new message to topic://logTopic on the broker.  I have a bundle deployed that attempts to route the messages from this topic with camel;
> {code}
> from("activemq:topic:logTopic")
>   .convertBodyTo(String.class)
>   .to("log:foo?level=DEBUG&showProperties=true&showHeaders=true");
> {code}
> When using servicemix 4 (Fuse 4.1.0.4), a stack trace is seen with the following message (enhanced using felix.log.level=4);
> {noformat}Caused by: java.lang.ClassNotFoundException: *** Class 'org.apache.log4j.spi.LoggingEvent' 
> was not found because bundle 56 does not import 'org.apache.log4j.spi' even though bundle 84 
> does export it. To resolve this issue, add an import for 'org.apache.log4j.spi' to bundle 56. ***
> {noformat}
> Bundles as follows;
> {noformat}smx@root:/> osgi/list|grep 56
> [  56] [Active     ] [       ] [   60] activemq-core (5.3.0.fuse)
> smx@root:/> osgi/list|grep 84
> [  84] [Active     ] [       ] [    8] OPS4J Pax Logging - API (1.3.0)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SMX4-424) ClassNotFoundException attempting to use Log4J LoggingEvent

Posted by "Darren Davison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMX4-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Darren Davison updated SMX4-424:
--------------------------------

    Attachment: amq-headers.log
                amq-error.log

complete stack trace attached in amq-error.log
output of OSGi headers for activemq-core bundle attached in amq-headers.log

> ClassNotFoundException attempting to use Log4J LoggingEvent
> -----------------------------------------------------------
>
>                 Key: SMX4-424
>                 URL: https://issues.apache.org/activemq/browse/SMX4-424
>             Project: ServiceMix 4
>          Issue Type: Bug
>            Reporter: Darren Davison
>         Attachments: amq-error.log, amq-headers.log
>
>
> I have configured applications to use Log4J's JMSAppender in order to log messages on a queue as follows;
> {noformat}
> log4j.appender.jms=org.apache.log4j.net.JMSAppender
> log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
> log4j.appender.jms.ProviderURL=tcp://localhost:61616
> log4j.appender.jms.TopicBindingName=logTopic
> log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory
> {noformat}
> Each application logging statement adds a new message to topic://logTopic on the broker.  I have a bundle deployed that attempts to route the messages from this topic with camel;
> {code}
> from("activemq:topic:logTopic")
>   .convertBodyTo(String.class)
>   .to("log:foo?level=DEBUG&showProperties=true&showHeaders=true");
> {code}
> When using servicemix 4 (Fuse 4.1.0.4), a stack trace is seen with the following message (enhanced using felix.log.level=4);
> {noformat}Caused by: java.lang.ClassNotFoundException: *** Class 'org.apache.log4j.spi.LoggingEvent' 
> was not found because bundle 56 does not import 'org.apache.log4j.spi' even though bundle 84 
> does export it. To resolve this issue, add an import for 'org.apache.log4j.spi' to bundle 56. ***
> {noformat}
> Bundles as follows;
> {noformat}smx@root:/> osgi/list|grep 56
> [  56] [Active     ] [       ] [   60] activemq-core (5.3.0.fuse)
> smx@root:/> osgi/list|grep 84
> [  84] [Active     ] [       ] [    8] OPS4J Pax Logging - API (1.3.0)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SMX4-424) ClassNotFoundException attempting to use Log4J LoggingEvent

Posted by "Maciej Prochniak (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMX4-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=55325#action_55325 ] 

Maciej Prochniak commented on SMX4-424:
---------------------------------------

Do  you have this log4j import in your bundle (containing camel route)? I guess the felix debug message (... was not found because ...) can be misleading - I think it should be your camel bundle that imports 'org.apache.log4j.spi' package

> ClassNotFoundException attempting to use Log4J LoggingEvent
> -----------------------------------------------------------
>
>                 Key: SMX4-424
>                 URL: https://issues.apache.org/activemq/browse/SMX4-424
>             Project: ServiceMix 4
>          Issue Type: Bug
>            Reporter: Darren Davison
>         Attachments: amq-error.log, amq-headers.log
>
>
> I have configured applications to use Log4J's JMSAppender in order to log messages on a queue as follows;
> {noformat}
> log4j.appender.jms=org.apache.log4j.net.JMSAppender
> log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
> log4j.appender.jms.ProviderURL=tcp://localhost:61616
> log4j.appender.jms.TopicBindingName=logTopic
> log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory
> {noformat}
> Each application logging statement adds a new message to topic://logTopic on the broker.  I have a bundle deployed that attempts to route the messages from this topic with camel;
> {code}
> from("activemq:topic:logTopic")
>   .convertBodyTo(String.class)
>   .to("log:foo?level=DEBUG&showProperties=true&showHeaders=true");
> {code}
> When using servicemix 4 (Fuse 4.1.0.4), a stack trace is seen with the following message (enhanced using felix.log.level=4);
> {noformat}Caused by: java.lang.ClassNotFoundException: *** Class 'org.apache.log4j.spi.LoggingEvent' 
> was not found because bundle 56 does not import 'org.apache.log4j.spi' even though bundle 84 
> does export it. To resolve this issue, add an import for 'org.apache.log4j.spi' to bundle 56. ***
> {noformat}
> Bundles as follows;
> {noformat}smx@root:/> osgi/list|grep 56
> [  56] [Active     ] [       ] [   60] activemq-core (5.3.0.fuse)
> smx@root:/> osgi/list|grep 84
> [  84] [Active     ] [       ] [    8] OPS4J Pax Logging - API (1.3.0)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.