Aha - thank you! I failed to notice that one was describing the
EmbeddedTomcatService,
and one was descripting the plain TomcatService. I had been pretty much
relying
on the TomcatService docs, because this service seems a little more simple
to set up.
However, I'm still getting a class cast problem (not being able to cast
objects of
identical class, because the 2 instances were load from 2 different class
loaders).
I basically followed directions for setting up classpath, except I'm unsure
where
to put my proprietary classes (working.jar). Should it be in both Tomcat's
WEB-INF/lib
and jboss's lib/ext? Is there any rules for what jar's I should leave OUT
when setting up
the classpath?
Thank you,
Adam
[EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Sebastien Alborini
Sent: Wednesday, October 25, 2000 3:17 PM
To: jBoss
Subject: Re: [jBoss-User] Dumb Newbie Question
Adam Rabung wrote:
>
> Thank you Aaron, that worked quite well!
>
> My next newbie step was to integrate with Tomcat. That's gone
> fairly smoothly, but now that I'm attempting to look up objects
> in Tomcat that I bound to the JNDI tree in my custom service, and I'm
> running
> into classpath problems. This is most certainly happening because
> to cast I'm trying to cast a class that was loaded by jBoss to
> a class that was loaded by Tomcat. I've seen other people dealing
> with this in the mail list, but I can't seem to reproduce their
> solution.
>
> One thing I don't understand is how to use the Jdk12Interceptor.
> Many of the people on the mailing list mention it as solving the problem.
> It seems that it is crucial, but the documentation seems to
> contradict itself regarding server.xml, where it is set up. The
> Tomcat HOWTO (http://www.jboss.org/tomcat.htm) makes no mention
> of Jdk12Interceptor, and even explicitly states that Tomcat's server.xml
> will not be processed. However in the Tomcat section of the Getting
> Started guide (http://www.jboss.org/manual/third_party.html#tomcat),
> it mentions adding the RequestInterceptor tag to the server.xml
> file. I tried adding this tag, despite the HOWTO's warnings
> that server.xml would not be parsed, but to no avail. Which
> guide for setting up Tomcat is correct here?
Both :)
The tomcat howto you mention should be integrated in the manual, in the
last section ("forthcoming"). For now:
- if you use TomcatService, see
http://www.jboss.org/manual/third_party.html#tomcat, and add
jdk12Interceptor in server.xml.
- if you use EmbeddedTomcatService, see http://www.jboss.org/tomcat.htm,
the jdk12int'r will be added.
Sebastien
> In general, are there more explicit rules for setting up classpath with
> regards to Tomcat/jBoss? I have my proprietary classes in a jar
> named working.jar. I believe they should go into at least jboss/lib/ext.
> Should it go into the WEB-INF/lib directory as well? Should it be
> explicitly added to the CLASSPATH in run.sh?
>
> I'm running this on Sun 1.2.2/Redhat Linux/Tomcat 3.2 beta 4/jBoss beta 3
> (downloaded Tuesday).
>
> Thank you for any help.
>
> Adam
> [EMAIL PROTECTED]
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Aaron Mulder
> Sent: Tuesday, October 24, 2000 1:26 PM
> To: jBoss
> Subject: Re: [jBoss-User] Dumb Newbie Question
>
> Try making your TestServerMBean extend
> org.jboss.util.ServiceMBean. The start method is declared in a parent
> interface to ServiceMBean, and JMX needs the "start" to be declared in an
> interface before it can be called on an implementation. FYI, the
> "Start" in ServiceMBeanSupport calls your "startService".
>
> Aaron
>
> On Tue, 24 Oct 2000, Adam Rabung wrote:
> > Hi All,
> > Please forgive me if this question is uninformed.
> > I'm trying to create a custom MBean. I found the section in
> > the documentation on "Custom MBeans"
> > (http://www.jboss.org/manual/adv_config.html#custom).
> > Following the directions, I first implemented my service, sublassing
> > org.jboss.util.ServiceMBean and org.jboss.util.ServiceMBeanSupport.
> > I called this class TestService:
> >
> > package com.experient.toolbox.chuchu;
> >
> > import javax.management.MalformedObjectNameException;
> > import javax.management.MBeanServer;
> > import javax.management.ObjectName;
> >
> > import org.jboss.logging.Log;
> > import org.jboss.util.ServiceMBeanSupport;
> >
> > public class TestService extends ServiceMBeanSupport implements
> > org.jboss.util.ServiceMBean, TestServiceMBean {
> > private Log myLog = new Log("TestService");
> >
> > public TestService () {
> > System.out.println("Constructing TestService");
> > }
> >
> > public ObjectName getObjectName (MBeanServer server, ObjectName name)
> > throws MalformedObjectNameException {
> > return new ObjectName(OBJECT_NAME);
> > }
> >
> > public String getName () {
> > return "TestService";
> > }
> >
> > public void startService () {
> > System.out.println("Starting TestService");
> > }
> >
> > public void stopService () {
> > myLog.log ("Stopping TestService");
> > }
> >
> > }
> >
> > Comparing my class to other services that come with jBoss, I realized I
> > needed to implement a TestServiceMBean interface:
> >
> > package com.experient.toolbox.chuchu;
> >
> > public interface TestServiceMBean {
> > public static final String OBJECT_NAME = ":service=TestService";
> > }
> >
> > Next, I added the following line to jboss.conf so it would be recognized
> as
> > a service:
> > <MLET CODE = "com.experient.toolbox.chuchu.TestService"
> > ARCHIVE="experient.jar,jboss.jar" CODEBASE="../lib/ext/"></MLET>
> >
> > Where experient.jar contains all of my company-proprietary class files,
> > including the TestService and TestServiceMBean classes
> > I just described.
> >
> > Finally, I tried running jBoss with the run.sh command. It starts up
> fine,
> > and even "initializes" my TestService (calls the
> > constructor), but for the life of me, I cannot get it to call my
> > "startService" method. I've also tried adding this
> > to jboss.dependencies in the form of:
> > <service name="TestService"></service>
> > but this has not helped.
> >
> > I'm running this on Sun 1.2.2/Redhat Linux/jBoss beta 3 (downloaded this
> > morning). I'm pretty sure my classpath is set up correctly, since jBoss
> > is successfully instantiating my TestService object.
> >
> > I've delved into org.jboss.dependency.DependencyManager a bit, and my
> > TestService appears to not be starting as a result
> > of this block of code in DependencyManager.startMBean(ObjectName name):
> > try {
> > server.invoke(name, "start", new Object[0], new String[0]);
> > loaded = true;
> > } catch(ReflectionException e) {
> > if(e.getTargetException() instanceof NoSuchMethodException)
{
> > loaded = true; // This bean doesn't have a start!
> > } else {
> > System.out.println("Error starting service
> > '"+name.getCanonicalName()+"': "+e.getTargetException());
> > }
> > } catch(Throwable t) {
> > System.out.println("Error starting service
> > '"+name.getCanonicalName()+"': "+t);
> > }
> >
> > When jBoss tries to start TestService, the MBeanServer instance 'server'
> > throws a ReflectionException with a NoSuchMethodException inside. I've
> > tried looking at com.sun implementation of the MBeanServer and it's
> 'invoke'
> > method, but that's pretty nasty. Does it try to invoke a method named
> > "start"?
> >
> > Can anyone help a newbie out? Any help would be greatly appreciated.
> >
> > Thank you,
> > Adam Rabung
> > [EMAIL PROTECTED]
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > Problems?: [EMAIL PROTECTED]
> >
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]