You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Phillip Rhodes <sp...@rhoderunner.com> on 2006/02/10 20:36:26 UTC

trouble injecting pojo into engine service

I have a singleton pojo that I am trying to manage with hivemind and want
to  inject this pojo into engine services, components, pages, etc...

The POJO is not an interface, but I can create one if necessary.  I added
the service point/set object (found below) to my libraries hivemodule.xml
and it errors out with the following:

Unable to construct service authsum.stitches.MyContent: Error building
service authsum.stitches.MyContent: Error at
jar:file:/usr/local/jakarta-tomcat/jakarta-tomcat-4.1.31/webapps/stitches/WEB-INF/lib/stitches-jar.jar!/META-INF/hivemodule.xml,
line 53, column 87: Unable to find interface
authsum.stitches.StitchFolderHolder (for service
authsum.stitches.StitchFolderHolder).


The error references an interface "authsum.stitches.StitchFolderHolder"
which does not exist.  There is a
"org.authsum.stitches.services.StitchFolderHolder" that I want to inject
into this service.  There is a setter on my service to take the property.

Thanks for any pointers on how to proceed with this.  "Stitches" is an
open source (apache license), a simple suite of cms components for
tapestry applications (image galleries, serverside image picking, html
editing, lucene search) no db....



	<service-point id="StitchFolderHolder">
		<create-instance
			class="org.authsum.stitches.services.StitchFolderHolder"/>
	</service-point>

	<service-point id="MyContent"
		interface="org.apache.tapestry.engine.IEngineService">

		<invoke-factory>
			<construct class="org.authsum.stitches.services.ContentService">
				<set-object property="exceptionReporter"
					value="infrastructure:requestExceptionReporter"/>
				<set-object property="response" value="infrastructure:response"/>
				<set-object property="linkFactory"
					value="infrastructure:linkFactory"/>
				<set-object property="stitchFolderHolder"
					value="service:StitchFolderHolder"/>
			</construct>
		</invoke-factory>

	</service-point>

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


Re: trouble injecting pojo into engine service

Posted by an...@di.uoa.gr.
And also, if in a service-point you omit the 
interface attribute, its value is by default equal to the id of
the service-point.
Assuming that your module has a package="authsum.stitches",
this explains why hivemind looks for (the non existant)
authsum.stitches.StitchFolderHolder interface (which in 
Hivemind 1.1, as Ron said, can also be a class)

Any URLs for the "Stitches" project ?

>From  Ron Piterman <rp...@gmx.net>:

> the problem is brobably with the factory you use.
> although you *can* specify a class as an interface in the service-point 
> def,
> 1. this is considered dirty.
> 2. some hivemind factories (like the one you are using) will not work.
> 
> The reason is: hivemind factories create a proxy implementation of the 
> given interface and implement the service model (threaded? singleton?) 
> in this proxy.
> 
> Either use a bean factory, your own factory, or extract an interface, 
> which is recommended for services (but not necessarily for statefull POJOs).
> 
> Cheers,
> Ron
> 
> 
> 
> Phillip Rhodes wrote:
> > I have a singleton pojo that I am trying to manage with hivemind and want
> > to  inject this pojo into engine services, components, pages, etc...
> > 
> > The POJO is not an interface, but I can create one if necessary.  I added
> > the service point/set object (found below) to my libraries hivemodule.xml
> > and it errors out with the following:
> > 
> > Unable to construct service authsum.stitches.MyContent: Error building
> > service authsum.stitches.MyContent: Error at
> >
>
jar:file:/usr/local/jakarta-tomcat/jakarta-tomcat-4.1.31/webapps/stitches/WEB-INF/lib/stitches-jar.jar!/META-INF/hivemodule.xml,
> > line 53, column 87: Unable to find interface
> > authsum.stitches.StitchFolderHolder (for service
> > authsum.stitches.StitchFolderHolder).
> > 
> > 
> > The error references an interface "authsum.stitches.StitchFolderHolder"
> > which does not exist.  There is a
> > "org.authsum.stitches.services.StitchFolderHolder" that I want to inject
> > into this service.  There is a setter on my service to take the property.
> > 
> > Thanks for any pointers on how to proceed with this.  "Stitches" is an
> > open source (apache license), a simple suite of cms components for
> > tapestry applications (image galleries, serverside image picking, html
> > editing, lucene search) no db....
> > 
> > 
> > 
> > 	<service-point id="StitchFolderHolder">
> > 		<create-instance
> > 			class="org.authsum.stitches.services.StitchFolderHolder"/>
> > 	</service-point>
> > 
> > 	<service-point id="MyContent"
> > 		interface="org.apache.tapestry.engine.IEngineService">
> > 
> > 		<invoke-factory>
> > 			<construct class="org.authsum.stitches.services.ContentService">
> > 				<set-object property="exceptionReporter"
> > 					value="infrastructure:requestExceptionReporter"/>
> > 				<set-object property="response" value="infrastructure:response"/>
> > 				<set-object property="linkFactory"
> > 					value="infrastructure:linkFactory"/>
> > 				<set-object property="stitchFolderHolder"
> > 					value="service:StitchFolderHolder"/>
> > 			</construct>
> > 		</invoke-factory>
> > 
> > 	</service-point>
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 



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


Re: trouble injecting pojo into engine service

Posted by Ron Piterman <rp...@gmx.net>.
the problem is brobably with the factory you use.
although you *can* specify a class as an interface in the service-point 
def,
1. this is considered dirty.
2. some hivemind factories (like the one you are using) will not work.

