This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I do this utilizing Jetty or similar?  RSS feed

Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm new to writing web services, so please bear that in mind.


On the server machine I need to run a business simulation, which has dynamic state. Let's use a very simple example

An instance of this object must be *running at all times* on the server so that it's state is kept updated.

I also require a SOAP based web service that exposes Simulator::getState() so that remote machines can query the simulator's state.

A Solution

I've been reading 'Java Web Services Up and Running' and have modified his very simple example that utilizes an Endpoint object to publish the web service (this also utilizes a thread pool) and run the simulator at the same time. This works great and looks like this:

The Problem

I now need to do the same thing but deploy the WS in a web container such as Jetty. Unfortunately I haven't a clue how to do that (and run the sim at the same time) since main() is never called when Jetty starts the service.
I've tried calling simulator.Run() in the SimServerImpl constructor but that seems to hang the client when i go to test it.

I would very much appreciate it if someone could outline how I can solve this problem. I've been stumped for days now and I'm getting overwhelmed with all the options.

Many thanks and apologies for the long post.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!