0 Replies Latest reply on Jan 9, 2013 4:45 AM by Michael Erdmann

    Using netty causes an classloader issue.

    Michael Erdmann Newbie

      Actually i am trying to implement a small tcp/ip server using google protobuf and netty. At the end an event handler from the netty pipeline will be called which passes the specified message to the server logic. Before invoking the server logic i planned to decode the actual tcp/ip package using the code fragment below.

       

      public class ServerHandler extends SimpleChannelHandler {

       

         @Override

          public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {  

             ServerCommand req = (ServerCommand) e.getMessage();

             ServerNotification rsp = ServerNotification.newBuilder(). .... .build();

          }

      }

       

      When the client sends a message to the server i get on the server side:

       

      1:29:36,362 WARN  [org.jboss.modules] (New I/O server worker #33-1) Failed to define class site.boavista.community.itf.ClientITF$ServerCommandOrBuilder in Module "deployment.MyCommunityJBoss.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link site/boavista/community/itf/ClientITF$ServerCommandOrBuilder (Module "deployment.MyCommunityJBoss.war:main" from Service Module Loader)

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

      ...

           at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]

      Caused by: java.lang.NoClassDefFoundError: com/google/protobuf/MessageLiteOrBuilder

       

      which is quite surprising to me since to corrsponding jar of the protobuf package is included in the deployment war file. I would have expected this to be sufficent. Has anybody encountered such an issue already?

       

      The solution i found for this issue is quite clumsy; first i had to add protobuf to the server as module and i had to add

      protobuf as a dependency in the netty module. This steo is nit part of the deployment means of the process of the

      installation of the war file. Is there any way to include the module into the war file?

       

      Regards

        M.Erdmann

       

      Attached the exception log. The source code is avaiable under git://github.com/merdmann/MyCommunityJBoss.git

      The intersting package is site.boavista.jboss.view; pls. igonore the other packages since they are not yet called and need

      some rework.