You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Russell E Glaue <rg...@cait.org> on 2006/07/21 17:31:23 UTC

InvalidConfigurationException: Could not find a valid constructor for GBean

I seem to be having an issue with my GBean for Geronimo 1.1

My GBean deployed in Geronimo 1.0.
I upgraded to Geronimo 1.1
I followed all the steps outline in documentation I found to upgrade my GBean 
configuration.
I read through all the posts on dev and user of these geronimo mail lists.
I even searched the Geronimo commits to look for changes in syntax and coding.

But I cannot get past this error which I get when deploying my GBean:

Caused by: org.apache.geronimo.gbean.InvalidConfigurationException: Could not 
find a valid constructor for GBean: org.cait.wnode.hostinfoGBean

Error message: deploy.sh deploy target/wnode-1.0.jar wnode-plan.xml
-
Exception in thread "Thread-3" java.lang.ExceptionInInitializerError
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
... snip ...
         at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.geronimo.gbean.InvalidConfigurationException: Could not 
find a valid constructor for GBean: org.cait.wnode.hostinfoGBean
         at 
org.apache.geronimo.gbean.GBeanInfoBuilder.getConstructorTypes(GBeanInfoBuilder.java:478)
         at 
org.apache.geronimo.gbean.GBeanInfoBuilder.getBeanInfo(GBeanInfoBuilder.java:416)
         at org.cait.wnode.hostinfoGBean.<clinit>(hostinfoGBean.java:27)
         ... 55 more
-

I have one simple GBean I want to deploy.
The GBean simply reports the host name (String) of a node. It will eventually 
read from a file, but now just spits out an example string.

(Eventually, in our testing process, I want our web apps to write debug messages 
to the web page which will include the hostname of the server in our geronimo 
cluster the error was experienced on. This will be tied into a monitoring system 
in our auto-build/test process, etc..)

Below is the code - One single Java file, one deployer file.
What do I have wrong... this similar configuration worked in Geronimo 1.0.
-RG


java file: org/cait/wnode/hostinfoGBean.java
-
package org.cait.wnode;

import org.apache.commons.logging.*;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;

public class hostinfoGBean implements GBeanLifecycle {

         public static final GBeanInfo GBEAN_INFO;

         private static final Log glog = LogFactory.getLog(hostinfoGBean.class);

         public static GBeanInfo getGBeanInfo(){
                 return GBEAN_INFO;
         }
         static{
                 GBeanInfoBuilder infoBuilder = new 
GBeanInfoBuilder("hostinfoGBean",hostinfoGBean.class);
                 infoBuilder.addInterface(hostinfoGBean.class);
                 infoBuilder.addAttribute("HostName", String.class, false);
                 infoBuilder.addAttribute("HostPort", int.class, true);
                 infoBuilder.setConstructor(new String[]{"HostName","HostPort"});
                 GBEAN_INFO = infoBuilder.getBeanInfo();
         }

         public void doFail() {
                 glog.info("Service failed");
         }

         public void doStart() throws Exception {
                 glog.info("Service started");
         }

         public void doStop() throws Exception {
                 glog.info("Service stopped");
         }

         public String getName() {
                 return "node1.domain-noc1.test.com";
         }
         public String getPort() {
                 return "80";
         }
}
-


deployment plan: wnode-plan.xml
-
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
   <environment>
     <moduleId>
       <groupId>wnode</groupId>
       <artifactId>wnode</artifactId>
       <version>1.0</version>
       <type>jar</type>
     </moduleId>
     <dependencies>
       <dependency>
         <groupId>tomcat</groupId>
         <artifactId>catalina-cluster</artifactId>
         <version>5.5.15</version>
         <type>jar</type>
       </dependency>
       <dependency>
         <groupId>tomcat</groupId>
         <artifactId>catalina</artifactId>
         <version>5.5.15</version>
         <type>jar</type>
       </dependency>
     </dependencies>
   </environment>
   <gbean name='hostinfoGBean' class='org.cait.wnode.hostinfoGBean'></gbean>
</module>
-


Re: InvalidConfigurationException: Could not find a valid constructor for GBean

Posted by Jason Dillon <ja...@planet57.com>.
You don't have a constructor.  You need something like:

public hostinfoGBean(String[] hostport) {}

Or... drop the infoBuilder.setConstructor() bits.. probably better if  
you don't plan on passing the values in through the constructor.

--jason


On Jul 21, 2006, at 8:31 AM, Russell E Glaue wrote:

