Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Startup class problem

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I have a startup class in a war file. The class contains a ServerSocket which listens for client connections in a While loop. As an Application it works fine.
But when I try to deploy it in WebLogic / Tomcat (I changed it to a Startup Servlet ), the deployment is not getting over. Its entering the while loop in the startup class...and listens for the connections...not giving the control back.
Is there any workarounds for this problem.....Its urgent....
[ March 06, 2006: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
"Arjun CL",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
[ March 06, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Also, please do not cross-post the same question in more than one forum. This one has been closed.
 
    Bookmark Topic Watch Topic
  • New Topic