mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: MINA and Glassfish
Date Tue, 21 Oct 2008 11:09:49 GMT
Niklas Gustavsson wrote:
> Hey
>
> Has anyone made any progress on the troubles with MINA 2.0 in
> Glassfish? We have had some FtpServer users who have run into problems
> when deploying FtpServer in Glassfish, and they seem to be related. I
> just tried deploying our WAR example in Glassfish V2 UR2 b04 and got
> the following exception thrown repeatedly:
> [#|2008-10-21T11:16:20.593+0200|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=NioSocketAcceptor-2;|[
> WARN] 2008-10-21 11:16:20,593 [] [] Unexpected exception.
> java.lang.NullPointerException
> 	at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:206)
> 	at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:48)
> 	at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.processHandles(AbstractPollingIoAcceptor.java:451)
> 	at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Worker.run(AbstractPollingIoAcceptor.java:388)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
>
> I'm sorry to say that I don't know the internals of NIO nor Glassfish
> enough to track this down myself but I'll be glad to be of any help I
> can to solve this. Should we maybe get in touch with our friends over
> at Glassfish?
>
> /niklas
>
> On Fri, Aug 1, 2008 at 4:55 AM, Mezei Zoltan <mezei.zoltan@gmail.com> wrote:
>   
>> Hi,
>>
>> I have a really simple client application that uses the following
>> method to establish a connection:
>>
>> Logger logger = LoggerFactory.getLogger("test");
>> IoConnector ioConnector = new NioSocketConnector();
>> ioConnector.getFilterChain().addLast("logger", new LoggingFilter());
>> ioConnector.setHandler(new IoHandlerAdapter());
>> logger.debug("Before connect...");
>> ConnectFuture cf = ioConnector.connect(new
>> InetSocketAddress("localhost", 19971));
>> logger.debug("After connect...");
>> logger.debug("Before await...");
>> cf.awaitUninterruptibly();
>> logger.debug("After await...");
>>
>> I created a standard java application that invokes this method and got
>> the following output:
>>
>> 04:37:58.575 [main] DEBUG test - Before connect...
>> 04:37:58.581 [main] DEBUG test - After connect...
>> 04:37:58.582 [main] DEBUG test - Before await...
>> 04:37:58.596 [NioProcessor-1] INFO  o.a.m.filter.logging.LoggingFilter - CREATED
>> 04:37:58.597 [main] DEBUG test - After await...
>> 04:37:58.598 [NioProcessor-1] INFO  o.a.m.filter.logging.LoggingFilter - OPENED
>> 04:37:58.609 [NioProcessor-1] INFO  o.a.m.filter.logging.LoggingFilter
>> - RECEIVED: HeapBuffer[pos=0 lim=114 cap=2048: 43 49 4D 44 32 2D 41 20
>> 43 6F 6E 6E 65 63 74 69...]
>>
>> That's OK, I expected this behavior.
>>
>> However I also created a web application that includes a
>> ContextListener. The ContextListener calls the method on startup and I
>> get this output:
>>
>> 04:30:48.469 [httpWorkerThread-4848-1] DEBUG test - Before connect...
>> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - After connect...
>> 04:30:48.477 [httpWorkerThread-4848-1] DEBUG test - Before await...
>> 04:30:48.481 [NioSocketConnector-1] WARN
>> o.a.m.core.DefaultExceptionMonitor - Unexpected exception.
>> java.lang.NullPointerException
>>       at org.apache.mina.core.polling.AbstractPollingIoConnector$ConnectionRequest.access$200(AbstractPollingIoConnector.java:517)
>>       at org.apache.mina.core.polling.AbstractPollingIoConnector.processTimedOutSessions(AbstractPollingIoConnector.java:446)
>>       at org.apache.mina.core.polling.AbstractPollingIoConnector.access$600(AbstractPollingIoConnector.java:64)
>>       at org.apache.mina.core.polling.AbstractPollingIoConnector$Worker.run(AbstractPollingIoConnector.java:471)
>>       at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
>>       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>       at java.lang.Thread.run(Thread.java:619)
>>
>> What can go wrong when I use the web application? Can I make it work somehow?
>>     
I think there is something wrong in MINA code :

    protected NioSession accept(IoProcessor<NioSession> processor,
            ServerSocketChannel handle) throws Exception {

        SelectionKey key = handle.keyFor(selector);
        if (!key.isAcceptable()) {  <--- Here, if the key is null, you 
get a NPE...

I will fix that immediatly.

Could you check it with Glassfish when I will have committed the code ?

Thanks !

-- 
--
cordialement, regards,
Emmanuel L├ęcharny
www.iktek.com
directory.apache.org



Mime
View raw message