> I seem to be having an issue with my GBean for Geronimo 1.1
>
> My GBean deployed in Geronimo 1.0.
> I upgraded to Geronimo 1.1
> I followed all the steps outline in documentation I found to  
> upgrade my GBean configuration.
> I read through all the posts on dev and user of these geronimo mail  
> lists.
> I even searched the Geronimo commits to look for changes in syntax  
> and coding.
>
> But I cannot get past this error which I get when deploying my GBean:
>
> Caused by: org.apache.geronimo.gbean.InvalidConfigurationException:  
> Could not find a valid constructor for GBean:  
> org.cait.wnode.hostinfoGBean
>
> Error message: deploy.sh deploy target/wnode-1.0.jar wnode-plan.xml
> -
> Exception in thread "Thread-3" java.lang.ExceptionInInitializerError
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke 
> (NativeMethodAccessorImpl.java:39)
> ... snip ...
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.geronimo.gbean.InvalidConfigurationException:  
> Could not find a valid constructor for GBean:  
> org.cait.wnode.hostinfoGBean
>         at  
> org.apache.geronimo.gbean.GBeanInfoBuilder.getConstructorTypes 
> (GBeanInfoBuilder.java:478)
>         at org.apache.geronimo.gbean.GBeanInfoBuilder.getBeanInfo 
> (GBeanInfoBuilder.java:416)
>         at org.cait.wnode.hostinfoGBean.<clinit>(hostinfoGBean.java: 
> 27)
>         ... 55 more
> -
>
> I have one simple GBean I want to deploy.
> The GBean simply reports the host name (String) of a node. It will  
> eventually read from a file, but now just spits out an example string.
>
> (Eventually, in our testing process, I want our web apps to write  
> debug messages to the web page which will include the hostname of  
> the server in our geronimo cluster the error was experienced on.  
> This will be tied into a monitoring system in our auto-build/test  
> process, etc..)
>
> Below is the code - One single Java file, one deployer file.
> What do I have wrong... this similar configuration worked in  
> Geronimo 1.0.
> -RG
>
>
> java file: org/cait/wnode/hostinfoGBean.java
> -
> package org.cait.wnode;
>
> import org.apache.commons.logging.*;
> import org.apache.geronimo.gbean.GBeanInfo;
> import org.apache.geronimo.gbean.GBeanInfoBuilder;
> import org.apache.geronimo.gbean.GBeanLifecycle;
>
> public class hostinfoGBean implements GBeanLifecycle {
>
>         public static final GBeanInfo GBEAN_INFO;
>
>         private static final Log glog = LogFactory.getLog 
> (hostinfoGBean.class);
>
>         public static GBeanInfo getGBeanInfo(){
>                 return GBEAN_INFO;
>         }
>         static{
>                 GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder 
> ("hostinfoGBean",hostinfoGBean.class);
>                 infoBuilder.addInterface(hostinfoGBean.class);
>                 infoBuilder.addAttribute("HostName", String.class,  
> false);
>                 infoBuilder.addAttribute("HostPort", int.class, true);
>                 infoBuilder.setConstructor(new String[] 
> {"HostName","HostPort"});
>                 GBEAN_INFO = infoBuilder.getBeanInfo();
>         }
>
>         public void doFail() {
>                 glog.info("Service failed");
>         }
>
>         public void doStart() throws Exception {
>                 glog.info("Service started");
>         }
>
>         public void doStop() throws Exception {
>                 glog.info("Service stopped");
>         }
>
>         public String getName() {
>                 return "node1.domain-noc1.test.com";
>         }
>         public String getPort() {
>                 return "80";
>         }
> }
> -
>
>
> deployment plan: wnode-plan.xml
> -
> <?xml version="1.0" encoding="UTF-8"?>
> <module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
>   <environment>
>     <moduleId>
>       <groupId>wnode</groupId>
>       <artifactId>wnode</artifactId>
>       <version>1.0</version>
>       <type>jar</type>
>     </moduleId>
>     <dependencies>
>       <dependency>
>         <groupId>tomcat</groupId>
>         <artifactId>catalina-cluster</artifactId>
>         <version>5.5.15</version>
>         <type>jar</type>
>       </dependency>
>       <dependency>
>         <groupId>tomcat</groupId>
>         <artifactId>catalina</artifactId>
>         <version>5.5.15</version>
>         <type>jar</type>
>       </dependency>
>     </dependencies>
>   </environment>
>   <gbean name='hostinfoGBean'  
> class='org.cait.wnode.hostinfoGBean'></gbean>
> </module>
> -
>