You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jérôme BATON <je...@igc-erp.com> on 2004/10/11 19:55:16 UTC

Adding DataSources to a specific webapp context using MBeanServer

Hi all,

My goal is to dynamically add DataSources to the context of a specific webapp.


To do this, I wrote a struts plugin which reads a properties file. 


I've looked at the admin webapp for the JMX/MBeanServer code, I used the code in class SaveDataSourceAction.
And it works fine _only if_ I choose "Global" (ResourceUtils.GLOBAL_TYPE) as parameter and not when I use "Context" (ResourceUtils.CONTEXT_TYPE) in the following code fragment.

oname = new ObjectName( domain + ResourceUtils.RESOURCE_TYPE + ResourceUtils.GLOBAL_TYPE + ",class=" + params[1] + 
                                            ",name=" + params[0]);


I used the same parameters as those seen from the running admin webapp but I get a javax.management.InstanceNotFoundException.


javax.management.InstanceNotFoundException: MBeanServer cannot find MBean 
with ObjectName Catalina:type=NamingResources,resourcetype=Context,path=/struts-arch,host=localhost
        at mx4j.server.MBeanServerImpl.findMBeanMetaData(MBeanServerImpl.java:528)
        at mx4j.server.MBeanServerImpl.invoke(MBeanServerImpl.java:1351)
        at igc.arch.action.plugin.DBPropertiesToContextPlugin.ajouteDataSource(DBPropertiesToContextPlugin.java:236)
        at igc.arch.action.plugin.DBPropertiesToContextPlugin.init(DBPropertiesToContextPlugin.java:108)
        at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
........
........



I run Tomcat 5.0. on an xp pro box


Thanks a lot 


Jerome 

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