Can I just add some more information:
I have managed to reduce the number of max active sessions to zero using twiddle. Here is the syntax:
C:\jboss-4.0.3\bin>twiddle set "jboss.web:host=localhost,path=/tsp,type=Manager" maxActiveSessions=0
(in this example my webapp is call tsp).
Although this prevents additional HTTP sessions being created it does not stop any existing session.
I have also tried invoking the stop with twiddle:
C:\jboss-4.0.3\bin>twiddle invoke "jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/tsp" stop
This works fine and stops the webapp called tsp.
I then iinvoke the init method which does not error.
But when I invoke the start method using:
C:\jboss-4.0.3\bin>twiddle invoke "jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/tsp" start
I get the following null pointer exception:
ERROR BaseModelMBean invoke - Exception invoking method start
I would hope that someone has solved this problem and has an example I could use or could point me in the right direction. I am sure it is just my lack of mbean knowledge and the Jboss Microkernel.
Some more information on the environment:
Sun jdk1.5.0_04 and Win XP pro sp2
The NPE on twiddle start was being thrown by org.jboss.web.tomcat.security.RunAsListener.
If I comment out this entry in context.xml in jbossweb-tomcat55.sar then the twiddle start works! i.e I can successfully stop and start individual web apps.
The problem is I am not sure if I need org.jboss.web.tomcat.security.RunAsListener
Any comments would be greatly appreciated.
The RunAsListener is needed if you are using the web.xml run-as security setting from lifecycle callback methods. If your not using run-as from these contexts you don't need the RunAsListener.
Thanks Scott for clarifying RunASListener. As I don't use any run-as functionality it's removal from the context.xml is not a problem and allows the twiddle start/stop to work.
Having now got a working solution for a standalone 'default' configuration I now need to do the same for a clustered production environment. There are 2 Win2003 servers running 2 instances of Jboss / Tomcat (with replicated HTTP sessions) load balanced by Apache. I am hoping there might be some "cluster" service to achieve stop /start application. If not then the fall back is to run twiddle for each instance of Tomcat.
I'll post back my findings.
Unfortunately twiddle start does not work when using the standard 'all' configuration. The twiddle stop does successfully stop the web application and browser clients are served the '503 Application not available' and the following is logged by our context listener:
2005-10-28 11:43:20,375 INFO [uk.co.woolworths.tsp.utility.ContextListener] Context destroyed
When twiddle start command is used (to start web app 'tsp'):
twiddle invoke "jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/tsp" start
The following InstanceNotFoundException occurs :
2005-10-28 11:43:31,000 INFO [org.jboss.web.tomcat.tc5.session.JBossCacheManager] Starting JBossManager
2005-10-28 11:43:31,000 INFO [org.jboss.web.tomcat.tc5.session.JBossCacheManager] We are using mod_jk(2) for load-balancing. Will add JvmRouteValve.
2005-10-28 11:43:31,000 ERROR [org.jboss.web.tomcat.tc5.session.JBossCacheManager] Exception starting JBossCacheManager
javax.management.InstanceNotFoundException: jboss.web:j2eeType=WebModule,name=//localhost/tsp,J2EEApplication=none,J2EEServer=none is not registered.
This also happens if using the jmx-console interface.
It would appear that the stop method when used in a clustered environment is removing the mbean instance and therefore it (and the start method) is not subsequently available to JbossCacheManger.
My production environment is using Jboss 4.0.3RC2 and jdk 1.5.0_4 on Windows 2003 Server Standard edition sp1.
Should I be using a different mbean because of the clustering?
Again any help would be appreciated.
I'll have to look into this. Seems odd that the JBossCacheManager can't find an MBean that twiddle can.
Actually this should belong to Clustering forum. But anyway, can you hot deploy your web app under all?
If you can, please post a complete stack trace then. Maybe, we have some problem with the lifecycle instantiation.
Yes I can hot deploy the web application successfully. It is deployed as part of an exploded ear (I'm not sure if that is significant).
Can you clarify what level of logging / trace output you require. e.g.
1) set log4j limit categories to DEBUG for org.jboss.xxxx.*
2) Start jboss
3) copy TSP.ear to deploy
4) Stop the TSPweb.war application with twiddle
5) Start the TSPweb.war application with twiddle to reproduce error
4) e-mail boot.log & server.log
Please turn on org.jboss.web to DEBUG should be sufficient.
I have just e-mailed boot.log and server.log to you.
It looks like you have found the error and therefore I assume you can reproduce it in testing. If you need anymore information or want me to help test the solution then I will be pleased to do so.
I am watching this post and the JIRA issue and therefore will pick up any of your postings. As this is the first time I have made a forum posting resulting in a JIRA issue I am not sure what is the correct procedure.