Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 45987 invoked from network); 27 Aug 2007 07:57:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Aug 2007 07:57:04 -0000 Received: (qmail 83260 invoked by uid 500); 27 Aug 2007 07:56:53 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 83226 invoked by uid 500); 27 Aug 2007 07:56:53 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 83215 invoked by uid 99); 27 Aug 2007 07:56:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 00:56:53 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.227.126.179] (HELO moutng.kundenserver.de) (212.227.126.179) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 07:56:48 +0000 Received: from mail.seekline.net [195.238.144.112] (helo=[192.168.130.50]) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1IPZS80YQH-0006uL; Mon, 27 Aug 2007 09:56:21 +0200 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <505E0FDE-70F4-4836-8D4E-7DC23FBE08B6@yahoo.com> References: <454307FA-F176-4758-8A93-60BC000BC8B8@sf-net.com> <505E0FDE-70F4-4836-8D4E-7DC23FBE08B6@yahoo.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <530E2F90-D698-46CC-9276-EAD341AB0531@sf-net.com> Content-Transfer-Encoding: 7bit From: Stefan Schulze Frielinghaus Subject: Re: deploy and undeploy a gbean Date: Mon, 27 Aug 2007 09:56:01 +0200 To: user@geronimo.apache.org X-Mailer: Apple Mail (2.752.2) X-Provags-ID: V01U2FsdGVkX1+fBhNJIOLCloOa5YF+a4U/Yh3VQek13f3kk4v CcXmDk3i7nGXs5EQRbvC3ukhjNG3kJCzoalncXULVJQMq5q82H mjY0BLySogBWYr80GYz7A== X-Virus-Checked: Checked by ClamAV on apache.org I would like to have the functionality of the command line tool "java -jar deployer.jar --user system --password manager {deploy,undeploy} .jar" in a GBean. So I could programmatic load and unload other GBeans via a GBean. Is something like that possible? On 24.08.2007, at 22:38, David Jencks wrote: > Could you describe how you want to use this a bit? There's already > the ServiceConfigBuilder which converts xml gbean plans to > Configurations and the whole Configuration framework which do > this. Also you can register custom NamespaceDrivenBuilders to > process documents in other xml schemas into gbean configurations. > So I wonder if what you want to do is already possible... > > Without knowing what you are aiming for its very hard to give you > any advice. > > thanks > david jencks > On Aug 24, 2007, at 11:13 AM, Stefan Schulze Frielinghaus wrote: > >> Hello, >> >> I'm trying to write a GBean which dynamically deploys and undeploys >> other GBeans. My first thought about this task was to get a list of >> all running modules from which I could decide which to undeploy. >> >> String uri = "deployer:geronimo:inVM"; >> String username = "system"; >> String password = "manager"; >> >> dManager = dFactoryMgr.getDeploymentManager(uri, username, password); >> >> System.out.println("Targets:"); >> Target[] targets = dManager.getTargets(); >> for(Target t : targets) { >> System.out.println(t); >> } >> >> System.out.println("Modules:"); >> TargetModuleID[] moduleIDs = dManager.getRunningModules(null, >> targets); >> >> for(TargetModuleID m : moduleIDs) { >> System.out.println(m); >> } >> >> With the code above I tried to accomplish my goal. But if I run this >> one I get the following exception: >> >> 14:38:55,100 ERROR [BaseDeploymentFactory] >> org.apache.geronimo.web.deployment.WARConfigurer >> java.lang.ClassCastException: >> org.apache.geronimo.web.deployment.WARConfigurer >> at >> org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager.load >> Mod >> uleConfigurers(LocalDeploymentManager.java:51) >> at >> org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager.> t>( >> LocalDeploymentManager.java:41) >> at >> org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactory >> .ge >> tDeploymentManager(BaseDeploymentFactory.java:133) >> at >> javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.get >> Dep >> loymentManager(DeploymentFactoryManager.java:109) >> at >> de.furtwangen.hs.informatik.geronimo.ac.MigrationService.test >> (MigrationService.java:37) >> at >> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean.testMi >> gra >> tion(AutonomicGeronimoGBean.java:202) >> at >> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean$ >> $FastClassByCGLIB$$78735f6f.invoke() >> at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java: >> 53) >> at >> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke >> (FastMethodInvoker.java:38) >> at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke >> (GBeanOperation.java:127) >> at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke >> (GBeanInstance.java:863) >> at org.apache.geronimo.kernel.basic.BasicKernel.invoke >> (BasicKernel.java:239) >> at org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke >> (MBeanGBeanBridge.java:168) >> at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke >> (DynamicMetaDataImpl.java:213) >> at com.sun.jmx.mbeanserver.MetaDataImpl.invoke >> (MetaDataImpl.java:220) >> at >> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke >> (DefaultMBeanServerInterceptor.java:815) >> at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke >> (JmxMBeanServer.java:784) >> at javax.management.remote.rmi.RMIConnectionImpl.doOperation >> (RMIConnectionImpl.java:1408) >> at javax.management.remote.rmi.RMIConnectionImpl.access$100 >> (RMIConnectionImpl.java:81) >> at javax.management.remote.rmi.RMIConnectionImpl >> $PrivilegedOperation.run(RMIConnectionImpl.java:1245) >> at >> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation >> (RMIConnectionImpl.java:1341) >> at javax.management.remote.rmi.RMIConnectionImpl.invoke >> (RMIConnectionImpl.java:782) >> at sun.reflect.GeneratedMethodAccessor187.invoke(Unknown >> Source) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke >> (DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at sun.rmi.server.UnicastServerRef.dispatch >> (UnicastServerRef.java:294) >> at sun.rmi.transport.Transport$1.run(Transport.java:153) >> at java.security.AccessController.doPrivileged(Native >> Method) >> at sun.rmi.transport.Transport.serviceCall(Transport.java: >> 149) >> at sun.rmi.transport.tcp.TCPTransport.handleMessages >> (TCPTransport.java:466) >> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run >> (TCPTransport.java:707) >> at java.lang.Thread.run(Thread.java:613) >> >> Is there another way to deploy/undeploy GBeans via another GBean? >> >> I even tried it with another URI (String uri = >> "deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector";) but >> with that I still got a worse result. >> >> javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationExcep >> tio >> n: Failed to retrieve RMIServer stub: >> javax.naming.NoInitialContextException: Cannot instantiate class: >> org.apache.xbean.naming.global.GlobalContextManager [Root exception >> is java.lang.ClassNotFoundException: >> org.apache.xbean.naming.global.GlobalContextManager] >> at >> org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactory >> .ne >> wRemoteDeploymentManager(BaseDeploymentFactory.java:167) >> at >> org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactory >> .ge >> tDeploymentManager(BaseDeploymentFactory.java:131) >> at >> javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.get >> Dep >> loymentManager(DeploymentFactoryManager.java:109) >> at >> de.furtwangen.hs.informatik.geronimo.ac.MigrationService.test >> (MigrationService.java:37) >> at >> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean.testMi >> gra >> tion(AutonomicGeronimoGBean.java:202) >> at >> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean$ >> $FastClassByCGLIB$$78735f6f.invoke() >> at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java: >> 53) >> at >> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke >> (FastMethodInvoker.java:38) >> at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke >> (GBeanOperation.java:127) >> at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke >> (GBeanInstance.java:863) >> at org.apache.geronimo.kernel.basic.BasicKernel.invoke >> (BasicKernel.java:239) >> at org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke >> (MBeanGBeanBridge.java:168) >> at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke >> (DynamicMetaDataImpl.java:213) >> at com.sun.jmx.mbeanserver.MetaDataImpl.invoke >> (MetaDataImpl.java:220) >> at >> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke >> (DefaultMBeanServerInterceptor.java:815) >> at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke >> (JmxMBeanServer.java:784) >> at javax.management.remote.rmi.RMIConnectionImpl.doOperation >> (RMIConnectionImpl.java:1408) >> at javax.management.remote.rmi.RMIConnectionImpl.access$100 >> (RMIConnectionImpl.java:81) >> at javax.management.remote.rmi.RMIConnectionImpl >> $PrivilegedOperation.run(RMIConnectionImpl.java:1245) >> at >> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation >> (RMIConnectionImpl.java:1341) >> at javax.management.remote.rmi.RMIConnectionImpl.invoke >> (RMIConnectionImpl.java:782) >> at sun.reflect.GeneratedMethodAccessor187.invoke(Unknown >> Source) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke >> (DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at sun.rmi.server.UnicastServerRef.dispatch >> (UnicastServerRef.java:294) >> at sun.rmi.transport.Transport$1.run(Transport.java:153) >> at java.security.AccessController.doPrivileged(Native >> Method) >> at sun.rmi.transport.Transport.serviceCall(Transport.java: >> 149) >> at sun.rmi.transport.tcp.TCPTransport.handleMessages >> (TCPTransport.java:466) >> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run >> (TCPTransport.java:707) >> at java.lang.Thread.run(Thread.java:613) >> Caused by: java.io.IOException: Failed to retrieve RMIServer stub: >> javax.naming.NoInitialContextException: Cannot instantiate class: >> org.apache.xbean.naming.global.GlobalContextManager [Root exception >> is java.lang.ClassNotFoundException: >> org.apache.xbean.naming.global.GlobalContextManager] >> at javax.management.remote.rmi.RMIConnector.connect >> (RMIConnector.java:317) >> at javax.management.remote.JMXConnectorFactory.connect >> (JMXConnectorFactory.java:248) >> at >> org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactory >> .ne >> wRemoteDeploymentManager(BaseDeploymentFactory.java:159) >> ... 30 more >> Caused by: javax.naming.NoInitialContextException: Cannot instantiate >> class: org.apache.xbean.naming.global.GlobalContextManager [Root >> exception is java.lang.ClassNotFoundException: >> org.apache.xbean.naming.global.GlobalContextManager] >> at javax.naming.spi.NamingManager.getInitialContext >> (NamingManager.java:657) >> at javax.naming.InitialContext.getDefaultInitCtx >> (InitialContext.java:247) >> at javax.naming.InitialContext.init(InitialContext.java:223) >> at javax.naming.InitialContext.(InitialContext.java: >> 197) >> at >> javax.management.remote.rmi.RMIConnector.findRMIServerJNDI >> (RMIConnector.java:1815) >> at javax.management.remote.rmi.RMIConnector.findRMIServer >> (RMIConnector.java:1787) >> at javax.management.remote.rmi.RMIConnector.connect >> (RMIConnector.java:259) >> ... 32 more >> Caused by: java.lang.ClassNotFoundException: >> org.apache.xbean.naming.global.GlobalContextManager >> at java.net.URLClassLoader$1.run(URLClassLoader.java:200) >> at java.security.AccessController.doPrivileged(Native >> Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java: >> 188) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:306) >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java: >> 268) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:251) >> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java: >> 319) >> at java.lang.Class.forName0(Native Method) >> at java.lang.Class.forName(Class.java:242) >> at com.sun.naming.internal.VersionHelper12.loadClass >> (VersionHelper12.java:42) >> at javax.naming.spi.NamingManager.getInitialContext >> (NamingManager.java:654) >> ... 38 more >> >> Since I've the package org.apache.xbean.naming in my classpath I >> don't no why geronimo can't instantiate a class of them. >> >> So has anyone an idea how to solve a deply/undeploy task? >> >> Best regards, >> Stefan >> >> PS: I miss opened this thread at dev@geronimo.apache.org and >> "closed" it. Sorry for the inconvenience. >