tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: MalformedObjectNameException deploying a custom valve
Date Sat, 26 Apr 2003 07:25:13 GMT
I'm assuming that your Valve doesn't extend ValveBase.  It is a current
limitation in Tomcat 4.1.x that JMX-managed Valves are required to implement
org.apache.catalina.Contained (which is automatic, if you extend ValveBase).
It used to be worse:  You used to have to extend ValveBase.

Tomcat 5 has added support to allow components (e.g. Valves/Realms) to
auto-register their MBeans.  It is likely that this restriction will be
dropped in Tomcat 5.

"Dunlop, Aaron" <aaron.dunlop@transcore.com> wrote in message
news:BD191E9899D1F940B26E09C781A02F93028EE273@akiak.dat.com...
> I'm experimenting with a simple custom valve - really an adaptation of
> AccessLogValve which maintains timing information. I've packaged my valve
in
> a jar file along with the mbean-descriptor file included below, and placed
> that jar file in server/lib.
>
> I've changed server.xml to reference that mbean descriptor:
> ...
>   <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
>             debug="1"
>             descriptors="/com/tcsi/tomcat/mbean-descriptor.xml"/>
> ...
>         <Valve className="com.tcsi.tomcat.TimerAccessLogValve"
>                  directory="logs"  prefix="localhost_access_log."
> suffix=".txt"/>
> ...
>
> When starting Tomcat I get the following stacktrace:
>
> ServerLifecycleListener: createMBeans: Throwable
> javax.management.MalformedObjectNameException: Cannot create mbean for
> non-contained valve com.tcsi.tomcat.TimerAccessLogValve@156e5ed
> at
>
org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:1656)
> at
> org.apache.catalina.mbeans.MBeanUtils.createMBean(MBeanUtils.java:817)
> at
>
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecy
> cleListener.java:721)
> at
>
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecy
> cleListener.java:667)
> at
>
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecy
> cleListener.java:860)
> at
>
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecy
> cleListener.java:828)
> at
>
org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans(ServerLifecy
> cleListener.java:372)
> at
>
org.apache.catalina.mbeans.ServerLifecycleListener.lifecycleEvent(ServerLife
> cycleListener.java:226)
> at
>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
> t.java:166)
> at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2183)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
> at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
> at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
>
>
> This is probably quite obvious and very simple, but I'm stumped. Any
ideas?
> Thanks in advance,
> Aaron Dunlop
>
> ---------------------Bean Descriptor-------------------------------
> <?xml version="1.0"?>
> <!DOCTYPE mbeans-descriptors PUBLIC
>  "-//Apache Software Foundation//DTD Model MBeans Configuration File"
>  "http://jakarta.apache.org/commons/dtds/mbeans-descriptors.dtd">
>
> <mbeans-descriptors>
> <mbean         name="TimerAccessLogValve"
>             className="org.apache.catalina.mbeans.ClassNameMBean"
>           description="Valve that generates a web server access log"
>                domain="Catalina"
>                 group="Valve"
>                  type="com.tcsi.tomcat.TimerAccessLogValve">
>
>     <attribute   name="directory"
>           description="The directory in which log files are created"
>                  type="java.lang.String"/>
>
>     <attribute   name="prefix"
>           description="The prefix that is added to log file filenames"
>                  type="java.lang.String"/>
>
>     <attribute   name="suffix"
>           description="The suffix that is added to log file filenames"
>                  type="java.lang.String"/>
>   </mbean>
> </mbeans-descriptors>




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message