You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Murat OZDEMIR <mu...@dekateknoloji.com> on 2006/12/20 09:59:39 UTC

Exception at ExecutorFilter$ProcessEventsRunnable.run() line: 306

Hi everybody,
i'm trying to send an acknowledge message when received a message from
client. after receiving message messageReceived methode is executed
successfully, but before calling encode method (in MessageEncoder) something
causes an exception. The details are given below. Any help will be
appriciated. Thank you...
 
Murat OZDEMiR
 
 
 
EXECEPTION MESSAGE:
505758 [AnonymousIoService-2] INFO
tr.com.mobiliz.commserver.blo.GprsMessageHandler - [/127.0.0.1:2093]
EXCEPTION:
java.lang.NullPointerException
 at
org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory$ProtocolEnco
derImpl.<init>(DemuxingProtocolCodecFactory.java:181)
 at
org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory$ProtocolEnco
derImpl.<init>(DemuxingProtocolCodecFactory.java:171)
 at
org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory.getEncoder(D
emuxingProtocolCodecFactory.java:148)
 at
org.apache.mina.filter.codec.ProtocolCodecFilter.getEncoder(ProtocolCodecFil
ter.java:288)
 at
org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFi
lter.java:213)
 at
org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterWrite
(AbstractIoFilterChain.java:445)
 at
org.apache.mina.common.support.AbstractIoFilterChain.access$1500(AbstractIoF
ilterChain.java:54)
 at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.filterWrite
(AbstractIoFilterChain.java:824)
 at org.apache.mina.filter.LoggingFilter.filterWrite(LoggingFilter.java:115)
 at
org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterWrite
(AbstractIoFilterChain.java:445)
 at
org.apache.mina.common.support.AbstractIoFilterChain.access$1500(AbstractIoF
ilterChain.java:54)
 at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.filterWrite
(AbstractIoFilterChain.java:824)
 at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.filterWrite(
AbstractIoFilterChain.java:727)
 at
org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterWrite
(AbstractIoFilterChain.java:445)
 at
org.apache.mina.common.support.AbstractIoFilterChain.fireFilterWrite(Abstrac
tIoFilterChain.java:436)
 at
org.apache.mina.transport.socket.nio.SocketSessionImpl.write0(SocketSessionI
mpl.java:186)
 at
org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:145)
 at
org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:131)
 at
tr.com.mobiliz.commserver.blo.GprsMessageHandler.messageReceived(GprsMessage
Handler.java:69)
 at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageRecei
ved(AbstractIoFilterChain.java:703)
 at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
(AbstractIoFilterChain.java:362)
 at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoF
ilterChain.java:54)
 at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageRece
ived(AbstractIoFilterChain.java:800)
 at
org.apache.mina.filter.LoggingFilter.messageReceived(LoggingFilter.java:97)
 at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
(AbstractIoFilterChain.java:362)
 at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoF
ilterChain.java:54)
 at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageRece
ived(AbstractIoFilterChain.java:800)
 at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(Simpl
eProtocolDecoderOutput.java:60)
 at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCod
ecFilter.java:184)
 at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
(AbstractIoFilterChain.java:362)
 at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoF
ilterChain.java:54)
 at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageRece
ived(AbstractIoFilterChain.java:800)
 at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.j
ava:243)
 at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Exe
cutorFilter.java:305)
 at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:987)
 at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:528)
 at java.lang.Thread.run(Unknown Source)
505758 [AnonymousIoService-2] INFO
tr.com.mobiliz.commserver.blo.GprsMessageHandler - [/127.0.0.1:2093] CLOSE

 
 
EXCEPTION OCCURS OVER HERE:
ExecutorFilter$ProcessEventsRunnable.run() line: 306

VARIABLE DEBUG DURING EXCEPTION
this= ExecutorFilter$ProcessEventsRunnable  (id=41)
 buffer= ExecutorFilter$SessionBuffer  (id=878)-
  eventQueue= ArrayList<E>  (id=880)
   elementData= Object[10]  (id=881)
    [0]= ExecutorFilter$Event  (id=882)
     data= NullPointerException  (id=884)
      cause= NullPointerException  (id=884)
      detailMessage= null
      stackTrace= null
     nextFilter= AbstractIoFilterChain$EntryImpl$1  (id=37)
     type= ExecutorFilter$EventType  (id=885)
    [1]= null
    [2]= null
    [3]= null
    [4]= null
    [5]= null
    [6]= null
    [7]= null
    [8]= null
    [9]= null
   modCount= 5
   size= 1
  processingCompleted= false
  session= SocketSessionImpl  (id=49)
 this$0= ExecutorFilter  (id=39)
 
 
 
 
