10 Replies Latest reply on Mar 18, 2005 2:31 PM by Juha Lindfors

    J2SE application, non J2EE

    Jim Dwyer Novice

      Hey,

      I understand how to do a J2EE application. How do I do an old fashioned application (non-J2EE) with a Gui on a TCP port and another UDP stream hookup? Is there any tutorials for that type of server?

      Jim

        • 1. Re: J2SE application, non J2EE
          Jim Dwyer Novice

          BTW,

          I am going to use this as a front end for a realtime box. There is no database. I need security, naming. I will probably be controlling a C program if I can. I need a long lived connection on TCP. I will be doing streaming out of a UDP. I know this is outside of the normal for JBoss but I know it will work. Just need a jump start on some things.

          Jim

          • 2. Re: J2SE application, non J2EE
            Juha Lindfors Master

            Trail: Custom Networking

            • 3. Re: J2SE application, non J2EE
              Jim Dwyer Novice

              Thanks Juha. I will look at that. I need to review my networking.

              What I don't understand is what type of object (bean I guess) I need to create for such a service. All of the examples show how to build J2EE Session and Entity Beans. Would I wrap the TCP connection into a J2EE session bean? J2EE seems to be a bit of overkill without a database. Does JBoss manage the socket connections to such primative services? Any suggestions would be appreciated.

              Jim

              • 4. Re: J2SE application, non J2EE
                Juha Lindfors Master

                You should wrap it as an MBean, as it is an extension to the server itself.

                There's examples on how to write MBeans and deploy them on JBoss at docs.jboss.org.

                • 5. Re: J2SE application, non J2EE
                  Jim Dwyer Novice

                  Excellent!

                  I am all over it like spilt coffee!

                  • 6. Re: J2SE application, non J2EE
                    Jim Dwyer Novice

                    JBossers,

                    Are there any good examples of this type of server available? I created an MBean already but am not sure where to put the ServerSocket piece.

                    Does it go right in the MBean? I guess I am a little confused about how JBoss deals with ports and such.

                    I was looking at the naming server source and it appears to be a stand alone server with a Main. Is this the way it runs within JBoss? As a standalone? Should I do the same?

                    This is a bit frustrating as I can't imagine it is that hard but I can't seem to see the light on how to construct this one.

                    Any help is appreciated.

                    Jim

                    • 7. Re: J2SE application, non J2EE
                      Kevin Liang Newbie

                      i also have similar interest in this....

                      i have legacy clients writing payload on long lived tcp connections....

                      the old server sits on a port and forks threads for each connection to that port.......

                      i would like to use jboss to replace this, but i dont know where to start looking....

                      if serviceMBean is the solution, would the MBean be forking threads for handling all connections as well?

                      can i hook invokers to this?

                      some direction would be appreciated!

                      thanks

                      • 8. Re: J2SE application, non J2EE
                        Jim Dwyer Novice

                        Kevliang,

                        I got mine working somewhat. Still lots of work to do.

                        First create an empty MBean and get that installed and working in JBoss.

                        Then inside the start method of the MBean create a Thread that creates a ServerSocket or ServerSocketChannel. Then inside the MBean.start method use the Thread.start method to kick off the newly created Thread.

                        You should then have a working MBean that is a server.

                        Let me know if you need some help. I can shot you am email.

                        Jim

                        • 9. Re: J2SE application, non J2EE
                          Kevin Liang Newbie

                          hey Jim,

                          yes, if you can, please shoot me an email, kevliang@amazon.com.

                          i would be interested in seeing what you have... after reading through many threads, i figured serverMBean would be the best, but i still have a few questions if you dont mind... =)

                          thanks!

                          • 10. Re: J2SE application, non J2EE
                            Juha Lindfors Master

                            I recommend JBoss for Advanced J2EE Developers for this. Answers all your questions on how to do this, with hands-on exercise.

                            Take care,