You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by "Hensley, Richard" <Ri...@McKesson.com> on 2004/07/14 02:20:14 UTC

Trying to use a service constructor

I have a hivemodule.sdl configuration that looks like:

module (id=com.mckesson.adept.net version="1.0.0")
{
  service-point (id=ClientController
interface=com.mckesson.adept.net.Controller)
  {
    invoke-factory (service-id=hivemind.BuilderFactory model=singleton)
    {
      construct (class=com.mckesson.adept.net.client.ClientController)
      {
        string { "${com.mckesson.adept.broker.host}" }
        int { "${com.mckesson.adept.broker.port}" }
      }
    }
  }

  service-point (id=Controller interface=com.mckesson.adept.net.Controller)
  {
    invoke-factory (service-id=hivemind.BuilderFactory model=singleton)
    {
      construct
(class=com.mckesson.adept.net.client.ConnectionPoolingController)
      {
        service { ClientController }
      }
    }
  }
}

When I use the following code:

        Controller controller = (Controller) reg.getService(
                "com.mckesson.adept.net.ClientController",
Controller.class);

Everything works great.

When I use the following code:

        Controller controller = (Controller) reg.getService(
                "com.mckesson.adept.net.Controller", Controller.class);

Hivemind gives me the following exception:

Jul 13, 2004 5:18:50 PM org.apache.hivemind.impl.DefaultErrorHandler error
SEVERE: Error at
file:/C:/dev900/java/adept/target/classes/META-INF/hivemodule.sdl, line 21,
column 43: Element construct/service/ClientController is not allowed here.
org.apache.hivemind.ApplicationRuntimeException: Unable to construct service
com.mckesson.adept.net.Controller: java.lang.NullPointerException
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewS
erviceImplementation(AbstractServiceModelImpl.java:156)
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServ
iceImplementation(AbstractServiceModelImpl.java:130)
	at
org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualService
Implementation(SingletonServiceModel.java:69)
	at $InnerProxy_fdbb040d47_3._service($InnerProxy_fdbb040d47_3.java)
	at
$InnerProxy_fdbb040d47_3.brokerConnection($InnerProxy_fdbb040d47_3.java)
	at
$SingletonProxy_fdbb040d29_2.brokerConnection($SingletonProxy_fdbb040d29_2.j
ava)
	at com.mckesson.adept.net.HiveMindDemo.main(HiveMindDemo.java:21)
org.apache.hivemind.ApplicationRuntimeException: Unable to construct service
com.mckesson.adept.net.Controller: java.lang.NullPointerException
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewS
erviceImplementation(AbstractServiceModelImpl.java:156)
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServ
iceImplementation(AbstractServiceModelImpl.java:130)
	at
org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualService
Implementation(SingletonServiceModel.java:69)
	at $InnerProxy_fdbb040d47_3._service($InnerProxy_fdbb040d47_3.java)
	at $InnerProxy_fdbb040d47_3.shutdown($InnerProxy_fdbb040d47_3.java)
	at
$SingletonProxy_fdbb040d29_2.shutdown($SingletonProxy_fdbb040d29_2.java)
	at com.mckesson.adept.net.HiveMindDemo.main(HiveMindDemo.java:33)
Exception in thread "main" 

I really don't know why, but I suspect it is because I'm not using the
service element correctly in the contruct element for the BuilderFactory.
Can anybody give me some insight as to what might be wrong?

Richard Hensley


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Trying to use a service constructor

Posted by Howard Lewis Ship <hl...@gmail.com>.
To SDL, that ClientController looks like a ClientController element. 
You need to put it in quotes for it to realize its literal character
data.  Character data is always enclosed in quotes in SDL.

On Tue, 13 Jul 2004 20:20:14 -0400, Hensley, Richard
<ri...@mckesson.com> wrote:
> I have a hivemodule.sdl configuration that looks like:
> 
> module (id=com.mckesson.adept.net version="1.0.0")
> {
>   service-point (id=ClientController
> interface=com.mckesson.adept.net.Controller)
>   {
>     invoke-factory (service-id=hivemind.BuilderFactory model=singleton)
>     {
>       construct (class=com.mckesson.adept.net.client.ClientController)
>       {
>         string { "${com.mckesson.adept.broker.host}" }
>         int { "${com.mckesson.adept.broker.port}" }
>       }
>     }
>   }
> 
>   service-point (id=Controller interface=com.mckesson.adept.net.Controller)
>   {
>     invoke-factory (service-id=hivemind.BuilderFactory model=singleton)
>     {
>       construct
> (class=com.mckesson.adept.net.client.ConnectionPoolingController)
>       {
>         service { ClientController }
>       }
>     }
>   }
> }
> 
> When I use the following code:
> 
>         Controller controller = (Controller) reg.getService(
>                 "com.mckesson.adept.net.ClientController",
> Controller.class);
> 
> Everything works great.
> 
> When I use the following code:
> 
>         Controller controller = (Controller) reg.getService(
>                 "com.mckesson.adept.net.Controller", Controller.class);
> 
> Hivemind gives me the following exception:
> 
> Jul 13, 2004 5:18:50 PM org.apache.hivemind.impl.DefaultErrorHandler error
> SEVERE: Error at
> file:/C:/dev900/java/adept/target/classes/META-INF/hivemodule.sdl, line 21,
> column 43: Element construct/service/ClientController is not allowed here.
> org.apache.hivemind.ApplicationRuntimeException: Unable to construct service
> com.mckesson.adept.net.Controller: java.lang.NullPointerException
>         at
> org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewS
> erviceImplementation(AbstractServiceModelImpl.java:156)
>         at
> org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServ
> iceImplementation(AbstractServiceModelImpl.java:130)
>         at
> org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualService
> Implementation(SingletonServiceModel.java:69)
>         at $InnerProxy_fdbb040d47_3._service($InnerProxy_fdbb040d47_3.java)
>         at
> $InnerProxy_fdbb040d47_3.brokerConnection($InnerProxy_fdbb040d47_3.java)
>         at
> $SingletonProxy_fdbb040d29_2.brokerConnection($SingletonProxy_fdbb040d29_2.j
> ava)
>         at com.mckesson.adept.net.HiveMindDemo.main(HiveMindDemo.java:21)
> org.apache.hivemind.ApplicationRuntimeException: Unable to construct service
> com.mckesson.adept.net.Controller: java.lang.NullPointerException
>         at
> org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewS
> erviceImplementation(AbstractServiceModelImpl.java:156)
>         at
> org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServ
> iceImplementation(AbstractServiceModelImpl.java:130)
>         at
> org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualService
> Implementation(SingletonServiceModel.java:69)
>         at $InnerProxy_fdbb040d47_3._service($InnerProxy_fdbb040d47_3.java)
>         at $InnerProxy_fdbb040d47_3.shutdown($InnerProxy_fdbb040d47_3.java)
>         at
> $SingletonProxy_fdbb040d29_2.shutdown($SingletonProxy_fdbb040d29_2.java)
>         at com.mckesson.adept.net.HiveMindDemo.main(HiveMindDemo.java:33)
> Exception in thread "main"
> 
> I really don't know why, but I suspect it is because I'm not using the
> service element correctly in the contruct element for the BuilderFactory.
> Can anybody give me some insight as to what might be wrong?
> 
> Richard Hensley
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org