This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Swing With Servlets  RSS feed

 
Ranch Hand
Posts: 100
  • 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());
 
Marshal
Posts: 67256
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
Marshal
Posts: 67256
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
  • 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());
 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • 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
  • 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());
 
Author and all-around good cowpoke
Posts: 13078
6
  • 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
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!