错误:我的java类对象不能分配给“org.apache.log4j.appender”变量

dkqlctbz  于 2021-07-09  发布在  Java
关注(0)|答案(1)|浏览(282)

我正在努力跟上进度。这里提到的https://hursleyonwmq.wordpress.com/2007/05/29/simplest-sample-applications-using-websphere-mq-jms/ 但是通过log4j.properties文件检索队列、主机、端口等详细信息,下面是log4j.properties中的条目`

log4j.appender.JMS = com.log4j.Log4j_HelloWorld
        log4j.appender.JMS.HostName=MQEEQS.ABC.COM
        log4j.appender.JMS.Port=1414
        log4j.appender.JMS.QueueManager=MQEEQS
        log4j.appender.JMS.Channel=CLIENT.TO.MQEEQS
        log4j.appender.JMS.QueueName=QA.M01.MR.NOTIFICATION.FEED.DEV

使用property.getproperty在我的java类log4j\u helloworld中获取这些属性,但是在作为java应用程序运行时,我在控制台中得到以下错误-

log4j:ERROR A "com.log4j.Log4j_HelloWorld" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by 
log4j:ERROR [sun.misc.Launcher$AppClassLoader@1a5d08] whereas object of type 
log4j:ERROR "com.log4j.Log4j_HelloWorld" was loaded by [sun.misc.Launcher$AppClassLoader@1a5d08].
log4j:ERROR Could not instantiate appender named "JMS".
java.io.FileNotFoundException: log4j.properties (The system cannot find the file specified)
\nFAILURE\n
niknxzdl

niknxzdl1#

是com.log4j.log4j\u helloworld实现appender接口吗
大多数情况下,我们来自appenderskeleton

相关问题