4 Replies Latest reply on Jan 1, 2011 8:47 PM by mbrowne

    Using sockets from JBoss AS?

    mbrowne

      Hi,

      I am writing a web-app using the Seam Framework that needs to talk to a musical programming application called MaxMSP.

       

      It seemed to me that JBoss Remoting was a good solution for this, and I have a standalone test application working that will talk to MaxMSP (MaxMSP allows you to write Java externals, and I was able to get a JBoss Remoting server to work well from within MaxMSP).

       

      The problem is that when I tried to move the code for establishing the client connection and callback server to the Seam app, I got an EOFException "end of file" error message (thrown from line 877 of org.jboss.remoting.transport.socket.MicroSocketClientInvoker.java).

       

      After some Googling I saw a comment that led me to believe that JBoss AS might be blocking the socket connection. Is it even possible to use sockets with JBoss Remoting from within Jboss AS?

       

      I tried to use RMI instead and almost got it working but unfortunately that doesn't work from within MaxMSP...since MaxMSP has its own dynamic classloader and RMI also has a dynamic classloader, I think there's a conflict there based on the error I was getting. I came to this conclusion because I got the server code to work fine outside of MaxMSP (as a standalone app).

       

      Any pointers would be appreciated.

       

      Thanks,

      Matt

        • 1. Re: Using sockets from JBoss AS?
          mbrowne

          Just wanted to try to simplify my question in the hope of a quick response from someone... is it possible to use JBoss Remoting with sockets from within JBoss AS, or does JBoss AS block raw sockets, requiring that you use a different protocol?

           

          That way I can know whether troubleshooting the sockets issue is a waste of time... my issue here doesn't have much to do with the musical programming environment (MaxMSP) - I just mentioned that for context.

           

          Thanks

          • 2. Re: Using sockets from JBoss AS?
            ron_sigal

            Hi Matthew,

             

            I'm not sure I understand the question "is it possible to use JBoss Remoting with sockets from within JBoss AS".  But I'll try to answer anyway.  When you  wrote your standalone application, you created a Remoting server by creating an org.jboss.remoting.transport.Connector, right?  Well, you can do the same thing by configuring the Connector declaratively in a file in $JBOSS_HOME/server/$CONFIG/deploy.  The nature of your file will depend on the version of AS you are using.

             

            I'm not aware of any socket blocking.

             

            Hope that helps.  Am I close?

             

            -Ron

            • 3. Re: Using sockets from JBoss AS?
              mbrowne

              Thanks for the response...

               

              I was able to determine that the socket is in fact being created (by creating a SocketCreationListener), but that I'm getting the error when invoke() is called. I wasn't using a Connector but rather an InvokerLocator (see my code below).

               

               

               

                    InvokerLocator locator = new InvokerLocator(maxMspUri);
                    remotingClient = new Client(locator);
                    remotingClient.connect();
                  
                    callbackServerConnector = new Connector();
                    callbackServerConnector.setInvokerLocator(locator.getLocatorURI());
                    callbackServerConnector.start(

              The only thing I was able to find with respect to the "end of file" error message was this:

              https://issues.jboss.org/browse/JBREM-480?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

               

              I don't really understand the versioning issues, and I'm just using the code from the manual...but that ticket does mention "unusable socket connections," so I'm guessing the socket connection I established is considered unusable for some reason?

               

              I've tried using remoting-jboss-beans.xml for the configuration instead of doing programmatic configuration, but it doesn't seem to make any difference...then again, maybe I wasn't doing that part correctly.

               

              My code is pretty simple; at this point I'd be happy to get any communication working at all from my Seam app using sockets. Here's my connection code:

               

                     InvokerLocator locator = new InvokerLocator(maxMspUri);

                     remotingClient = new Client(locator);

                     remotingClient.connect();

               

              And this is how I'm sending the invocation (request is just a simple DTO object):

               

                   remotingClient.invoke(request, null);

               

              Could this maybe have something to do with the Seam framework?

               

              Thanks so much,

              Matt

              • 4. Re: Using sockets from JBoss AS?
                mbrowne

                I ended up using the Netty framework instead. It was simpler to get working since all I needed was to send simple DTOs over the network.

                 

                FYI, the only gotcha was that MaxMSP uses a special classloader, but fortunately Netty allows you to tell it what classloader to use when instantiating the ObjectDecoder object.