Hi all,

Could anyone tell me the order of the initializations of the webapps contexts, the 
webapps, the servlets (those run at startup).

I succeeded in creating my DataSources in my webapp context by redeploying my classes 
with tomcat running, I just copied the newly compiled 
classes to the WEB-INF/classes directory, and tada! The datasources appeared in the 
admin webapp. 
It works but the problem is not solved as I did it by hand.

I'll explore the way of making it recompiled automatically by another webapp which 
name alphabetically follows my webapp's name and is therefore deployed after.
But I would prefer a less dirty way.


Thanks for your help


Jerome

-----Message d'origine-----
De : Jérôme BATON 
Envoyé : lundi 11 octobre 2004 19:55
À : [EMAIL PROTECTED]
Objet : 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to