Definitely a step closer! Thanks so much Howard, now I just have to
figure out how to use the getLink() method properly, digging through
others' code now ;-).
-warner
On Oct 29, 2006, at 8:22 PM, Howard Lewis Ship wrote:
Warner,
I'm still unsure what's happening with your stack trace, but things
are
beginning to come together.
The core problem is that your engine service, ICalService, is not
invoking
the LinkFactory service correctly:
public ILink getLink(boolean isPost, Object parameters) {
return linkFactory.constructLink((IEngineService)this, isPost,
(Map)parameters, true);
}
The parameters object passed in, as per:
<a href="WeeksEvents.ics" jwcid="@ServiceLink" service="ognl:ical"
parameters="ognl:calendarType"/>
The service parameter of the ServiceLink component is supposed to
be the
*name* of the service, not the an instance of the service.
Tapestry is coercing the value from object to String.
It is then searching for a service with that long object
description as its
name, and failing.
<a href="WeeksEvents.ics" jwcid="@ServiceLink" service="ical"
parameters="ognl:calendarType"/>
Should get the job done!
I can see how easy it would be to stumble across this ... I almost
always
create my own FooLink component to go along with my FooService. The
ServiceLink component was originally designed to be used for minor
services
such as Home and Restart.
On 10/27/06, Warner Onstine <[EMAIL PROTECTED]> wrote:
Hi all,
I'm having some difficulties injecting a service, when I reference
the service through a @ServiceLink I get this exception:
org.apache.hivemind.ApplicationRuntimeException
No engine service named '<SingletonProxy for
eventscalendar.ICalService
(org.apache.tapestry.engine.IEngineService)>'
is available.
Stack Trace:
*
org.apache.tapestry.services.impl.ServiceMapImpl.buildProxy
(ServiceMapIm
pl.java:143)
*
org.apache.tapestry.services.impl.ServiceMapImpl.getService
(ServiceMapIm
pl.java:105)
* $ServiceMap_10e8b71c9d5.getService
($ServiceMap_10e8b71c9d5.java)
*
org.apache.tapestry.engine.AbstractEngine.getService
(AbstractEngine.java
:164)
*
org.apache.tapestry.link.AbstractLinkComponent.getLink
(AbstractLinkCompo
nent.java:197)
* org.apache.tapestry.link.ServiceLink.getLink
(ServiceLink.java:38)
*
org.apache.tapestry.link.DefaultLinkRenderer.constructURL
(DefaultLinkRen
derer.java:112)
*
org.apache.tapestry.link.DefaultLinkRenderer.renderLink
(DefaultLinkRende
rer.java:62)
Here is my setup:
hivemodule.xml
<module id="eventscalendar" version="4.0.0"
package="com.sourcebeat.tap101.services">
<contribution configuration-
id="tapestry.services.ApplicationServices">
<service name="ical" object="service:ICalService" />
</contribution>
<service-point id="ICalService"
interface="org.apache.tapestry.engine.IEngineService">
<invoke-factory model="singleton">
<construct class="ICalService">
<set-object property="eventDAO"
value="spring:eventDAO"/>
</construct>
</invoke-factory>
</service-point>
</module>
UpcomingEvents.java (all but the injection ommitted)
@InjectObject("service:eventscalendar.ICalService")
public abstract IEngineService getIcal();
UpcomingEvents.html (servicelink call)
<a href="WeeksEvents.ics" jwcid="@ServiceLink" service="ognl:ical"
parameters="ognl:calendarType"/>
Now one thing I'm not sure on is my service implements the
IEngineService but it returns null on the getLink(), I don't know if
this is the root cause of the error or not. But I thought I'd shoot
this off before testing that theory out.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]