java - Apache Mina Exception -
i have followed link example program using apache mina.
these lib files used code.
- mina-core-2.0.7.jar
- slf4j-api-1.7.5.jar
- slf4j-jdk14-1.7.5.jar
i getting following error:
exception in thread "main" java.lang.classcastexception: org.slf4j.impl.jdk14loggeradapter cannot cast java.util.logging.logger @ minafiletrans.minaserverhandler.<init>(minaserverhandler.java:12) @ minafiletrans.minafiletrans.main(minafiletrans.java:23) java result: 1
here code:
package minafiletrans; import java.util.logging.logger; import org.apache.mina.core.service.iohandleradapter; import org.apache.mina.core.session.idlestatus; import org.apache.mina.core.session.iosession; import org.slf4j.loggerfactory; public class minaserverhandler extends iohandleradapter { @suppresswarnings("nonconstantlogger") private final logger logger = (logger) loggerfactory.getlogger(getclass()); @override public void sessionopened(iosession session) { // set idle time 10 seconds session.getconfig().setidletime(idlestatus.both_idle, 10); session.setattribute("values: "); } @override @suppresswarnings("loggerstringconcat") public void messagereceived(iosession session, object message) { logger.info("message received in server.."); logger.info("message is: " + message.tostring()); } @override public void sessionidle(iosession session, idlestatus status) { logger.info("disconnecting idle."); // disconnect idle client session.close(true); } @override public void exceptioncaught(iosession session, throwable cause) { // close connection on exceptional situation session.close(true); } }
i have added required lib files. why error occurs me. suggestions solve error.
you should not : import java.util.logging.logger; import org.slf4j.logger;
Comments
Post a Comment