users@grizzly.java.net

Re: New null pointer error

From: Mark Hig <mark.higginbottom_at_gmail.com>
Date: Thu, 11 Sep 2008 05:58:20 -0700 (PDT)

Yes our code works fine with 1.8.5.3.

Controller code as requested:

    /**
     * @see java.lang.Runnable#run()
     * Run the listener
     */
    public void run()
    {
        // tell Grizzly to use our logger
        LoggerUtils.setLogger(new GrizzlyLoggingBridge(log));
        
        sel = new SelectorThread();
        sel.setPort(port);
        sel.setEnableNioLogging(true);
        
        con = new Controller();
        con.setReadThreadsCount(readThreadsCount);
        sel.setController(con);
        sel.setMaxThreads(maxThreads);
        sel.setMinThreads(minThreads);
        sel.setKeepAliveTimeoutInSeconds(keepAliveTimeoutInSeconds);
        sel.setSsBackLog(backlog);
        
        // pre-register the JMX beans
// try
// {
// sel.preRegister(mbs, new
ObjectName("Grizzly:type=GrizzlyKeepAliveStats,name=GrizzlyKeepAliveStats"));
// sel.preRegister(mbs, new
ObjectName("Grizzly:type=GrizzlyPipelineStats,name=GrizzlyPipelineStats"));
// sel.preRegister(mbs, new
ObjectName("Grizzly:type=GrizzlyRequestGroupInfo,name=GrizzlyRequestGroupInfo"));
// sel.preRegister(mbs, new
ObjectName("Grizzly:type=GrizzlyRequestInfo,name=GrizzlyRequestInfo"));
// }
// catch (Exception e1)
// {
// // not a fatal error but log it
// log.error("Failed to pre-register Grizzly JMX beans.");
// }

        // create the JMX manager
// sel.setManagement(management);
        
        //Get and set up the Grizzly filter
        ICallbackAdapter adapter =
(ICallbackAdapter)SpringBeanFactory.getInstance().getBean(GRIZZLY_ADAPTER);
        adapter.setCallbackKey(CALLBACK_KEY);
        sel.setAdapter((Adapter)adapter);

        //Get and set up the Grizzly adapter
        final AsyncHandler handler = new DefaultAsyncHandler();
        ICallbackFilter filter =
(ICallbackFilter)SpringBeanFactory.getInstance().getBean(GRIZZLY_FILTER);
        filter.setCallbackKey(CALLBACK_KEY);
        handler.addAsyncFilter((AsyncFilter)filter);

        sel.setAsyncHandler(handler);
        sel.setEnableAsyncExecution(true);
        if (log.isDebugEnabled() || log.isInfoEnabled() )
        {
            sel.setDisplayConfiguration(true);
        }
        else
        {
            sel.setDisplayConfiguration(false);
        }
        try
        {
            sel.initEndpoint();
            
            // switch on JMX monitoring
            if (log.isDebugEnabled())
            {
                log.debug("Switching on Grizzly JMX monitoring.");
            }
            if (!sel.isMonitoringEnabled())
            {
// sel.enableMonitoring();
            }
            
// sel.startEndpoint();
            
            isRunning=true;
            log.info("Grizzly listener starting on port " + port);
            con.start();
            
            sel.startEndpoint();
        }
        catch(Exception e)
        {
            log.error("Failed to start Grizzly listener...");
            isRunning=false;
            loggingExceptionHandler.handle(Thread.currentThread(), e);
        }
        log.info("Exiting Grizzly listener.....");

    }






John ROM wrote:
>
> just to make sure,
> your code worked in version 1.8.5.3
> now in 1.8.5.4 sometimes you get NPE.
>
> could you post controller set up code?
>
>
>>
>>
>> No. I have no written any code that uses any SelectionKey object
>> directly.
>>
>>
>> Oleksiy Stashok wrote:
>> >
>> > Hi Mark,
>> >
>> > looks like somewhere null SelectionKey is registered on
>> > TCPSelectorHandler.
>> > Are there any places in your code, where it could happen?
>> >
>> > Anyway, think we have to throw NPE, during null SelectionKey
>> > registration, not processing.
>> > Can you pls. create an issue?
>> >
>> > Thanks.
>> >
>> > WBR,
>> > Alexey.
>> >
>> > On Sep 11, 2008, at 10:58 , Mark Hig wrote:
>> >
>> >>
>> >> Hi
>> >>
>> >> Since upgrading to the latest 1.8.5.4 jars (grizzly framework and http
>> >> webserver) we are regularly getting the following exception:
>> >>
>> >> 10-Sep-2008 10:00:42 com.sun.grizzly.Controller doSelect
>> >> SEVERE: doSelect exception
>> >> java.lang.NullPointerException
>> >> at
>> >> com
>> >> .sun
>> >> .grizzly
>> >> .DefaultSelectionKeyHandler.register(DefaultSelectionKeyHandler.java:
>> >> 160)
>> >> at
>> >> com.sun.grizzly.TCPSelectorHandler.onReadOp(TCPSelectorHandler.java:
>> >> 393)
>> >> at
>> >> com
>> >> .sun
>> >> .grizzly
>> >> .TCPSelectorHandler.processPendingOperations(TCPSelectorHandler.java:
>> >> 371)
>> >> at
>> >> com.sun.grizzly.TCPSelectorHandler.preSelect(TCPSelectorHandler.java:
>> >> 353)
>> >> at com.sun.grizzly.Controller.doSelect(Controller.java:367)
>> >> at
>> >> com.sun.grizzly.SelectorHandlerRunner.run(SelectorHandlerRunner.java:
>> >> 82)
>> >> at
>> >> com
>> >> .sun.grizzly.Controller.startSelectorHandlerRunner(Controller.java:
>> >> 1136)
>> >> at com.sun.grizzly.Controller.start(Controller.java:943)
>> >> at
>> >> com
>> >> .fujitsu
>> >> .poa.bal.grizzly.entrypoint.ListenerGrizzly.run(ListenerGrizzly.java:
>> >> 242)
>> >> at com.fujitsu.poa.bal.osr.nio.NioManager.await(NioManager.java:49)
>> >> at com.fujitsu.poa.bal.osr.server.OSRServer.await(OSRServer.java:387)
>> >> at com.fujitsu.poa.bal.osr.server.OSR.await(OSR.java:438)
>> >> at com.fujitsu.poa.bal.osr.server.OSR.start(OSR.java:397)
>> >>
>> >>
>> >> Please help.
>> >>
>> >> thanks
>> >>
>> >> Mark
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/New-null-pointer-error-tp19430618p19430618.html
>> >> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> >> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> > For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>> >
>> >
>
> --
> GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
> Jetzt dabei sein:
> http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/New-null-pointer-error-tp19430618p19434209.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.