My IoHandlerAdapter Implementation messageReceived Methode:
 public void messageReceived(IoSession session, Object msg) throws Exception

 {
  if ( msg instanceof StatusLocationMessage )
  {
   StatusLocationMessage message = (StatusLocationMessage) msg;
   SessionLog.info(session, "Message received...");
   java.text.DateFormat datefmt = new java.text.SimpleDateFormat (
"dd.MM.yyyy HH:mm:ss" );
   java.util.Date msgTime = new java.util.Date (
message.getUtcDateTime().getTimeInMillis() );
   datefmt.format ( msgTime );
   System.out.println( 
     "UnitID:" + message.getUnitNumber() + ",  " +
     "Num:" + message.getNumerator() + ",  " +
     "Trans.Reason:" + message.getMessageReason() + ",  " +
     "Time:" + msgTime + ", " +
     "Longitude:" + message.getLongitude() + ",  " +
     "Latitude:" + message.getLatitude() + ",  " +
     "Altitude:" + message.getAltitude() +  ",  " +
     "Speed:" +  message.getSpeed() + " km/h  " + ", " + 
     "Odometer:"  + message.getUnitOdometer() + " km  " +
     "Course:" + message.getSpeedDirection() + " degree"
     );
   AcknowledgeMessage ack = new AcknowledgeMessage();
   byte authCode[] = { 1, 1, 1, 1 };
   ack.setAuthenticationCode( authCode );
   ack.setUnitNumber( message.getUnitNumber() );
   ack.setNumerator( (byte) message.getNumerator() );
   session.write( ack );
   SessionLog.info(session, "ACK sent...");
  }
 }

 
 
 
MY ACKNOWLEDGE MESSAGE DTO CLASS
public class AcknowledgeMessage extends OutboundMessageBase
{

 private byte authenticationCode[];
 private int actionCode;
 private short commandNumerator; 
 
 //Main Acknowledge number; The Message Numerator filed of the acknowledged
outbound message.
 //Secondary acknowledge number; Currently not used.
 
 public AcknowledgeMessage ()
 {
  super.setSystemCode( Constants.GPRS_HEADER );
  super.setType( (byte) 0 );  
 }
 public String getSystemCode() 
 {
  return super.getSystemCode();
 }

public byte[] getAuthenticationCode() {
 return authenticationCode;
}

public void setAuthenticationCode(byte[] authenticationCode) {
 this.authenticationCode = authenticationCode;
}

 public int getActionCode() {
  return actionCode;
 }

 public short getCommandNumerator() {
  return commandNumerator;
 }
}
 
 
OUTBOUNDMESSAGEBASE DTO CLASS
public class OutboundMessageBase 
{
 private String systemCode;
 private byte type;
 private int unitNumber;
 private byte numerator;
 
 /**
  * @return Returns the numerator.
  */
 public byte getNumerator() {
  return numerator;
 }
 /**
  * @param numerator The numerator to set.
  */
 public void setNumerator(byte numerator) {
  this.numerator = numerator;
 }
 /**
  * @return Returns the systemCode.
  */
 public String getSystemCode() {
  return systemCode;
 }
 /**
  * @param systemCode The systemCode to set.
  */
 public void setSystemCode(String systemCode) {
  this.systemCode = systemCode;
 }
 /**
  * @return Returns the type.
  */
 public byte getType() {
  return type;
 }
 /**
  * @param type The type to set.
  */
 public void setType(byte type) {
  this.type = type;
 }
 /**
  * @return Returns the unitNumber.
  */
 public int getUnitNumber() {
  return unitNumber;
 }
 /**
  * @param unitNumber The unitNumber to set.
  */
 public void setUnitNumber(int unitNumber) {
  this.unitNumber = unitNumber;
 }
}


