Re: jzib.jar ---exception not threw while using CompressionFilter

2007-10-15 Thread Trustin Lee
Hi Rocky,

On 10/12/07, rockyzheng [EMAIL PROTECTED] wrote:

 when I used mina, I tried compress my data by CompressionFilter, but when I
 published my program, I missed jzib.jar in the classpath, but no exception
 was threw ,it just coulnd't transform data with servers.
 Thus ,I suggest while missing it, some exception to be threw maybe a better
 way .

I get the following log message:

[18:02:53] WARN
[org.apache.mina.common.support.DefaultExceptionMonitor] - Unexpected
exception.
java.lang.NoClassDefFoundError: com/jcraft/jzlib/ZStream
at org.apache.mina.filter.support.Zlib.init(Zlib.java:75)
at 
org.apache.mina.filter.CompressionFilter.onPreAdd(CompressionFilter.java:207)
at 
org.apache.mina.common.support.AbstractIoFilterChain.register(AbstractIoFilterChain.java:156)
at 
org.apache.mina.common.support.AbstractIoFilterChain.addLast(AbstractIoFilterChain.java:120)
at 
org.apache.mina.common.DefaultIoFilterChainBuilder.buildFilterChain(DefaultIoFilterChainBuilder.java:218)
at 
org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.processSessions(SocketAcceptor.java:292)
at 
org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:228)
at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:39)
at java.lang.Thread.run(Thread.java:619)

Please make sure you enabled logging for MINA.

 By the way, when some filter were added to chain, who can tell me how to
 order them ?
 now ,I can take some followings : compress --ssl --log.

I suggest the following settings:

* SSLFilter - CompressionFilter - ExecutorFilter - LoggingFilter

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6


Re: jzib.jar ---exception not threw while using CompressionFilter

2007-10-15 Thread rockyzheng

thanks for your reply.

But I still don't get the exception  and although logging has been enabled
already.

Some wonder...

Something was wrong ? My code was followings :


public class ClientProxy {

// log
private static final Logger log =
LoggerFactory.getLogger(ClientProxy.class);
// ssl support
private static final boolean sslSupport = Constants.isSSLEnable();
// compress support
private static final boolean compressSupport =
Constants.isCompressEnable();

private ClientMessage message;


public ClientProxy(ClientMessage message){
this.message = message;
}

/**
 *
 */
public void start() throws Exception{

SocketConnector connector = new SocketConnector();
IoServiceConfig config = connector.getDefaultConfig();

DefaultIoFilterChainBuilder filterChainBuilder = 
config.getFilterChain();

//add protocol codec filter
filterChainBuilder.addLast(codec, new ProtocolCodecFilter(
new MonitorServerCodecFactory(true)));

//compress support,
if (compressSupport) {
addCompressSupport(filterChainBuilder);
}   

//ssl support
if (sslSupport){
addSSLSupport(filterChainBuilder);
}


//log filter
addLogger(filterChainBuilder);

//connect   
ConnectFuture future = connector.connect(new
InetSocketAddress(Constants.getServerIP(), Constants.getServerPort()),
new ClientSessionHandler(message)); 

future.join();

}


/**
 * add compress filter 
 * @param chain
 */
private static void addCompressSupport(DefaultIoFilterChainBuilder 
chain)
throws Exception{

CompressionFilter filter = new CompressionFilter(
CompressionFilter.COMPRESSION_MAX);
chain.addFirst(compress, filter);

log.info(Compress On);
}

/**
 * add ssl filter
 * @param chain
 * @throws Exception
 */
private static void addSSLSupport(DefaultIoFilterChainBuilder chain)
throws Exception {  

SSLFilter sslFilter = new
SSLFilter(BogusSSLContextFactory.getInstance(false));
sslFilter.setUseClientMode(true);
chain.addFirst(sslFilter, sslFilter);

log.info(SSL ON);
}

/**
 * add log filter
 * @param chain
 * @throws Exception
 */
private static void addLogger(DefaultIoFilterChainBuilder chain)
throws Exception {

chain.addLast(logger, new LoggingFilter());

log.info(Logging ON); 
}



}




-- 
View this message in context: 
http://www.nabble.com/jzib.jarexception-not-threw-while-using-CompressionFilter-tf4611738s16868.html#a13209818
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.



