• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing With Servlets

 
Sachin Dimble
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers!
I developed a simple servlet with a swing frame which communicates with oracle DB it's working fine but the problem is that if i closed the swing frame my tomcat get shut down!!

Could anybody explain why is it so? And how should i avoide it? Also i want to know how should i embeded my swing in to servlet??


Thanx In Advance!

Sachin. :roll:

- India_Will_Become_SuperITPower(new Lets_Go_ForIt());
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets run in the context of the server. If you call something like System.exit(), you're going to shut down the server.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to explain exactly what it is you are doing. Mixing swing and servlets makes as much sense to me as mixing Cheez Whiz with motor oil.
 
Sachin Dimble
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Bear For ur Response!

If my swing application terminates only that instance should get closed but what i am facing is my tomcat got terminate. if i tried System.exit(0) explicitly in any servlet tomcat shows error :Failed shut Down of Apache portable runtime.

And why i am doing all this stuff is just want to check the support for swing in tomcat???

Hope u undrstand what i mean!!!

Thanx & Regards,
Sachin.

- India_Will_Become_SuperITPower(new Lets_Go_ForIt());
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your swing application is starting tomcat, exiting the swing app will close tomcat. Start tomcat seperatly. Otherwise, you need to just close the main frame but do not exit the vm, as bear stated.
 
Sachin Dimble
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Gregg, I am starting my tomcat seperatly. when i request for servlet my swing get started as i am making instance of swing at starting of servlet!!!

Thanx & Regards,
Sachin

- India_Will_Become_SuperITPower(new Lets_Go_ForIt());
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i closed the swing frame my tomcat get shut down!!

I suggest you need to change the code that handles the swing frame close event. If it is boilerplate from some IDE it may be doing a System.exit() as suggested by Bear.
Also i want to know how should i embeded my swing in to servlet??

Short answer: Never
You need to refactor your code so that it does not need Swing at all. Server side code intended for serious use should not depend on the GUI on the server machine.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic