log4j and JMSAppender not workinkg

R

rob1980

I've got a problem with configuration log4j with JMSAppender:


log4j.properties:


log4j.appender.jms=org.apache.log4j.net.JMSAppender
# I'm not sure for line below, is it right?
log4j.appender.jms.InitialContextFactoryName=com.sun.jndi.fscontext.RefFSContextFactory

log4j.appender.jms.ProviderURL=file:/E:/JNDI-Directory
log4j.appender.jms.TopicBindingName=jms/TopicJNDI
log4j.appender.jms.TopicConnectionFactoryBindingName=jms/ConnectionFactory

log4j.appender.jms.layout=org.apache.log4j.PatternLayout
log4j.appender.jms.layout.ConversionPattern=%d{ISO8601} %-5p %c %x -
%m%n


piece of my web.xml:
<resource-env-ref>
<description>ConnectionFactory</description>

<resource-env-ref-name>jms/ConnectionFactory</resource-env-ref-name>

<resource-env-ref-type>com.test.jms.ConnectionFactory</resource-env-ref-type>

</resource-env-ref>


and context.xml:
<Resource name="jms/ConnectionFactory" auth="Container"
type="com.test.jms.ConnectionFactory"
factory="com.sun.jndi.fscontext.RefFSContextFactory" />



and when I try to log something in my junit test, I have exception:
log4j:ERROR Error while activating options for appender named [jms].
java.lang.ClassCastException: javax.naming.Reference
at org.apache.log4j.net.JMSAppender.activateOptions(Unknown
Source)
at
org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256)

at
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132)

at
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)

...


I don't understand that problem, because my class ConnectionFactory
implements Referencable interface. It's my first day with jndi, jms and

log4j, please be patient for me :)
Can anybody tell me, what am I doing wrong?


best regards
RoB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top