The reason is: hivemind factories create a proxy implementation of the 
given interface and implement the service model (threaded? singleton?) 
in this proxy.

Either use a bean factory, your own factory, or extract an interface, 
which is recommended for services (but not necessarily for statefull POJOs).

Cheers,
Ron



Phillip Rhodes wrote:
> I have a singleton pojo that I am trying to manage with hivemind and want
> to  inject this pojo into engine services, components, pages, etc...
> 
> The POJO is not an interface, but I can create one if necessary.  I added
> the service point/set object (found below) to my libraries hivemodule.xml
> and it errors out with the following:
> 
> Unable to construct service authsum.stitches.MyContent: Error building
> service authsum.stitches.MyContent: Error at
> jar:file:/usr/local/jakarta-tomcat/jakarta-tomcat-4.1.31/webapps/stitches/WEB-INF/lib/stitches-jar.jar!/META-INF/hivemodule.xml,
> line 53, column 87: Unable to find interface
> authsum.stitches.StitchFolderHolder (for service
> authsum.stitches.StitchFolderHolder).
> 
> 
> The error references an interface "authsum.stitches.StitchFolderHolder"
> which does not exist.  There is a
> "org.authsum.stitches.services.StitchFolderHolder" that I want to inject
> into this service.  There is a setter on my service to take the property.
> 
> Thanks for any pointers on how to proceed with this.  "Stitches" is an
> open source (apache license), a simple suite of cms components for
> tapestry applications (image galleries, serverside image picking, html
> editing, lucene search) no db....
> 
> 
> 
> 	<service-point id="StitchFolderHolder">
> 		<create-instance
> 			class="org.authsum.stitches.services.StitchFolderHolder"/>
> 	</service-point>
> 
> 	<service-point id="MyContent"
> 		interface="org.apache.tapestry.engine.IEngineService">
> 
> 		<invoke-factory>
> 			<construct class="org.authsum.stitches.services.ContentService">
> 				<set-object property="exceptionReporter"
> 					value="infrastructure:requestExceptionReporter"/>
> 				<set-object property="response" value="infrastructure:response"/>
> 				<set-object property="linkFactory"
> 					value="infrastructure:linkFactory"/>
> 				<set-object property="stitchFolderHolder"
> 					value="service:StitchFolderHolder"/>
> 			</construct>
> 		</invoke-factory>
> 
> 	</service-point>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: trouble injecting pojo into engine service

Posted by Shing Hing Man <ma...@yahoo.com>.
Have you tried specifying an interface in ? 
<service-point id="StitchFolderHolder"
interface="org.authsum.stitches.services.StitchFolderHolder">
		<create-instance
class="org.authsum.stitches.services.StitchFolderHolder"/>
 	</service-point>

In your case, you need to specify an interface for
service StitchFolderHolder. 
When the interface attribute is not given, HiveMind
will default the interface attribute to  (module's
package path) + service id.

Please see the doc for details.

http://jakarta.apache.org/hivemind/descriptor.html#service-point


Shing

--- Phillip Rhodes <sp...@rhoderunner.com> wrote:

> 
> I have a singleton pojo that I am trying to manage
> with hivemind and want
> to  inject this pojo into engine services,
> components, pages, etc...
> 
> The POJO is not an interface, but I can create one
> if necessary.  I added
> the service point/set object (found below) to my
> libraries hivemodule.xml
> and it errors out with the following:
> 
> Unable to construct service
> authsum.stitches.MyContent: Error building
> service authsum.stitches.MyContent: Error at
>
jar:file:/usr/local/jakarta-tomcat/jakarta-tomcat-4.1.31/webapps/stitches/WEB-INF/lib/stitches-jar.jar!/META-INF/hivemodule.xml,
> line 53, column 87: Unable to find interface
> authsum.stitches.StitchFolderHolder (for service
> authsum.stitches.StitchFolderHolder).
> 
> 
> The error references an interface
> "authsum.stitches.StitchFolderHolder"
> which does not exist.  There is a
> "org.authsum.stitches.services.StitchFolderHolder"
> that I want to inject
> into this service.  There is a setter on my service
> to take the property.
> 
> Thanks for any pointers on how to proceed with this.
>  "Stitches" is an
> open source (apache license), a simple suite of cms
> components for
> tapestry applications (image galleries, serverside
> image picking, html
> editing, lucene search) no db....
> 
> 
> 
> 	<service-point id="StitchFolderHolder">
> 		<create-instance
> 		
>
class="org.authsum.stitches.services.StitchFolderHolder"/>
> 	</service-point>
> 
> 	<service-point id="MyContent"
> 	
>
interface="org.apache.tapestry.engine.IEngineService">
> 
> 		<invoke-factory>
> 			<construct
>
class="org.authsum.stitches.services.ContentService">
> 				<set-object property="exceptionReporter"
> 				
> value="infrastructure:requestExceptionReporter"/>
> 				<set-object property="response"
> value="infrastructure:response"/>
> 				<set-object property="linkFactory"
> 					value="infrastructure:linkFactory"/>
> 				<set-object property="stitchFolderHolder"
> 					value="service:StitchFolderHolder"/>
> 			</construct>
> 		</invoke-factory>
> 
> 	</service-point>
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


Home page :
  http://uk.geocities.com/matmsh/index.html


		
___________________________________________________________ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars online! http://uk.cars.yahoo.com/

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