Re: Exception at ExecutorFilter$ProcessEventsRunnable.run() line: 306

Posted by Trustin Lee <tr...@gmail.com>.
On 12/21/06, Murat OZDEMiR <mo...@gmail.com> wrote:
>
> Dear Trustin,
> You're exectly right. I've pointed source codes for imported JAR files of
> MINA core. I've seen that getMessageTypes() methode is returning null, i
> added messagetypes such as;
>
>     private static final Set TYPES;
>
>     static
>     {
>         Set types = new HashSet();
>         types.add( AcknowledgeMessage.class );
>         TYPES = Collections.unmodifiableSet( types );
>     }
>
>         public Set getMessageTypes()
>         {
>                 return TYPES;
>         }
>
> But, this time i'm searching why put methode is not filling the ByteBuffer
> buff. Buff is sending to peer as all zeros. Maybe you have an advice.
> Thanks for your interest have a good time.


There's a FAQ entry on flip() method in our web site.  Please take a look
there.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

RE: Exception at ExecutorFilter$ProcessEventsRunnable.run() line: 306

Posted by Murat OZDEMiR <mo...@gmail.com>.
Dear Trustin,
You're exectly right. I've pointed source codes for imported JAR files of
MINA core. I've seen that getMessageTypes() methode is returning null, i
added messagetypes such as;

    private static final Set TYPES;
    
    static
    {
        Set types = new HashSet();
        types.add( AcknowledgeMessage.class );
        TYPES = Collections.unmodifiableSet( types );
    }
    
	public Set getMessageTypes() 
	{
		return TYPES;
	}

But, this time i'm searching why put methode is not filling the ByteBuffer
buff. Buff is sending to peer as all zeros. Maybe you have an advice.
Thanks for your interest have a good time.

Murat

-----Original Message-----
From: Trustin Lee [mailto:trustin@gmail.com] 
Sent: Thursday, December 21, 2006 3:22 AM
To: dev@mina.apache.org
Subject: Re: Exception at ExecutorFilter$ProcessEventsRunnable.run() line:
306

On 12/20/06, Murat OZDEMIR <mu...@dekateknoloji.com> wrote:
>
> Hi everybody,
> i'm trying to send an acknowledge message when received a message from 
> client. after receiving message messageReceived methode is executed 
> successfully, but before calling encode method (in MessageEncoder) 
> something causes an exception. The details are given below. Any help 
> will be appriciated. Thank you...
>
> Murat OZDEMiR
>
>
>
> EXECEPTION MESSAGE:
> 505758 [AnonymousIoService-2] INFO
> tr.com.mobiliz.commserver.blo.GprsMessageHandler - [/127.0.0.1:2093]
> EXCEPTION:
> java.lang.NullPointerException
> at
>
> org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory$Protoc
> olEnco
> derImpl.<init>(DemuxingProtocolCodecFactory.java:181)


Assuming that you are using the latest stable release of MINA (1.0.1)...

What do your MessageEncoder implementations return when getMessageTypes() is
invoked?  It seems like one of your implementation is returning null.

Please let me know if I am correct.

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6


Re: Exception at ExecutorFilter$ProcessEventsRunnable.run() line: 306

Posted by Trustin Lee <tr...@gmail.com>.
On 12/20/06, Murat OZDEMIR <mu...@dekateknoloji.com> wrote:
>
> Hi everybody,
> i'm trying to send an acknowledge message when received a message from
> client. after receiving message messageReceived methode is executed
> successfully, but before calling encode method (in MessageEncoder)
> something
> causes an exception. The details are given below. Any help will be
> appriciated. Thank you...
>
> Murat OZDEMiR
>
>
>
> EXECEPTION MESSAGE:
> 505758 [AnonymousIoService-2] INFO
> tr.com.mobiliz.commserver.blo.GprsMessageHandler - [/127.0.0.1:2093]
> EXCEPTION:
> java.lang.NullPointerException
> at
>
> org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory$ProtocolEnco
> derImpl.<init>(DemuxingProtocolCodecFactory.java:181)


Assuming that you are using the latest stable release of MINA (1.0.1)...

What do your MessageEncoder implementations return when getMessageTypes() is
invoked?  It seems like one of your implementation is returning null.

Please let me know if I am correct.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6