Hey resin masters,

I'm using Resin 4.0.10.

I have a bean in my war file:

@Named("MyBean")

@Startup

@Singleton

@TransactionAttribute(TransactionAttributeType.REQUIRED)

public class MyBean implements My, MyMXBean {

    @PostConstruct

    public void start() throws Exception {

        log.info("!!!!!!!!!!!! MyBean started !!!!!!!!!!!!!!!!!");

    }

}

In this case, the bean doesn't show up in the jconsole.

If I define a <resource> element in resin-web.xml (as suggested by the
documentation here: http://caucho.com/resin-4.0/examples/jmx-basic/index.xtp
):

<resource mbean-name="mybean:name=MyBean" type="com.MyBean" />

Then I get an error at start up about a duplicate name trying to be
registered because of the @Named annotation. This conflicts directly with
the documentation (
http://caucho.com/resin-4.0/admin/config-el-ref.xtp#resource) that suggests
to use <bean>... and <bean> suggests to use another set of configuration
that doesn't work.Here is my resin-web.xml that I tried:

<web-app xmlns="http://caucho.com/ns/resin";

        xmlns:ee="urn:java:ee"

        xmlns:resin="urn:java:com.caucho.resin"

        xmlns:cfg="urn:java:com.caucho.config"

        xmlns:jms="urn:java:com.caucho.jms"

        xmlns:ejb="urn:java:com.caucho.ejb.cfg"

        xmlns:foo="urn:com.foo.biz"

        >

        <foo:MyBean resin:JndiName="java:comp/env/MyBean"  />

</web-app>

Results in this exception:

[10-10-13 13:34:22.494] {main} WEB-INF/resin-web.xml:19: 'foo:MyBean' is an
unknown property of 'com.caucho.server.webapp.WebApp'.
                               19:         <foo:MyBean
resin:JndiName="java:comp/env/MyBean" />
                               20: </web-app>

If I remove the @Named annotation and keep the config in resin-web.xml, then
the bean shows up correctly in jconsole. However, I see MyBean started
printed out a bunch of times when resin starts. It is clearly trying to
start the bean too many times.

I guess ideally I'd have a way to just use @Named (or another appropriate
annotation) and have the bean show up in jconsole with the methods that are
defined in MyMXBean (or MyMBean). Having to put a bean into .xml config just
to get it to register with JMX seems like overkill.

Also, a small typo bug report:
http://caucho.com/resin-4.0/admin/config-candi.xtp#Administration, the href
link to <resin:JmxService> is to JmsService

thanks,

jon
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to