Re: jzib.jar ---exception not threw while using CompressionFilter

2007-10-15 Thread Trustin Lee
Could you show us your log4j.properties or something similar?
Probably the exception message is being filtered by your logging
framework.  Please check your settings.

Trustin

On 10/15/07, rockyzheng [EMAIL PROTECTED] wrote:

 thanks for your reply.

 But I still don't get the exception  and although logging has been enabled
 already.

 Some wonder...

 Something was wrong ? My code was followings :


 public class ClientProxy {

 // log
 private static final Logger log =
 LoggerFactory.getLogger(ClientProxy.class);
 // ssl support
 private static final boolean sslSupport = Constants.isSSLEnable();
 // compress support
 private static final boolean compressSupport =
 Constants.isCompressEnable();

 private ClientMessage message;


 public ClientProxy(ClientMessage message){
 this.message = message;
 }

 /**
  *
  */
 public void start() throws Exception{

 SocketConnector connector = new SocketConnector();
 IoServiceConfig config = connector.getDefaultConfig();

 DefaultIoFilterChainBuilder filterChainBuilder = 
 config.getFilterChain();

 //add protocol codec filter
 filterChainBuilder.addLast(codec, new ProtocolCodecFilter(
 new MonitorServerCodecFactory(true)));

 //compress support,
 if (compressSupport) {
 addCompressSupport(filterChainBuilder);
 }

 //ssl support
 if (sslSupport){
 addSSLSupport(filterChainBuilder);
 }


 //log filter
 addLogger(filterChainBuilder);

 //connect
 ConnectFuture future = connector.connect(new
 InetSocketAddress(Constants.getServerIP(), Constants.getServerPort()),
 new ClientSessionHandler(message));

 future.join();

 }


 /**
  * add compress filter
  * @param chain
  */
 private static void addCompressSupport(DefaultIoFilterChainBuilder 
 chain)
 throws Exception{

 CompressionFilter filter = new CompressionFilter(
 CompressionFilter.COMPRESSION_MAX);
 chain.addFirst(compress, filter);

 log.info(Compress On);
 }

 /**
  * add ssl filter
  * @param chain
  * @throws Exception
  */
 private static void addSSLSupport(DefaultIoFilterChainBuilder chain)
 throws Exception {

 SSLFilter sslFilter = new
 SSLFilter(BogusSSLContextFactory.getInstance(false));
 sslFilter.setUseClientMode(true);
 chain.addFirst(sslFilter, sslFilter);

 log.info(SSL ON);
 }

 /**
  * add log filter
  * @param chain
  * @throws Exception
  */
 private static void addLogger(DefaultIoFilterChainBuilder chain)
 throws Exception {

 chain.addLast(logger, new LoggingFilter());

 log.info(Logging ON);
 }



 }




 --
 View this message in context: 
 http://www.nabble.com/jzib.jarexception-not-threw-while-using-CompressionFilter-tf4611738s16868.html#a13209818
 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.




-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6


Re: jzib.jar ---exception not threw while using CompressionFilter

2007-10-15 Thread rockyzheng

Just as following:

log4j.rootLogger=INFO,A1,R

# ConsoleAppender out
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-d{-MM-dd HH:mm:ss,SSS}
[%c]-[%p] %m%n

# File out
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=log/log4j.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{-MM-dd HH:mm:ss,SSS} [%t]
[%c] [%p] - %m%n
-- 
View this message in context: 
http://www.nabble.com/jzib.jarexception-not-threw-while-using-CompressionFilter-tf4611738s16868.html#a13209876
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.



jzib.jar ---exception not threw while using CompressionFilter

2007-10-12 Thread rockyzheng

when I used mina, I tried compress my data by CompressionFilter, but when I
published my program, I missed jzib.jar in the classpath, but no exception
was threw ,it just coulnd't transform data with servers. 
Thus ,I suggest while missing it, some exception to be threw maybe a better
way .


By the way, when some filter were added to chain, who can tell me how to
order them ? 
now ,I can take some followings : compress --ssl --log.
-- 
View this message in context: 
http://www.nabble.com/jzib.jarexception-not-threw-while-using-CompressionFilter-tf4611738s16868.html#a13170009
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.