Thanks Dewayne

I should have mentioned this earlier, I'm running JBoss 2.0 Final with Tomcat
3.2b7 (a fairly old download, I know, but so far I haven't needed a newer
version), with the 1.3 jdk.

I'll try the <load-on-startup> element, that should should work if the servlet
actually executes it's code (which sets up a cache of entity beans that other
servlets, later, through client GET and POST requests, interact with). If all it
does is load the class, it's not much use - it has to execute too.  I've used
that element in a web.xml for JRun, come to think of it, I'm not sure why I
thought JBoss didn't support that functionality (it is a J2EE standard
after-all).  Hopefully, that will do the trick.  Sun does have this to say about
the element:

    Loading servlets at server startup may fail under certain conditions. The
J2EE server can load a servlet and call a servlet's
    init method when the server is started, but the results are unpredictable.
Such servlets include those that are registered in
    the web.xml file with a <load-on-startup> element.

Hopefully JBoss does this reliably.  Have you tried a startup servlet like this
in JBoss?

I suppose the T3StartupDef in WebLogic is somewhat similar in concept (both get
run when the server starts up), but the servlet I have in mind executes on
startup, leaves a cache of beans behind, and bails.  Those T3StartupDefs usually
listen for events continually.  I've used those, they're a little messy, but
seem to work in the end.  I don't think I'd use them for what I want do.

Thanks Dewayne, I think that should work.



Dewayne McNair wrote:

