tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Vergès" <olivier.ver...@gmail.com>
Subject Re: adding a virtual host with jmx
Date Thu, 31 Jul 2008 13:04:35 GMT
oh sorry I've forgot, i'm using tomcat 6.0.
Thx for your help... but like i didn't know the english expression "on the
fly", i wasn't able to find docs.
now, yes... and i've found.

so org.apache.catalina.Mbeans is full of useful functions (like
createStandardHost...)
(I've spent a lot of time to find something  under my nose ...)

thx again, i keep your code in case (and better understand all of that).

Regards,

O.V.

2008/7/31 Bill Barker <wbarker@wilshire.com>

> It's a lot of lines of code, but not that hard.  You haven't mentioned your
> Tomcat version, so I'll give a sort of generic setup.
>    ObjectName loader = getServerLoader(); // depends on the settings and
> version
>    ObjectName registry = getRegistry(); // depends on the settings and
> version
>    MBeanServer server = getTCMBeansServer(); // generally the first one,
> unless you (or your J2EE) are playing games
>
>    String hname = "Catalina:type=Host,host="+hostName; // Assuming the
> default Engine name of "Catalina"
>    ObjectName ohost = new ObjectName(hname);
>    Object host = server.instantiate(HOST_CLASS, loader);
>    server.invoke(registry, "registerComponent",
>        new Object[] {host, hname, null},
>        new String[]
> {"java.lang.Object","java.lang.String","java.lang.String"});
>    server.setAttribute(ohost, new Attribute("appBase", appBase));
>    //  Set more attributes, and aliases etc here
>    // Things like Realms and Contexts work much the same way if you follow
> Tomcat's naming conventions
>    server.invoke(ohost, "start", null, null);
>    // Start your contexts here, if you don't have automatic deployment set.
>
> As long as you follow Tomcat's naming conventions for ObjectNames, invoking
> "start" will automagically add the new elements to where they should live.
> You can get the values for the "loader" and "registry" by hooking up a JMX
> console to your existing Tomcat.
>
> "Olivier Vergès" <olivier.verges@gmail.com> wrote in message
> news:575c33250807300655k26c65bbbx2ce0ec42e8c0839d@mail.gmail.com...
> > hi all,
> >
> > I'm creating a web application for auto deploying virtual host through
> > apache and tomcat on a production server.
> > Everything is ok except for the Tomcat part:
> > As tomcat can't be reloaded  and as i can't restart anytime I want,  I
> 've
> > heard jmx was great cause it was possible to modify a running tomcat (is
> > the
> > english expression is "on the fly"?).
> >
> > So, Connection to Mbean server is ok...
> >
> > My problem is :
> > when i invoke the addChild (org.apache.catalina.core.Container) method of
> > Engine I get this error:
> >             "java.io.NotSerializableException:
> > org.apache.catalina.util.LifecycleSupport
> >              at
> > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
> >              at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)..."
> >
> >
> > So i try to create my own addChildByString(String;String,String,String)
> > which takes the appabase and the name of th virtual host, and path and
> > docBase of the first needed context. But i've got a problem with the
> > context
> > now,
> > " GRAVE: Error getConfigured" (and nothing else)
> >
> > i'm a little lost with all the classes and functions and I haven't found
> > any
> > docs about adding vh by jmx.
> >
> > has anyone tried to add and directly make worked a virtual host and a
> > context on a running tomcat ?
> >
> > thx,
> > Olivier
> >
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message