4

In netty version 3.2.5 in method

public ChannelPipeline getPipeline() throws Exception { ... }

have a decoder defined as follows:

pipeline.addLast("decoder", new ObjectDecoder());

I have upgraded to Netty version 3.2.7 which has the ObjectDecoder() deprecated and it now requires a ClassResolver. Does anyone have a code example of how to implement the new ObjectDecoder(ClassResolver) in the getPipeline() method in version 3.2.7?

1 Answer 1

1

Here's the documentation on Netty ClassResolver.

http://netty.io/docs/stable/api/org/jboss/netty/handler/codec/serialization/ClassResolvers.html

Pick the class resolver that best meets your requirements.

I think you maybe able to do something like this:

new ObjectDecoder(ClassResolvers.weakCachingConcurrentResolver(null))
Sign up to request clarification or add additional context in comments.

3 Comments

Veebs thanks for that solution which works. I now have an exception (which is not related to this solution). The exception occurs when the client sends the message to the server. I have posted the first part of this exception. Does anyone know how this can be resolved. java.io.InvalidClassException: failed to read class descriptor at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1567) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
Hi, this link may be of help: markmail.org/message/4ftws33dxehbzbwd. Try specifying a ClassLoader. You may want to mark this question as answered and open another question if you still have problems. Thanks.
@Veebs: I see it in the code but not in the API (javadocs)... What exactly does this do and mean?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.