> Sorry for jumping in late... I wasn't paying attention when this thread got
> started, but...
>
> Are you talking about a _servlet_ that is loaded via the '<load-on-startup>'
> element in a web.xml?   Or, are you talking about an _object_ that is loaded
> on startup -- an object that implements T3StartupDef in Weblogic, for
> example.  Or, something else?
>
> Also, just for the record, what version of JBoss & Tomcat are you using?
>
> -- Dewayne
>
> > Thanks David
> >
> > This is a little disappointing, as this sort of thing is a 3 line
> properties
> > file addition in other application servers (although expensive ones).  I
> > will try to set this up, but if it takes longer than a day I will be
> forced
> > to un-embed Tomcat, or pay for this type of functionality.
> >
> > This must have been overlooked with the initial design.  It's nice to have
> > the app server and the servlet runner working together in the same VM, but
> > if the functionality of the servlet runner isn't as much as it would be by
> > itself, it's not much use to serious development.  I hope parsing
> server.xml
> > will clear this up.
> >
> >
> >
> >
> > Castro, David wrote:
> > >I believe you can do both - though I have not done it myself.  I will not
> > >speak too much to what I do not know; if you are familiar with tomcat (it
> > >sounds like you are) then it should work as you expect.
> > >
> > >The server.xml in the binary distribution contains the interceptors
> > >necessary to get JNDI to function correctly, and I BELIEVE this will work
> > >even for classes deployed directly through tomcat.  You will not get
> > >optimized classloading if you deploy directly through tomcat (unless you
> > >put
> > >your interfaces/shared classes in the classpath).
> > >
> > >I do not know of examples and I am guessing a bit here, so keep asking if
> > >something does not work as you expect.
> > >
> > >> -----Original Message-----
> > >> From: Colin Payne [mailto:[EMAIL PROTECTED]]
> > >> Sent: Tuesday, February 27, 2001 12:04 PM
> > >> To: Castro, David
> > >> Subject: Re: FW: [jBoss-User] Startup servlets when using embedded
> > >> Tomcat?
> > >>
> > >>
> > >> Thanks David
> > >>
> > >> Are there any simple examples yet to go along with this that
> > >> you know of
> > >> (parsing server.xml)?  Does this mean that you can set up contexts in
> > >> server.xml as well as JBoss, or is it restricted to one or the other?
> > >>
> > >>
> > >> Castro, David wrote:
> > >> >Try downloading the new binary   -
> > >> /newsite/bin/jboss-tomcat-2.1-beta.zip
> > >> >
> > >> >server.xml is now parsed, so I am thinking that will solve your
> > >> >problem...
> > >> >
> > >> >> -----Original Message-----
> > >> >> From: Colin Payne [mailto:[EMAIL PROTECTED]]
> > >> >> Sent: Tuesday, February 27, 2001 10:34 AM
> > >> >> To: JBoss-User
> > >> >> Subject: Re: [jBoss-User] Startup servlets when using
> > >> embedded Tomcat?
> > >> >>
> > >> >>
> > >> >> Hi Steve
> > >> >>
> > >> >> I should clear something up.  I have successfully deployed
> > >> the simple
> > >> >> servlet examples using .war files and simple contexts, that
> > >> >> is not what I'm
> > >> >> talking about.
> > >> >>
> > >> >> Rather, I'm talking about a servlet which you can't hit
> > >> through a web
> > >> >> browser, one that is executed (and has been set up to do so,
> > >> >> like you would
> > >> >> normally do through Apache's server.xml) when the servlet
> > >> >> engine (and JBoss
> > >> >> server, in this case) starts up.  I want to do this to cache
> > >> >> a number of
> > >> >> entity beans upon server startup.  This is pretty standard
> > >> >> functionality,
> > >> >> WebLogic and JRun both allow you to do this, for example, as
> > >> >> does Tomcat
> > >> >> when you use server.xml (which is ignored in the Tomcat-JBoss
> > >> >> configuration).  There is a big difference between a startup
> > >> >> servlet and one
> > >> >> that you hit through a GET or POST request.
> > >> >>
> > >> >> If I can't execute startup servlets with the Tomcat-JBoss
> > >> >> configuration,
> > >> >> then it's useless to me, I'll have to run Tomcat with Apache,
> > >> >> and let JBoss
> > >> >> run in its own virtual machine.  I must have startup servlets.
> > >> >>
> > >> >> Please let me know if this is still unclear.
> > >> >>
> > >> >> JBoss-User wrote:
> > >> >> >> Thanks Steve
> > >> >> >>
> > >> >> >> I'm still a little unclear as to whether the servlet is
> > >> >> actually run
> > >> >> >(ie. to
> > >> >> >> cache some objects) or is the context just registered?
> > >> >> >
> > >> >> >Well, here it actually runs ... I hit
> > >> >> localhost:8080/<context name> and
> > >> >> >there's the pages. Is that same format failing there?
> > >> >> >
> > >> >> >S-
> > >> >> >
> > >> >> >>
> > >> >> >> JBoss-User wrote:
> > >> >> >> >> Hello
> > >> >> >> >>
> > >> >> >> >> Has anyone had any success configuring and deploying a
> > >> >> servlet that
> > >> >> >> >gets
> > >> >> >> >> executed upon the JBoss server startup, when using the
> > >> >> >> >> embedded-Tomcat/JBoss configuration?
> > >> >> >> >
> > >> >> >> >Yes, this was no problem. I put a .war file (standard
> > >> >> internal format)
> > >> >> >in
> > >> >> >> >the
> > >> >> >> >deploy directory of jBoss. It notices this at once and loads it
> > >> >> >(default
> > >> >> >> >config) and also loads it at startup.
> > >> >> >> >
> > >> >> >> >As far as configuring, my .war is called "ums.war" and
> > >> >> gets assigned
> > >> >> >the
> > >> >> >> >context "ums", but I am not sure if these two facts
> > >> are causally
> > >> >> >> >connected.
> > >> >> >> >Also, the index.html is not found when loading
> > >> >> localhost:8080/ums, but
> > >> >> >> >instead
> > >> >> >> >the name must be specified
> > >> ("localhost:8080/ums/index.html"). I am
> > >> >> >pretty
> > >> >> >> >sure that all this can be configured correctly through
> > >> >> JMX but have no
> > >> >> >> >idea
> > >> >> >> >how yet. :)
> > >> >> >> >
> > >> >> >> >You can make .war files easily if you set up your project
> > >> >> to use ant.
> > >> >> >See
> > >> >> >> >"Developing Applications With Tomcat" which is in the
> > >> >> docs that come
> > >> >> >with
> > >> >> >> >TomCat.
> > >> >> >> >
> > >> >> >> >HTH,
> > >> >> >> >
> > >> >> >> >S-
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to