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
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