geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: deploy and undeploy a gbean
Date Tue, 28 Aug 2007 00:43:56 GMT

On Aug 27, 2007, at 12:56 AM, Stefan Schulze Frielinghaus wrote:

> I would like to have the functionality of the command line tool  
> "java -jar deployer.jar --user system --password manager  
> {deploy,undeploy} <tool>.jar" in a GBean. So I could programmatic  
> load and unload other GBeans via a GBean.
>
> Is something like that possible?

Definitely.  There's a portlet in the admin console that does that.   
There's also a portlet that lists all the "gbean" (non-javaee)  
modules that are running.

I assume you are aware that the command you mention deploys a module  
or configuration that contains a plan describing any number of gbeans  
and creates a classloader also described by the plan.  Your  
description of what you want sounds a little like you want to deploy  
single gbeans which is not exactly how I would describe a module.

thanks
david jencks

>
> 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.loa 
>>> dMod
>>> uleConfigurers(LocalDeploymentManager.java:51)
>>>          at
>>> org.apache.geronimo.deployment.plugin.jmx.LocalDeploymentManager.<in 
>>> it>(
>>> LocalDeploymentManager.java:41)
>>>          at
>>> org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactor 
>>> y.ge
>>> tDeploymentManager(BaseDeploymentFactory.java:133)
>>>          at
>>> javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.ge 
>>> tDep
>>> loymentManager(DeploymentFactoryManager.java:109)
>>>          at
>>> de.furtwangen.hs.informatik.geronimo.ac.MigrationService.test
>>> (MigrationService.java:37)
>>>          at
>>> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean.testM 
>>> igra
>>> tion(AutonomicGeronimoGBean.java:202)
>>>          at
>>> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean$
>>> $FastClassByCGLIB$$78735f6f.invoke(<generated>)
>>>          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.DeploymentManagerCreationExce 
>>> ptio
>>> 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.BaseDeploymentFactor 
>>> y.ne
>>> wRemoteDeploymentManager(BaseDeploymentFactory.java:167)
>>>          at
>>> org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactor 
>>> y.ge
>>> tDeploymentManager(BaseDeploymentFactory.java:131)
>>>          at
>>> javax.enterprise.deploy.shared.factories.DeploymentFactoryManager.ge 
>>> tDep
>>> loymentManager(DeploymentFactoryManager.java:109)
>>>          at
>>> de.furtwangen.hs.informatik.geronimo.ac.MigrationService.test
>>> (MigrationService.java:37)
>>>          at
>>> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean.testM 
>>> igra
>>> tion(AutonomicGeronimoGBean.java:202)
>>>          at
>>> de.furtwangen.hs.informatik.geronimo.ac.AutonomicGeronimoGBean$
>>> $FastClassByCGLIB$$78735f6f.invoke(<generated>)
>>>          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.BaseDeploymentFactor 
>>> y.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.<init> 
>>> (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.
>>
>


Mime
View raw message