--- Bill Barker <[EMAIL PROTECTED]> wrote: > Urm, something like: > tomcat.stop(); > > where 'tomcat' is your Embedded instance? > > "Oleg Lebedev" <[EMAIL PROTECTED]> wrote in > message > news:[EMAIL PROTECTED] > Hello, > > I am trying to configure, start and then shutdown > Tomcat from my Java > class. I am planning to have all the jars required > by Tomcat on the > classpath and I would like to be able to specify the > port number and > host using method calls. I would prefer not to ship > Tomcat configuration > files, such as server.xml with my application and be > able to configure > Tomcat from code before starting it. > > I tried using Boostrap class, but it requires > catalina.home and > catalina.base, which I would like to avoid using. > I tried using Embed class and it worked, but I still > had to set > catalina.home so that it can find tomcat-users.xml. > But, this is > acceptable. > > I have not been able to shut Tomcat down from my > Java code. Note that I > won't have a handle to the Catalina instance > started, because Tomcat > needs to be started before my application starts in > a separate VM, and > then killed when my application exists. > > I would appreciate any feedback on how to do this or > what Tomcat classes > I should take a look at. > > Thanks. > > Oleg > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > >
I guess if you know how to do this when you do have an instance in the same VM then you can simply use the web application you are using in the backend. I assume you are connecting to this server from clients or something. In the code creating the instance store the Object in a static variable in a package you install in the extensions directory of the executing vm or the trusted libraries for the tomcat instance. This way they are available to all classes in the Tomcat instance. Then you can shut it down from your other application by accessing a servlet or soemthing. You might have to play around with the security access for the methods though...not sure. Anyways, basically you just make a simple class so you can install it like that. It won't be something you change much and it's sole purpose is so it's part of your class package and system. It could be as simple as a single class with nothing but a static instance of the Tomcat server so you can access it. Just a simple idea, but should work unless you can simply edit the security file to allow your web app code to access the internal tomcat engine it's running in. Which you should be able to do that as well. Wade --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]