The startup servlet will need to exit the init() method in order for the deployment to complete. This is not really an appropriate place for a while loop.
I guess you could kick off a new
thread in which you create the ServerSocket, but creating threads inside a managed environment is considered to be
bad form as is creating a ServerSocket.
I would go back to your original requirements. Why are you creating a ServerSocket in the first place? What will be sent down the socket? If you want to use an app-server container
you should leverage the fact that the app-server is already listening on a port for incoming client requests, and has a thread pool waiting to process those requests. i.e. can't you turn the application into a full servlet ???
Sid