Hi all,
I am trying to use a ThreadPool in my application. In the plan.xml file, I
have:
<gbean name="DefaultThreadPool"
class="org.apache.geronimo.pool.ThreadPool">
<attribute name="keepAliveTime">5000</attribute>
<attribute name="poolSize">10</attribute>
<attribute name="poolName">DefaultThreadPool</attribute>
</gbean>
<gbean name="MyGBean" class="task.MyGBean">
<!--
<reference name="APrinter">
<name>gbean1</name>
</reference>
<reference name="BPrinter" >
<name>gbean2</name>
</reference> -->
<reference name="Executor">
<name>DefaultThreadPool</name>
</reference>
</gbean>
And on the file MyGBean.java I have a reference to it:
infoFactory.addReference("Executor",org.apache.geronimo.pool.ThreadPool.class,NameFactory.GERONIMO_SERVICE);
ant it is set via setter injection as follows:
public void setExecutor( org.apache.geronimo.pool.ThreadPool Executor ){
this.Executor = Executor;
}
Yet, it is not working, I get a "java.lang.IllegalArgumentException: cannot
find matching method/constructor" so MyGBean fails to start because
(according to the log) :
12:38:40,328 ERROR [GBeanInstanceState] Error while starting; GBean is now
in the FAILED state:
objectName="geronimo.server:J2EEApplication=null,J2EEModule=ibmtask/IBMTask,J2EEServer=geronimo,j2eeType=GBean,name=MyGBean"
java.lang.IllegalArgumentException: Cannot find matching method/constructor
at
org.apache.geronimo.pool.ThreadPool$$EnhancerByCGLIB$$a5ca88c4$$FastClassByCGLIB$$4a3acb71.newInstance(<generated>)
at net.sf.cglib.reflect.FastClass.newInstance(FastClass.java:91)
at
org.apache.geronimo.kernel.basic.BasicProxyManager$ManagedProxyFactory.createProxy(BasicProxyManager.java:211)
at
org.apache.geronimo.kernel.basic.BasicProxyManager.createProxy(BasicProxyManager.java:108)
at
org.apache.geronimo.gbean.runtime.GBeanSingleReference.start(GBeanSingleReference.java:79)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:863)
at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:325)
at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:110)
at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:132)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:537)
at
org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:208)
at
org.apache.geronimo.kernel.config.Configuration.startRecursiveGBeans(Configuration.java:315)
at
org.apache.geronimo.kernel.config.Configuration$$FastClassByCGLIB$$7f4b4a9b.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:118)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:835)
at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:178)
at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:173)
at
org.apache.geronimo.kernel.config.ConfigurationManagerImpl.start(ConfigurationManagerImpl.java:142)
at
org.apache.geronimo.kernel.config.ConfigurationManagerImpl$$FastClassByCGLIB$$fbed85d2.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:118)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:835)
at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:178)
at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:125)
at
org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.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:118)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:835)
at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:178)
at
org.apache.geronimo.kernel.jmx.MBeanServerDelegate.invoke(MBeanServerDelegate.java:117)
at
mx4j.remote.rmi.RMIConnectionInvoker.invoke(RMIConnectionInvoker.java:219)
at sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at mx4j.remote.rmi.RMIConnectionProxy.invoke(RMIConnectionProxy.java:34)
at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.chain(RMIConnectionSubjectInvoker.java:99)
at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.access$000(RMIConnectionSubjectInvoker.java:31)
at
mx4j.remote.rmi.RMIConnectionSubjectInvoker$1.run(RMIConnectionSubjectInvoker.java:90)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Unknown Source)
at mx4j.remote.MX4JRemoteUtils.subjectInvoke(MX4JRemoteUtils.java:163)
at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.subjectInvoke(RMIConnectionSubjectInvoker.java:86)
at
mx4j.remote.rmi.RMIConnectionSubjectInvoker.invoke(RMIConnectionSubjectInvoker.java:80)
at $Proxy0.invoke(Unknown Source)
at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:221)
at sun.reflect.GeneratedMethodAccessor504.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
an if I use the following as a reference:
infoFactory.addReference("Executor",org.apache.geronimo.pool.ThreadPool.class);
I just get on the log:
12:47:30,968 ERROR [GBeanInstance] GBeanInstance should already be stopped
before die() is called:
objectName=geronimo.server:J2EEApplication=null,J2EEModule=ibmtask/IBMTask,J2EEServer=geronimo,j2eeType=GBean,name=MyGBean
state=stopping
12:49:03,109 DEBUG [GBeanSingleReference] Waiting to start
geronimo.server:J2EEApplication=null,J2EEModule=ibmtask/IBMTask,J2EEServer=geronimo,j2eeType=GBean,name=MyGBean
because no targets are running for reference Executor matching the patterns
geronimo.server:J2EEApplication=null,J2EEModule=ibmtask/IBMTask,J2EEServer=geronimo,j2eeType=null,name=DefaultThreadPool
Any help on how to deal with a ThreadPool will be helpful.
Thanks,
Nelson.
Nelson Perez.
"Things should be made as simple as possible, but no simpler." -- Albert
Einstein