You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by George Christman <gc...@cardaddy.com> on 2015/01/20 10:23:12 UTC

PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

I'm using T5 beta-25 and I have the following code and I'm noticing
when the scheduler fires off my service, my PageRenderLinkSource does
not work. If I manually fire it off through the admin with an
actionlink, it works without issue.

AppModule.class

@Startup
    public static void initApplication(SchedulerService scheduler) {
        scheduler.init();
    }

SchedulerService.class

executor.addJob(new CronSchedule("0 09 4 * * ?"),
                "Cleanup Listings", () -> {
                    try {
                        System.out.println("sitemap");
                        sitemap.buildSitemap();
                    } catch (JAXBException | IOException ex) {

Logger.getLogger(SchedulerServiceImpl.class.getName()).log(Level.SEVERE,
null, ex);
                    }
        });


SitemapService.class

   private final PageRenderLinkSource linkSource;

    public SitemapImpl(PageRenderLinkSource linkSource) {
        this.linkSource = linkSource;
    }

private void setSitemapXML(Class<?> clazz, UrlSet urlset, Object[] object) {
        SitemapXML siteMapXML = new SitemapXML();
        System.out.println("link");

        Link link = linkSource.createPageRenderLinkWithContext(clazz, object);
        System.out.println(link.toAbsoluteURI());

        link.setSecurity(LinkSecurity.SECURE);
        siteMapXML.setChangefreq(ChangeFreq.ALWAYS.toString());
        siteMapXML.setLoc(link.toAbsoluteURI());
        siteMapXML.setPriority(0.5);
        urlset.getSitemaps().add(siteMapXML);
    }

I'm seeing the following exception
java.lang.NullPointerException: Unable to delegate method invocation
to property 'request' of <Proxy for
RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
the property is null.

Any idea why this isn't working?

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
Thanks Lance, for the time being I have it working with URIBuilder, so
I'll just wait for the real issue to be fixed and move back to it.

On Thu, Jan 22, 2015 at 11:28 AM, Lance Java <la...@googlemail.com> wrote:
> Perhaps tapestry-offline could help
> https://github.com/uklance/tapestry-offline
>  On 20 Jan 2015 09:24, "George Christman" <gc...@cardaddy.com> wrote:
>
>> I'm using T5 beta-25 and I have the following code and I'm noticing
>> when the scheduler fires off my service, my PageRenderLinkSource does
>> not work. If I manually fire it off through the admin with an
>> actionlink, it works without issue.
>>
>> AppModule.class
>>
>> @Startup
>>     public static void initApplication(SchedulerService scheduler) {
>>         scheduler.init();
>>     }
>>
>> SchedulerService.class
>>
>> executor.addJob(new CronSchedule("0 09 4 * * ?"),
>>                 "Cleanup Listings", () -> {
>>                     try {
>>                         System.out.println("sitemap");
>>                         sitemap.buildSitemap();
>>                     } catch (JAXBException | IOException ex) {
>>
>> Logger.getLogger(SchedulerServiceImpl.class.getName()).log(Level.SEVERE,
>> null, ex);
>>                     }
>>         });
>>
>>
>> SitemapService.class
>>
>>    private final PageRenderLinkSource linkSource;
>>
>>     public SitemapImpl(PageRenderLinkSource linkSource) {
>>         this.linkSource = linkSource;
>>     }
>>
>> private void setSitemapXML(Class<?> clazz, UrlSet urlset, Object[] object)
>> {
>>         SitemapXML siteMapXML = new SitemapXML();
>>         System.out.println("link");
>>
>>         Link link = linkSource.createPageRenderLinkWithContext(clazz,
>> object);
>>         System.out.println(link.toAbsoluteURI());
>>
>>         link.setSecurity(LinkSecurity.SECURE);
>>         siteMapXML.setChangefreq(ChangeFreq.ALWAYS.toString());
>>         siteMapXML.setLoc(link.toAbsoluteURI());
>>         siteMapXML.setPriority(0.5);
>>         urlset.getSitemaps().add(siteMapXML);
>>     }
>>
>> I'm seeing the following exception
>> java.lang.NullPointerException: Unable to delegate method invocation
>> to property 'request' of <Proxy for
>> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>> the property is null.
>>
>> Any idea why this isn't working?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Lance Java <la...@googlemail.com>.
Perhaps tapestry-offline could help
https://github.com/uklance/tapestry-offline
 On 20 Jan 2015 09:24, "George Christman" <gc...@cardaddy.com> wrote:

> I'm using T5 beta-25 and I have the following code and I'm noticing
> when the scheduler fires off my service, my PageRenderLinkSource does
> not work. If I manually fire it off through the admin with an
> actionlink, it works without issue.
>
> AppModule.class
>
> @Startup
>     public static void initApplication(SchedulerService scheduler) {
>         scheduler.init();
>     }
>
> SchedulerService.class
>
> executor.addJob(new CronSchedule("0 09 4 * * ?"),
>                 "Cleanup Listings", () -> {
>                     try {
>                         System.out.println("sitemap");
>                         sitemap.buildSitemap();
>                     } catch (JAXBException | IOException ex) {
>
> Logger.getLogger(SchedulerServiceImpl.class.getName()).log(Level.SEVERE,
> null, ex);
>                     }
>         });
>
>
> SitemapService.class
>
>    private final PageRenderLinkSource linkSource;
>
>     public SitemapImpl(PageRenderLinkSource linkSource) {
>         this.linkSource = linkSource;
>     }
>
> private void setSitemapXML(Class<?> clazz, UrlSet urlset, Object[] object)
> {
>         SitemapXML siteMapXML = new SitemapXML();
>         System.out.println("link");
>
>         Link link = linkSource.createPageRenderLinkWithContext(clazz,
> object);
>         System.out.println(link.toAbsoluteURI());
>
>         link.setSecurity(LinkSecurity.SECURE);
>         siteMapXML.setChangefreq(ChangeFreq.ALWAYS.toString());
>         siteMapXML.setLoc(link.toAbsoluteURI());
>         siteMapXML.setPriority(0.5);
>         urlset.getSitemaps().add(siteMapXML);
>     }
>
> I'm seeing the following exception
> java.lang.NullPointerException: Unable to delegate method invocation
> to property 'request' of <Proxy for
> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
> the property is null.
>
> Any idea why this isn't working?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
I dunno maybe, I just got sick of fighting with it lol.

On Wed, Jan 21, 2015 at 5:04 PM, Chris Poulsen <ma...@nesluop.dk> wrote:
> Would it be easier to mock a request?
>
> On Wed, Jan 21, 2015 at 10:30 PM, George Christman <gc...@cardaddy.com>
> wrote:
>
>> On Wed, Jan 21, 2015 at 4:13 PM, Kalle Korhonen
>> <ka...@gmail.com> wrote:
>> > On Wed, Jan 21, 2015 at 1:07 PM, George Christman <
>> gchristman@cardaddy.com>
>> > wrote:
>> >
>> >> On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
>> >> <ka...@gmail.com> wrote:
>> >> > On Tue, Jan 20, 2015 at 1:03 PM, George Christman <
>> >> gchristman@cardaddy.com>
>> >> > wrote:
>> >> >> So I just took a look at the tapestry code and I'm not seeing anyway
>> >> >> to work around it unless I want to build my own links which I'd
>> rather
>> >> >> not do because of my use of the url rewriter.
>> >> >> Tap code line 113
>> >> >>
>> >>
>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>> >> >> How do you work around this?
>> >> > You are right George. Ever since the loopback reset listeners was put
>> it
>> >> in
>> >> > (for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore
>> work
>> >> > outside request context (e.g. in a scheduled job). You should instead
>> use
>> >> > the linkEncoder directly (as in the implementation for
>> >> > createPageRenderLink):
>> >> >
>> >> Just seen this, is there any chance we could fix this issue so that we
>> >> don't need to write the cumbersome code below every time? I'm actually
>> >> surprised I'm the first to discover this. We send out a lot of
>> >> reminder emails etc at work via a cron job which would require this
>> >> and I also need it to work for my own project. Should I create a bug
>> >> in jira?
>> >> >
>> >>
>> >
>> > Somebody's gotta be the first one. I guess many of the existing
>> > installations are still not using the more recent versions of T5. But I
>> > agree, it might be worth fixing so go ahead and open an issue.
>> >
>> Just seems like 5.3 was a long time ago lol. Ok np, I'll open an issue
>> up for it.
>> >
>> >> >         PageRenderRequestParameters parameters = new
>> >> > PageRenderRequestParameters(canonical, new ArrayEventContext(
>> >> >                 typeCoercer, context), loopback);
>> >> >         Link link = linkEncoder.createPageRenderLink(parameters);
>> >>
>> >> One last thing before we move on from this issue, what is the
>> >> canonical? Would that be the Page.class.getName() ? and I'm assuming
>> >> context is just my url context values?
>> >>
>> >
>> > Take another look at the source you pointed to yourself, but: String
>> > canonical = resolver.canonicalizePageName(pageName);
>>
>> Well it looks like you need to specify the exact page name and not the
>> java class, example "index"
>>
>> Anyhow none of it worked either, same issue as before.
>>
>>     @Inject
>>     private ComponentClassResolver resolver;
>>
>>     @Inject
>>     private TypeCoercer typeCoercer;
>>
>>     @Inject
>>     private ComponentEventLinkEncoder linkEncoder;
>>
>>     private void testTask() {
>>         periodicExecutor.addJob(new IntervalSchedule(3000),
>>                 "Data Validation1", new Runnable() {
>>             @Override
>>             public void run() {
>>                 System.out.println("test");
>>
>>                 try {
>>                     String canonical =
>> resolver.canonicalizePageName("login");
>>
>>                     PageRenderRequestParameters parameters = new
>> PageRenderRequestParameters(canonical, new ArrayEventContext(
>>                             typeCoercer, new Object()), false);
>>                     Link link =
>> linkEncoder.createPageRenderLink(parameters);
>>
>>                     System.out.println(link.toAbsoluteURI());
>>
>>
>>                 } catch (Exception ex) {
>>                     System.out.println("ex " + getStackTrace(ex));
>>                 }
>>             }
>>         });
>>     }
>>
>> exception
>>
>> ex java.lang.NullPointerException: Unable to delegate method
>> invocation to property 'request' of <Proxy for
>> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>> the property is null.
>>     at $Request_1a34deec12ab7.readProperty(Unknown Source)
>>     at $Request_1a34deec12ab7.isSecure(Unknown Source)
>>     at $Request_1a34deec12a4e.isSecure(Unknown Source)
>>     at
>> org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkPageSecurity(RequestSecurityManagerImpl.java:112)
>>     at $RequestSecurityManager_1a34deec12aae.checkPageSecurity(Unknown
>> Source)
>>     at
>> org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createPageRenderLink(ComponentEventLinkEncoderImpl.java:111)
>>     at
>> org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createPageRenderLink(LinkTransformerInterceptor.java:50)
>>     at
>> $ComponentEventLinkEncoder_1a34deec12a6d.createPageRenderLink(Unknown
>> Source)
>>     at
>> org.healthresearch.etss.services.scheduler.impl.ScheduleJobsImpl$1.run(ScheduleJobsImpl.java:155)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:225)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:49)
>>     at
>> org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl$1.call(ParallelExecutorImpl.java:60)
>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>     at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>     at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>     at java.lang.Thread.run(Thread.java:722)
>>
>>
>> I think for the time being I'm ust going to use URIBuilder or
>> something until this gets fixed.
>>
>> I'll file a jira issue tonight.
>> >
>> > Kalle
>> >
>> >
>> >>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>> >> >> <gc...@cardaddy.com> wrote:
>> >> >> >  Still no success in getting this to work. I've contributed the
>> >> Hostname
>> >> >> etc.
>> >> >> >
>> >> >> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT_SECURE,
>> "false");
>> >> >> >
>> >> >> > And a simple test which fails with the same error.
>> >> >> >
>> >> >> > private void testTask() {
>> >> >> >         periodicExecutor.addJob(new IntervalSchedule(3000),
>> >> >> >                 "Data Validation1", new Runnable() {
>> >> >> >             @Override
>> >> >> >             public void run() {
>> >> >> >                 System.out.println("test");
>> >> >> >                 try {
>> >> >> >
>> >> >> > System.out.println(linkSource.createPageRenderLink(Index.class));
>> >> >> >                 } catch (Exception ex) {
>> >> >> >                     System.out.println("ex " + ex);
>> >> >> >                 }
>> >> >> >             }
>> >> >> >         });
>> >> >> >     }
>> >> >> >
>> >> >> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
>> >> >> > <gc...@cardaddy.com> wrote:
>> >> >> >> So toAbsolute is the code calling the request and the cause of
>> this
>> >> >> >> exception? I'm assuming your referring to me contributing those
>> >> values
>> >> >> to my
>> >> >> >> appmodule. Once I contribute those values, would toAbsolute use
>> those
>> >> >> values
>> >> >> >> instead of the request? Just trying to understand the issue a
>> little
>> >> bit
>> >> >> >> better. Thanks Kalle.
>> >> >> >>
>> >> >> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <
>> >> kalle.o.korhonen@gmail.com>
>> >> >> >> wrote:
>> >> >> >>>
>> >> >> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> >> >> >>> <gc...@cardaddy.com>
>> >> >> >>> wrote:
>> >> >> >>>
>> >> >> >>> > I'm using T5 beta-25 and I have the following code and I'm
>> >> noticing
>> >> >> >>> > when the scheduler fires off my service, my
>> PageRenderLinkSource
>> >> does
>> >> >> >>> > not work. If I manually fire it off through the admin with an
>> >> >> >>> > actionlink, it works without issue.
>> >> >> >>> > I'm seeing the following exception
>> >> >> >>> > java.lang.NullPointerException: Unable to delegate method
>> >> invocation
>> >> >> >>> > to property 'request' of <Proxy for
>> >> >> >>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
>> >> >> because
>> >> >> >>> > the property is null.
>> >> >> >>> > Any idea why this isn't working?
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>> Naturally, you don't have a request to work with when you are
>> >> executing
>> >> >> >>> from a cron job. But if you just want to generate links, you
>> don't
>> >> >> need to
>> >> >> >>> and you shouldn't use the request values. Contribute HOSTNAME,
>> >> HOSTPORT
>> >> >> >>> and
>> >> >> >>> HOSTPORT_SECURE and you can generate absolute urls without
>> >> resorting to
>> >> >> >>> reading the values from the request.
>> >> >> >>>
>> >> >> >>> Kalle
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> >
>> >> >> >>> >
>> >> ---------------------------------------------------------------------
>> >> >> >>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> >> >>> > For additional commands, e-mail:
>> users-help@tapestry.apache.org
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > George Christman
>> >> >> > CEO
>> >> >> > www.CarDaddy.com
>> >> >> > P.O. Box 735
>> >> >> > Johnstown, New York
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> George Christman
>> >> >> CEO
>> >> >> www.CarDaddy.com
>> >> >> P.O. Box 735
>> >> >> Johnstown, New York
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> George Christman
>> >> CEO
>> >> www.CarDaddy.com
>> >> P.O. Box 735
>> >> Johnstown, New York
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>>
>>
>>
>> --
>> George Christman
>> CEO
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 21 Jan 2015 20:04:29 -0200, Chris Poulsen <ma...@nesluop.dk>
wrote:

> Would it be easier to mock a request?

I think this looks like a bug to me, even a relatively easy one to fix, so
it should be fixed.

>
> On Wed, Jan 21, 2015 at 10:30 PM, George Christman  
> <gc...@cardaddy.com>
> wrote:
>
>> On Wed, Jan 21, 2015 at 4:13 PM, Kalle Korhonen
>> <ka...@gmail.com> wrote:
>> > On Wed, Jan 21, 2015 at 1:07 PM, George Christman <
>> gchristman@cardaddy.com>
>> > wrote:
>> >
>> >> On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
>> >> <ka...@gmail.com> wrote:
>> >> > On Tue, Jan 20, 2015 at 1:03 PM, George Christman <
>> >> gchristman@cardaddy.com>
>> >> > wrote:
>> >> >> So I just took a look at the tapestry code and I'm not seeing  
>> anyway
>> >> >> to work around it unless I want to build my own links which I'd
>> rather
>> >> >> not do because of my use of the url rewriter.
>> >> >> Tap code line 113
>> >> >>
>> >>
>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>> >> >> How do you work around this?
>> >> > You are right George. Ever since the loopback reset listeners was  
>> put
>> it
>> >> in
>> >> > (for T5.3), the LinkSource.createPageRenderLink(...) doesn't  
>> anymore
>> work
>> >> > outside request context (e.g. in a scheduled job). You should  
>> instead
>> use
>> >> > the linkEncoder directly (as in the implementation for
>> >> > createPageRenderLink):
>> >> >
>> >> Just seen this, is there any chance we could fix this issue so that  
>> we
>> >> don't need to write the cumbersome code below every time? I'm  
>> actually
>> >> surprised I'm the first to discover this. We send out a lot of
>> >> reminder emails etc at work via a cron job which would require this
>> >> and I also need it to work for my own project. Should I create a bug
>> >> in jira?
>> >> >
>> >>
>> >
>> > Somebody's gotta be the first one. I guess many of the existing
>> > installations are still not using the more recent versions of T5. But  
>> I
>> > agree, it might be worth fixing so go ahead and open an issue.
>> >
>> Just seems like 5.3 was a long time ago lol. Ok np, I'll open an issue
>> up for it.
>> >
>> >> >         PageRenderRequestParameters parameters = new
>> >> > PageRenderRequestParameters(canonical, new ArrayEventContext(
>> >> >                 typeCoercer, context), loopback);
>> >> >         Link link = linkEncoder.createPageRenderLink(parameters);
>> >>
>> >> One last thing before we move on from this issue, what is the
>> >> canonical? Would that be the Page.class.getName() ? and I'm assuming
>> >> context is just my url context values?
>> >>
>> >
>> > Take another look at the source you pointed to yourself, but: String
>> > canonical = resolver.canonicalizePageName(pageName);
>>
>> Well it looks like you need to specify the exact page name and not the
>> java class, example "index"
>>
>> Anyhow none of it worked either, same issue as before.
>>
>>     @Inject
>>     private ComponentClassResolver resolver;
>>
>>     @Inject
>>     private TypeCoercer typeCoercer;
>>
>>     @Inject
>>     private ComponentEventLinkEncoder linkEncoder;
>>
>>     private void testTask() {
>>         periodicExecutor.addJob(new IntervalSchedule(3000),
>>                 "Data Validation1", new Runnable() {
>>             @Override
>>             public void run() {
>>                 System.out.println("test");
>>
>>                 try {
>>                     String canonical =
>> resolver.canonicalizePageName("login");
>>
>>                     PageRenderRequestParameters parameters = new
>> PageRenderRequestParameters(canonical, new ArrayEventContext(
>>                             typeCoercer, new Object()), false);
>>                     Link link =
>> linkEncoder.createPageRenderLink(parameters);
>>
>>                     System.out.println(link.toAbsoluteURI());
>>
>>
>>                 } catch (Exception ex) {
>>                     System.out.println("ex " + getStackTrace(ex));
>>                 }
>>             }
>>         });
>>     }
>>
>> exception
>>
>> ex java.lang.NullPointerException: Unable to delegate method
>> invocation to property 'request' of <Proxy for
>> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>> the property is null.
>>     at $Request_1a34deec12ab7.readProperty(Unknown Source)
>>     at $Request_1a34deec12ab7.isSecure(Unknown Source)
>>     at $Request_1a34deec12a4e.isSecure(Unknown Source)
>>     at
>> org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkPageSecurity(RequestSecurityManagerImpl.java:112)
>>     at $RequestSecurityManager_1a34deec12aae.checkPageSecurity(Unknown
>> Source)
>>     at
>> org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createPageRenderLink(ComponentEventLinkEncoderImpl.java:111)
>>     at
>> org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createPageRenderLink(LinkTransformerInterceptor.java:50)
>>     at
>> $ComponentEventLinkEncoder_1a34deec12a6d.createPageRenderLink(Unknown
>> Source)
>>     at
>> org.healthresearch.etss.services.scheduler.impl.ScheduleJobsImpl$1.run(ScheduleJobsImpl.java:155)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:225)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:49)
>>     at
>> org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl$1.call(ParallelExecutorImpl.java:60)
>>     at  
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>     at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>     at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>     at java.lang.Thread.run(Thread.java:722)
>>
>>
>> I think for the time being I'm ust going to use URIBuilder or
>> something until this gets fixed.
>>
>> I'll file a jira issue tonight.
>> >
>> > Kalle
>> >
>> >
>> >>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>> >> >> <gc...@cardaddy.com> wrote:
>> >> >> >  Still no success in getting this to work. I've contributed the
>> >> Hostname
>> >> >> etc.
>> >> >> >
>> >> >> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT_SECURE,
>> "false");
>> >> >> >
>> >> >> > And a simple test which fails with the same error.
>> >> >> >
>> >> >> > private void testTask() {
>> >> >> >         periodicExecutor.addJob(new IntervalSchedule(3000),
>> >> >> >                 "Data Validation1", new Runnable() {
>> >> >> >             @Override
>> >> >> >             public void run() {
>> >> >> >                 System.out.println("test");
>> >> >> >                 try {
>> >> >> >
>> >> >> >  
>> System.out.println(linkSource.createPageRenderLink(Index.class));
>> >> >> >                 } catch (Exception ex) {
>> >> >> >                     System.out.println("ex " + ex);
>> >> >> >                 }
>> >> >> >             }
>> >> >> >         });
>> >> >> >     }
>> >> >> >
>> >> >> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
>> >> >> > <gc...@cardaddy.com> wrote:
>> >> >> >> So toAbsolute is the code calling the request and the cause of
>> this
>> >> >> >> exception? I'm assuming your referring to me contributing those
>> >> values
>> >> >> to my
>> >> >> >> appmodule. Once I contribute those values, would toAbsolute use
>> those
>> >> >> values
>> >> >> >> instead of the request? Just trying to understand the issue a
>> little
>> >> bit
>> >> >> >> better. Thanks Kalle.
>> >> >> >>
>> >> >> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <
>> >> kalle.o.korhonen@gmail.com>
>> >> >> >> wrote:
>> >> >> >>>
>> >> >> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> >> >> >>> <gc...@cardaddy.com>
>> >> >> >>> wrote:
>> >> >> >>>
>> >> >> >>> > I'm using T5 beta-25 and I have the following code and I'm
>> >> noticing
>> >> >> >>> > when the scheduler fires off my service, my
>> PageRenderLinkSource
>> >> does
>> >> >> >>> > not work. If I manually fire it off through the admin with  
>> an
>> >> >> >>> > actionlink, it works without issue.
>> >> >> >>> > I'm seeing the following exception
>> >> >> >>> > java.lang.NullPointerException: Unable to delegate method
>> >> invocation
>> >> >> >>> > to property 'request' of <Proxy for
>> >> >> >>> >  
>> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
>> >> >> because
>> >> >> >>> > the property is null.
>> >> >> >>> > Any idea why this isn't working?
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>> Naturally, you don't have a request to work with when you are
>> >> executing
>> >> >> >>> from a cron job. But if you just want to generate links, you
>> don't
>> >> >> need to
>> >> >> >>> and you shouldn't use the request values. Contribute HOSTNAME,
>> >> HOSTPORT
>> >> >> >>> and
>> >> >> >>> HOSTPORT_SECURE and you can generate absolute urls without
>> >> resorting to
>> >> >> >>> reading the values from the request.
>> >> >> >>>
>> >> >> >>> Kalle
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> >
>> >> >> >>> >
>> >> ---------------------------------------------------------------------
>> >> >> >>> > To unsubscribe, e-mail:  
>> users-unsubscribe@tapestry.apache.org
>> >> >> >>> > For additional commands, e-mail:
>> users-help@tapestry.apache.org
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > George Christman
>> >> >> > CEO
>> >> >> > www.CarDaddy.com
>> >> >> > P.O. Box 735
>> >> >> > Johnstown, New York
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> George Christman
>> >> >> CEO
>> >> >> www.CarDaddy.com
>> >> >> P.O. Box 735
>> >> >> Johnstown, New York
>> >> >>
>> >> >>  
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> George Christman
>> >> CEO
>> >> www.CarDaddy.com
>> >> P.O. Box 735
>> >> Johnstown, New York
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>>
>>
>>
>> --
>> George Christman
>> CEO
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 21 Jan 2015 20:04:29 -0200, Chris Poulsen <ma...@nesluop.dk>
wrote:

> Would it be easier to mock a request?

I think this looks like a bug to me, even a relatively easy one to fix, so
it should be fixed IMHO.

>
> On Wed, Jan 21, 2015 at 10:30 PM, George Christman  
> <gc...@cardaddy.com>
> wrote:
>
>> On Wed, Jan 21, 2015 at 4:13 PM, Kalle Korhonen
>> <ka...@gmail.com> wrote:
>> > On Wed, Jan 21, 2015 at 1:07 PM, George Christman <
>> gchristman@cardaddy.com>
>> > wrote:
>> >
>> >> On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
>> >> <ka...@gmail.com> wrote:
>> >> > On Tue, Jan 20, 2015 at 1:03 PM, George Christman <
>> >> gchristman@cardaddy.com>
>> >> > wrote:
>> >> >> So I just took a look at the tapestry code and I'm not seeing  
>> anyway
>> >> >> to work around it unless I want to build my own links which I'd
>> rather
>> >> >> not do because of my use of the url rewriter.
>> >> >> Tap code line 113
>> >> >>
>> >>
>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>> >> >> How do you work around this?
>> >> > You are right George. Ever since the loopback reset listeners was  
>> put
>> it
>> >> in
>> >> > (for T5.3), the LinkSource.createPageRenderLink(...) doesn't  
>> anymore
>> work
>> >> > outside request context (e.g. in a scheduled job). You should  
>> instead
>> use
>> >> > the linkEncoder directly (as in the implementation for
>> >> > createPageRenderLink):
>> >> >
>> >> Just seen this, is there any chance we could fix this issue so that  
>> we
>> >> don't need to write the cumbersome code below every time? I'm  
>> actually
>> >> surprised I'm the first to discover this. We send out a lot of
>> >> reminder emails etc at work via a cron job which would require this
>> >> and I also need it to work for my own project. Should I create a bug
>> >> in jira?
>> >> >
>> >>
>> >
>> > Somebody's gotta be the first one. I guess many of the existing
>> > installations are still not using the more recent versions of T5. But  
>> I
>> > agree, it might be worth fixing so go ahead and open an issue.
>> >
>> Just seems like 5.3 was a long time ago lol. Ok np, I'll open an issue
>> up for it.
>> >
>> >> >         PageRenderRequestParameters parameters = new
>> >> > PageRenderRequestParameters(canonical, new ArrayEventContext(
>> >> >                 typeCoercer, context), loopback);
>> >> >         Link link = linkEncoder.createPageRenderLink(parameters);
>> >>
>> >> One last thing before we move on from this issue, what is the
>> >> canonical? Would that be the Page.class.getName() ? and I'm assuming
>> >> context is just my url context values?
>> >>
>> >
>> > Take another look at the source you pointed to yourself, but: String
>> > canonical = resolver.canonicalizePageName(pageName);
>>
>> Well it looks like you need to specify the exact page name and not the
>> java class, example "index"
>>
>> Anyhow none of it worked either, same issue as before.
>>
>>     @Inject
>>     private ComponentClassResolver resolver;
>>
>>     @Inject
>>     private TypeCoercer typeCoercer;
>>
>>     @Inject
>>     private ComponentEventLinkEncoder linkEncoder;
>>
>>     private void testTask() {
>>         periodicExecutor.addJob(new IntervalSchedule(3000),
>>                 "Data Validation1", new Runnable() {
>>             @Override
>>             public void run() {
>>                 System.out.println("test");
>>
>>                 try {
>>                     String canonical =
>> resolver.canonicalizePageName("login");
>>
>>                     PageRenderRequestParameters parameters = new
>> PageRenderRequestParameters(canonical, new ArrayEventContext(
>>                             typeCoercer, new Object()), false);
>>                     Link link =
>> linkEncoder.createPageRenderLink(parameters);
>>
>>                     System.out.println(link.toAbsoluteURI());
>>
>>
>>                 } catch (Exception ex) {
>>                     System.out.println("ex " + getStackTrace(ex));
>>                 }
>>             }
>>         });
>>     }
>>
>> exception
>>
>> ex java.lang.NullPointerException: Unable to delegate method
>> invocation to property 'request' of <Proxy for
>> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>> the property is null.
>>     at $Request_1a34deec12ab7.readProperty(Unknown Source)
>>     at $Request_1a34deec12ab7.isSecure(Unknown Source)
>>     at $Request_1a34deec12a4e.isSecure(Unknown Source)
>>     at
>> org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkPageSecurity(RequestSecurityManagerImpl.java:112)
>>     at $RequestSecurityManager_1a34deec12aae.checkPageSecurity(Unknown
>> Source)
>>     at
>> org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createPageRenderLink(ComponentEventLinkEncoderImpl.java:111)
>>     at
>> org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createPageRenderLink(LinkTransformerInterceptor.java:50)
>>     at
>> $ComponentEventLinkEncoder_1a34deec12a6d.createPageRenderLink(Unknown
>> Source)
>>     at
>> org.healthresearch.etss.services.scheduler.impl.ScheduleJobsImpl$1.run(ScheduleJobsImpl.java:155)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:225)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:49)
>>     at
>> org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl$1.call(ParallelExecutorImpl.java:60)
>>     at  
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>     at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>     at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>     at java.lang.Thread.run(Thread.java:722)
>>
>>
>> I think for the time being I'm ust going to use URIBuilder or
>> something until this gets fixed.
>>
>> I'll file a jira issue tonight.
>> >
>> > Kalle
>> >
>> >
>> >>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>> >> >> <gc...@cardaddy.com> wrote:
>> >> >> >  Still no success in getting this to work. I've contributed the
>> >> Hostname
>> >> >> etc.
>> >> >> >
>> >> >> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT_SECURE,
>> "false");
>> >> >> >
>> >> >> > And a simple test which fails with the same error.
>> >> >> >
>> >> >> > private void testTask() {
>> >> >> >         periodicExecutor.addJob(new IntervalSchedule(3000),
>> >> >> >                 "Data Validation1", new Runnable() {
>> >> >> >             @Override
>> >> >> >             public void run() {
>> >> >> >                 System.out.println("test");
>> >> >> >                 try {
>> >> >> >
>> >> >> >  
>> System.out.println(linkSource.createPageRenderLink(Index.class));
>> >> >> >                 } catch (Exception ex) {
>> >> >> >                     System.out.println("ex " + ex);
>> >> >> >                 }
>> >> >> >             }
>> >> >> >         });
>> >> >> >     }
>> >> >> >
>> >> >> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
>> >> >> > <gc...@cardaddy.com> wrote:
>> >> >> >> So toAbsolute is the code calling the request and the cause of
>> this
>> >> >> >> exception? I'm assuming your referring to me contributing those
>> >> values
>> >> >> to my
>> >> >> >> appmodule. Once I contribute those values, would toAbsolute use
>> those
>> >> >> values
>> >> >> >> instead of the request? Just trying to understand the issue a
>> little
>> >> bit
>> >> >> >> better. Thanks Kalle.
>> >> >> >>
>> >> >> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <
>> >> kalle.o.korhonen@gmail.com>
>> >> >> >> wrote:
>> >> >> >>>
>> >> >> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> >> >> >>> <gc...@cardaddy.com>
>> >> >> >>> wrote:
>> >> >> >>>
>> >> >> >>> > I'm using T5 beta-25 and I have the following code and I'm
>> >> noticing
>> >> >> >>> > when the scheduler fires off my service, my
>> PageRenderLinkSource
>> >> does
>> >> >> >>> > not work. If I manually fire it off through the admin with  
>> an
>> >> >> >>> > actionlink, it works without issue.
>> >> >> >>> > I'm seeing the following exception
>> >> >> >>> > java.lang.NullPointerException: Unable to delegate method
>> >> invocation
>> >> >> >>> > to property 'request' of <Proxy for
>> >> >> >>> >  
>> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
>> >> >> because
>> >> >> >>> > the property is null.
>> >> >> >>> > Any idea why this isn't working?
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>> Naturally, you don't have a request to work with when you are
>> >> executing
>> >> >> >>> from a cron job. But if you just want to generate links, you
>> don't
>> >> >> need to
>> >> >> >>> and you shouldn't use the request values. Contribute HOSTNAME,
>> >> HOSTPORT
>> >> >> >>> and
>> >> >> >>> HOSTPORT_SECURE and you can generate absolute urls without
>> >> resorting to
>> >> >> >>> reading the values from the request.
>> >> >> >>>
>> >> >> >>> Kalle
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> >
>> >> >> >>> >
>> >> ---------------------------------------------------------------------
>> >> >> >>> > To unsubscribe, e-mail:  
>> users-unsubscribe@tapestry.apache.org
>> >> >> >>> > For additional commands, e-mail:
>> users-help@tapestry.apache.org
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > George Christman
>> >> >> > CEO
>> >> >> > www.CarDaddy.com
>> >> >> > P.O. Box 735
>> >> >> > Johnstown, New York
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> George Christman
>> >> >> CEO
>> >> >> www.CarDaddy.com
>> >> >> P.O. Box 735
>> >> >> Johnstown, New York
>> >> >>
>> >> >>  
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> George Christman
>> >> CEO
>> >> www.CarDaddy.com
>> >> P.O. Box 735
>> >> Johnstown, New York
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>>
>>
>>
>> --
>> George Christman
>> CEO
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Chris Mylonas <ch...@opencsta.org>.
follow!
great tenacity.

ahhhhh..... the life cycle of bugs..... discovery deserves a beer!

Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
Issue created
https://issues.apache.org/jira/browse/TAP5-2441

On Wed, Jan 21, 2015 at 5:04 PM, Chris Poulsen <ma...@nesluop.dk> wrote:
> Would it be easier to mock a request?
>
> On Wed, Jan 21, 2015 at 10:30 PM, George Christman <gc...@cardaddy.com>
> wrote:
>
>> On Wed, Jan 21, 2015 at 4:13 PM, Kalle Korhonen
>> <ka...@gmail.com> wrote:
>> > On Wed, Jan 21, 2015 at 1:07 PM, George Christman <
>> gchristman@cardaddy.com>
>> > wrote:
>> >
>> >> On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
>> >> <ka...@gmail.com> wrote:
>> >> > On Tue, Jan 20, 2015 at 1:03 PM, George Christman <
>> >> gchristman@cardaddy.com>
>> >> > wrote:
>> >> >> So I just took a look at the tapestry code and I'm not seeing anyway
>> >> >> to work around it unless I want to build my own links which I'd
>> rather
>> >> >> not do because of my use of the url rewriter.
>> >> >> Tap code line 113
>> >> >>
>> >>
>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>> >> >> How do you work around this?
>> >> > You are right George. Ever since the loopback reset listeners was put
>> it
>> >> in
>> >> > (for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore
>> work
>> >> > outside request context (e.g. in a scheduled job). You should instead
>> use
>> >> > the linkEncoder directly (as in the implementation for
>> >> > createPageRenderLink):
>> >> >
>> >> Just seen this, is there any chance we could fix this issue so that we
>> >> don't need to write the cumbersome code below every time? I'm actually
>> >> surprised I'm the first to discover this. We send out a lot of
>> >> reminder emails etc at work via a cron job which would require this
>> >> and I also need it to work for my own project. Should I create a bug
>> >> in jira?
>> >> >
>> >>
>> >
>> > Somebody's gotta be the first one. I guess many of the existing
>> > installations are still not using the more recent versions of T5. But I
>> > agree, it might be worth fixing so go ahead and open an issue.
>> >
>> Just seems like 5.3 was a long time ago lol. Ok np, I'll open an issue
>> up for it.
>> >
>> >> >         PageRenderRequestParameters parameters = new
>> >> > PageRenderRequestParameters(canonical, new ArrayEventContext(
>> >> >                 typeCoercer, context), loopback);
>> >> >         Link link = linkEncoder.createPageRenderLink(parameters);
>> >>
>> >> One last thing before we move on from this issue, what is the
>> >> canonical? Would that be the Page.class.getName() ? and I'm assuming
>> >> context is just my url context values?
>> >>
>> >
>> > Take another look at the source you pointed to yourself, but: String
>> > canonical = resolver.canonicalizePageName(pageName);
>>
>> Well it looks like you need to specify the exact page name and not the
>> java class, example "index"
>>
>> Anyhow none of it worked either, same issue as before.
>>
>>     @Inject
>>     private ComponentClassResolver resolver;
>>
>>     @Inject
>>     private TypeCoercer typeCoercer;
>>
>>     @Inject
>>     private ComponentEventLinkEncoder linkEncoder;
>>
>>     private void testTask() {
>>         periodicExecutor.addJob(new IntervalSchedule(3000),
>>                 "Data Validation1", new Runnable() {
>>             @Override
>>             public void run() {
>>                 System.out.println("test");
>>
>>                 try {
>>                     String canonical =
>> resolver.canonicalizePageName("login");
>>
>>                     PageRenderRequestParameters parameters = new
>> PageRenderRequestParameters(canonical, new ArrayEventContext(
>>                             typeCoercer, new Object()), false);
>>                     Link link =
>> linkEncoder.createPageRenderLink(parameters);
>>
>>                     System.out.println(link.toAbsoluteURI());
>>
>>
>>                 } catch (Exception ex) {
>>                     System.out.println("ex " + getStackTrace(ex));
>>                 }
>>             }
>>         });
>>     }
>>
>> exception
>>
>> ex java.lang.NullPointerException: Unable to delegate method
>> invocation to property 'request' of <Proxy for
>> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>> the property is null.
>>     at $Request_1a34deec12ab7.readProperty(Unknown Source)
>>     at $Request_1a34deec12ab7.isSecure(Unknown Source)
>>     at $Request_1a34deec12a4e.isSecure(Unknown Source)
>>     at
>> org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkPageSecurity(RequestSecurityManagerImpl.java:112)
>>     at $RequestSecurityManager_1a34deec12aae.checkPageSecurity(Unknown
>> Source)
>>     at
>> org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createPageRenderLink(ComponentEventLinkEncoderImpl.java:111)
>>     at
>> org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createPageRenderLink(LinkTransformerInterceptor.java:50)
>>     at
>> $ComponentEventLinkEncoder_1a34deec12a6d.createPageRenderLink(Unknown
>> Source)
>>     at
>> org.healthresearch.etss.services.scheduler.impl.ScheduleJobsImpl$1.run(ScheduleJobsImpl.java:155)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:225)
>>     at
>> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:49)
>>     at
>> org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl$1.call(ParallelExecutorImpl.java:60)
>>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>     at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>     at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>     at java.lang.Thread.run(Thread.java:722)
>>
>>
>> I think for the time being I'm ust going to use URIBuilder or
>> something until this gets fixed.
>>
>> I'll file a jira issue tonight.
>> >
>> > Kalle
>> >
>> >
>> >>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>> >> >> <gc...@cardaddy.com> wrote:
>> >> >> >  Still no success in getting this to work. I've contributed the
>> >> Hostname
>> >> >> etc.
>> >> >> >
>> >> >> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
>> >> >> >         configuration.add(SymbolConstants.HOSTPORT_SECURE,
>> "false");
>> >> >> >
>> >> >> > And a simple test which fails with the same error.
>> >> >> >
>> >> >> > private void testTask() {
>> >> >> >         periodicExecutor.addJob(new IntervalSchedule(3000),
>> >> >> >                 "Data Validation1", new Runnable() {
>> >> >> >             @Override
>> >> >> >             public void run() {
>> >> >> >                 System.out.println("test");
>> >> >> >                 try {
>> >> >> >
>> >> >> > System.out.println(linkSource.createPageRenderLink(Index.class));
>> >> >> >                 } catch (Exception ex) {
>> >> >> >                     System.out.println("ex " + ex);
>> >> >> >                 }
>> >> >> >             }
>> >> >> >         });
>> >> >> >     }
>> >> >> >
>> >> >> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
>> >> >> > <gc...@cardaddy.com> wrote:
>> >> >> >> So toAbsolute is the code calling the request and the cause of
>> this
>> >> >> >> exception? I'm assuming your referring to me contributing those
>> >> values
>> >> >> to my
>> >> >> >> appmodule. Once I contribute those values, would toAbsolute use
>> those
>> >> >> values
>> >> >> >> instead of the request? Just trying to understand the issue a
>> little
>> >> bit
>> >> >> >> better. Thanks Kalle.
>> >> >> >>
>> >> >> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <
>> >> kalle.o.korhonen@gmail.com>
>> >> >> >> wrote:
>> >> >> >>>
>> >> >> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> >> >> >>> <gc...@cardaddy.com>
>> >> >> >>> wrote:
>> >> >> >>>
>> >> >> >>> > I'm using T5 beta-25 and I have the following code and I'm
>> >> noticing
>> >> >> >>> > when the scheduler fires off my service, my
>> PageRenderLinkSource
>> >> does
>> >> >> >>> > not work. If I manually fire it off through the admin with an
>> >> >> >>> > actionlink, it works without issue.
>> >> >> >>> > I'm seeing the following exception
>> >> >> >>> > java.lang.NullPointerException: Unable to delegate method
>> >> invocation
>> >> >> >>> > to property 'request' of <Proxy for
>> >> >> >>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
>> >> >> because
>> >> >> >>> > the property is null.
>> >> >> >>> > Any idea why this isn't working?
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>> Naturally, you don't have a request to work with when you are
>> >> executing
>> >> >> >>> from a cron job. But if you just want to generate links, you
>> don't
>> >> >> need to
>> >> >> >>> and you shouldn't use the request values. Contribute HOSTNAME,
>> >> HOSTPORT
>> >> >> >>> and
>> >> >> >>> HOSTPORT_SECURE and you can generate absolute urls without
>> >> resorting to
>> >> >> >>> reading the values from the request.
>> >> >> >>>
>> >> >> >>> Kalle
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >>> >
>> >> >> >>> >
>> >> ---------------------------------------------------------------------
>> >> >> >>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> >> >>> > For additional commands, e-mail:
>> users-help@tapestry.apache.org
>> >> >> >>> >
>> >> >> >>> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > George Christman
>> >> >> > CEO
>> >> >> > www.CarDaddy.com
>> >> >> > P.O. Box 735
>> >> >> > Johnstown, New York
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> George Christman
>> >> >> CEO
>> >> >> www.CarDaddy.com
>> >> >> P.O. Box 735
>> >> >> Johnstown, New York
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> George Christman
>> >> CEO
>> >> www.CarDaddy.com
>> >> P.O. Box 735
>> >> Johnstown, New York
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>>
>>
>>
>> --
>> George Christman
>> CEO
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Chris Poulsen <ma...@nesluop.dk>.
Would it be easier to mock a request?

On Wed, Jan 21, 2015 at 10:30 PM, George Christman <gc...@cardaddy.com>
wrote:

> On Wed, Jan 21, 2015 at 4:13 PM, Kalle Korhonen
> <ka...@gmail.com> wrote:
> > On Wed, Jan 21, 2015 at 1:07 PM, George Christman <
> gchristman@cardaddy.com>
> > wrote:
> >
> >> On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
> >> <ka...@gmail.com> wrote:
> >> > On Tue, Jan 20, 2015 at 1:03 PM, George Christman <
> >> gchristman@cardaddy.com>
> >> > wrote:
> >> >> So I just took a look at the tapestry code and I'm not seeing anyway
> >> >> to work around it unless I want to build my own links which I'd
> rather
> >> >> not do because of my use of the url rewriter.
> >> >> Tap code line 113
> >> >>
> >>
> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
> >> >> How do you work around this?
> >> > You are right George. Ever since the loopback reset listeners was put
> it
> >> in
> >> > (for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore
> work
> >> > outside request context (e.g. in a scheduled job). You should instead
> use
> >> > the linkEncoder directly (as in the implementation for
> >> > createPageRenderLink):
> >> >
> >> Just seen this, is there any chance we could fix this issue so that we
> >> don't need to write the cumbersome code below every time? I'm actually
> >> surprised I'm the first to discover this. We send out a lot of
> >> reminder emails etc at work via a cron job which would require this
> >> and I also need it to work for my own project. Should I create a bug
> >> in jira?
> >> >
> >>
> >
> > Somebody's gotta be the first one. I guess many of the existing
> > installations are still not using the more recent versions of T5. But I
> > agree, it might be worth fixing so go ahead and open an issue.
> >
> Just seems like 5.3 was a long time ago lol. Ok np, I'll open an issue
> up for it.
> >
> >> >         PageRenderRequestParameters parameters = new
> >> > PageRenderRequestParameters(canonical, new ArrayEventContext(
> >> >                 typeCoercer, context), loopback);
> >> >         Link link = linkEncoder.createPageRenderLink(parameters);
> >>
> >> One last thing before we move on from this issue, what is the
> >> canonical? Would that be the Page.class.getName() ? and I'm assuming
> >> context is just my url context values?
> >>
> >
> > Take another look at the source you pointed to yourself, but: String
> > canonical = resolver.canonicalizePageName(pageName);
>
> Well it looks like you need to specify the exact page name and not the
> java class, example "index"
>
> Anyhow none of it worked either, same issue as before.
>
>     @Inject
>     private ComponentClassResolver resolver;
>
>     @Inject
>     private TypeCoercer typeCoercer;
>
>     @Inject
>     private ComponentEventLinkEncoder linkEncoder;
>
>     private void testTask() {
>         periodicExecutor.addJob(new IntervalSchedule(3000),
>                 "Data Validation1", new Runnable() {
>             @Override
>             public void run() {
>                 System.out.println("test");
>
>                 try {
>                     String canonical =
> resolver.canonicalizePageName("login");
>
>                     PageRenderRequestParameters parameters = new
> PageRenderRequestParameters(canonical, new ArrayEventContext(
>                             typeCoercer, new Object()), false);
>                     Link link =
> linkEncoder.createPageRenderLink(parameters);
>
>                     System.out.println(link.toAbsoluteURI());
>
>
>                 } catch (Exception ex) {
>                     System.out.println("ex " + getStackTrace(ex));
>                 }
>             }
>         });
>     }
>
> exception
>
> ex java.lang.NullPointerException: Unable to delegate method
> invocation to property 'request' of <Proxy for
> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
> the property is null.
>     at $Request_1a34deec12ab7.readProperty(Unknown Source)
>     at $Request_1a34deec12ab7.isSecure(Unknown Source)
>     at $Request_1a34deec12a4e.isSecure(Unknown Source)
>     at
> org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkPageSecurity(RequestSecurityManagerImpl.java:112)
>     at $RequestSecurityManager_1a34deec12aae.checkPageSecurity(Unknown
> Source)
>     at
> org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createPageRenderLink(ComponentEventLinkEncoderImpl.java:111)
>     at
> org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createPageRenderLink(LinkTransformerInterceptor.java:50)
>     at
> $ComponentEventLinkEncoder_1a34deec12a6d.createPageRenderLink(Unknown
> Source)
>     at
> org.healthresearch.etss.services.scheduler.impl.ScheduleJobsImpl$1.run(ScheduleJobsImpl.java:155)
>     at
> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:225)
>     at
> org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:49)
>     at
> org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl$1.call(ParallelExecutorImpl.java:60)
>     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:722)
>
>
> I think for the time being I'm ust going to use URIBuilder or
> something until this gets fixed.
>
> I'll file a jira issue tonight.
> >
> > Kalle
> >
> >
> >>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
> >> >> <gc...@cardaddy.com> wrote:
> >> >> >  Still no success in getting this to work. I've contributed the
> >> Hostname
> >> >> etc.
> >> >> >
> >> >> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
> >> >> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
> >> >> >         configuration.add(SymbolConstants.HOSTPORT_SECURE,
> "false");
> >> >> >
> >> >> > And a simple test which fails with the same error.
> >> >> >
> >> >> > private void testTask() {
> >> >> >         periodicExecutor.addJob(new IntervalSchedule(3000),
> >> >> >                 "Data Validation1", new Runnable() {
> >> >> >             @Override
> >> >> >             public void run() {
> >> >> >                 System.out.println("test");
> >> >> >                 try {
> >> >> >
> >> >> > System.out.println(linkSource.createPageRenderLink(Index.class));
> >> >> >                 } catch (Exception ex) {
> >> >> >                     System.out.println("ex " + ex);
> >> >> >                 }
> >> >> >             }
> >> >> >         });
> >> >> >     }
> >> >> >
> >> >> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
> >> >> > <gc...@cardaddy.com> wrote:
> >> >> >> So toAbsolute is the code calling the request and the cause of
> this
> >> >> >> exception? I'm assuming your referring to me contributing those
> >> values
> >> >> to my
> >> >> >> appmodule. Once I contribute those values, would toAbsolute use
> those
> >> >> values
> >> >> >> instead of the request? Just trying to understand the issue a
> little
> >> bit
> >> >> >> better. Thanks Kalle.
> >> >> >>
> >> >> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <
> >> kalle.o.korhonen@gmail.com>
> >> >> >> wrote:
> >> >> >>>
> >> >> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
> >> >> >>> <gc...@cardaddy.com>
> >> >> >>> wrote:
> >> >> >>>
> >> >> >>> > I'm using T5 beta-25 and I have the following code and I'm
> >> noticing
> >> >> >>> > when the scheduler fires off my service, my
> PageRenderLinkSource
> >> does
> >> >> >>> > not work. If I manually fire it off through the admin with an
> >> >> >>> > actionlink, it works without issue.
> >> >> >>> > I'm seeing the following exception
> >> >> >>> > java.lang.NullPointerException: Unable to delegate method
> >> invocation
> >> >> >>> > to property 'request' of <Proxy for
> >> >> >>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
> >> >> because
> >> >> >>> > the property is null.
> >> >> >>> > Any idea why this isn't working?
> >> >> >>> >
> >> >> >>>
> >> >> >>> Naturally, you don't have a request to work with when you are
> >> executing
> >> >> >>> from a cron job. But if you just want to generate links, you
> don't
> >> >> need to
> >> >> >>> and you shouldn't use the request values. Contribute HOSTNAME,
> >> HOSTPORT
> >> >> >>> and
> >> >> >>> HOSTPORT_SECURE and you can generate absolute urls without
> >> resorting to
> >> >> >>> reading the values from the request.
> >> >> >>>
> >> >> >>> Kalle
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> >
> >> >> >>> >
> >> ---------------------------------------------------------------------
> >> >> >>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> >> >>> > For additional commands, e-mail:
> users-help@tapestry.apache.org
> >> >> >>> >
> >> >> >>> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > George Christman
> >> >> > CEO
> >> >> > www.CarDaddy.com
> >> >> > P.O. Box 735
> >> >> > Johnstown, New York
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> George Christman
> >> >> CEO
> >> >> www.CarDaddy.com
> >> >> P.O. Box 735
> >> >> Johnstown, New York
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >> >>
> >> >>
> >>
> >>
> >>
> >> --
> >> George Christman
> >> CEO
> >> www.CarDaddy.com
> >> P.O. Box 735
> >> Johnstown, New York
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
>
>
> --
> George Christman
> CEO
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
On Wed, Jan 21, 2015 at 4:13 PM, Kalle Korhonen
<ka...@gmail.com> wrote:
> On Wed, Jan 21, 2015 at 1:07 PM, George Christman <gc...@cardaddy.com>
> wrote:
>
>> On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
>> <ka...@gmail.com> wrote:
>> > On Tue, Jan 20, 2015 at 1:03 PM, George Christman <
>> gchristman@cardaddy.com>
>> > wrote:
>> >> So I just took a look at the tapestry code and I'm not seeing anyway
>> >> to work around it unless I want to build my own links which I'd rather
>> >> not do because of my use of the url rewriter.
>> >> Tap code line 113
>> >>
>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>> >> How do you work around this?
>> > You are right George. Ever since the loopback reset listeners was put it
>> in
>> > (for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore work
>> > outside request context (e.g. in a scheduled job). You should instead use
>> > the linkEncoder directly (as in the implementation for
>> > createPageRenderLink):
>> >
>> Just seen this, is there any chance we could fix this issue so that we
>> don't need to write the cumbersome code below every time? I'm actually
>> surprised I'm the first to discover this. We send out a lot of
>> reminder emails etc at work via a cron job which would require this
>> and I also need it to work for my own project. Should I create a bug
>> in jira?
>> >
>>
>
> Somebody's gotta be the first one. I guess many of the existing
> installations are still not using the more recent versions of T5. But I
> agree, it might be worth fixing so go ahead and open an issue.
>
Just seems like 5.3 was a long time ago lol. Ok np, I'll open an issue
up for it.
>
>> >         PageRenderRequestParameters parameters = new
>> > PageRenderRequestParameters(canonical, new ArrayEventContext(
>> >                 typeCoercer, context), loopback);
>> >         Link link = linkEncoder.createPageRenderLink(parameters);
>>
>> One last thing before we move on from this issue, what is the
>> canonical? Would that be the Page.class.getName() ? and I'm assuming
>> context is just my url context values?
>>
>
> Take another look at the source you pointed to yourself, but: String
> canonical = resolver.canonicalizePageName(pageName);

Well it looks like you need to specify the exact page name and not the
java class, example "index"

Anyhow none of it worked either, same issue as before.

    @Inject
    private ComponentClassResolver resolver;

    @Inject
    private TypeCoercer typeCoercer;

    @Inject
    private ComponentEventLinkEncoder linkEncoder;

    private void testTask() {
        periodicExecutor.addJob(new IntervalSchedule(3000),
                "Data Validation1", new Runnable() {
            @Override
            public void run() {
                System.out.println("test");

                try {
                    String canonical = resolver.canonicalizePageName("login");

                    PageRenderRequestParameters parameters = new
PageRenderRequestParameters(canonical, new ArrayEventContext(
                            typeCoercer, new Object()), false);
                    Link link = linkEncoder.createPageRenderLink(parameters);

                    System.out.println(link.toAbsoluteURI());


                } catch (Exception ex) {
                    System.out.println("ex " + getStackTrace(ex));
                }
            }
        });
    }

exception

ex java.lang.NullPointerException: Unable to delegate method
invocation to property 'request' of <Proxy for
RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
the property is null.
    at $Request_1a34deec12ab7.readProperty(Unknown Source)
    at $Request_1a34deec12ab7.isSecure(Unknown Source)
    at $Request_1a34deec12a4e.isSecure(Unknown Source)
    at org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkPageSecurity(RequestSecurityManagerImpl.java:112)
    at $RequestSecurityManager_1a34deec12aae.checkPageSecurity(Unknown Source)
    at org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createPageRenderLink(ComponentEventLinkEncoderImpl.java:111)
    at org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createPageRenderLink(LinkTransformerInterceptor.java:50)
    at $ComponentEventLinkEncoder_1a34deec12a6d.createPageRenderLink(Unknown
Source)
    at org.healthresearch.etss.services.scheduler.impl.ScheduleJobsImpl$1.run(ScheduleJobsImpl.java:155)
    at org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:225)
    at org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:49)
    at org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl$1.call(ParallelExecutorImpl.java:60)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)


I think for the time being I'm ust going to use URIBuilder or
something until this gets fixed.

I'll file a jira issue tonight.
>
> Kalle
>
>
>>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>> >> <gc...@cardaddy.com> wrote:
>> >> >  Still no success in getting this to work. I've contributed the
>> Hostname
>> >> etc.
>> >> >
>> >> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
>> >> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
>> >> >         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
>> >> >
>> >> > And a simple test which fails with the same error.
>> >> >
>> >> > private void testTask() {
>> >> >         periodicExecutor.addJob(new IntervalSchedule(3000),
>> >> >                 "Data Validation1", new Runnable() {
>> >> >             @Override
>> >> >             public void run() {
>> >> >                 System.out.println("test");
>> >> >                 try {
>> >> >
>> >> > System.out.println(linkSource.createPageRenderLink(Index.class));
>> >> >                 } catch (Exception ex) {
>> >> >                     System.out.println("ex " + ex);
>> >> >                 }
>> >> >             }
>> >> >         });
>> >> >     }
>> >> >
>> >> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
>> >> > <gc...@cardaddy.com> wrote:
>> >> >> So toAbsolute is the code calling the request and the cause of this
>> >> >> exception? I'm assuming your referring to me contributing those
>> values
>> >> to my
>> >> >> appmodule. Once I contribute those values, would toAbsolute use those
>> >> values
>> >> >> instead of the request? Just trying to understand the issue a little
>> bit
>> >> >> better. Thanks Kalle.
>> >> >>
>> >> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <
>> kalle.o.korhonen@gmail.com>
>> >> >> wrote:
>> >> >>>
>> >> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> >> >>> <gc...@cardaddy.com>
>> >> >>> wrote:
>> >> >>>
>> >> >>> > I'm using T5 beta-25 and I have the following code and I'm
>> noticing
>> >> >>> > when the scheduler fires off my service, my PageRenderLinkSource
>> does
>> >> >>> > not work. If I manually fire it off through the admin with an
>> >> >>> > actionlink, it works without issue.
>> >> >>> > I'm seeing the following exception
>> >> >>> > java.lang.NullPointerException: Unable to delegate method
>> invocation
>> >> >>> > to property 'request' of <Proxy for
>> >> >>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
>> >> because
>> >> >>> > the property is null.
>> >> >>> > Any idea why this isn't working?
>> >> >>> >
>> >> >>>
>> >> >>> Naturally, you don't have a request to work with when you are
>> executing
>> >> >>> from a cron job. But if you just want to generate links, you don't
>> >> need to
>> >> >>> and you shouldn't use the request values. Contribute HOSTNAME,
>> HOSTPORT
>> >> >>> and
>> >> >>> HOSTPORT_SECURE and you can generate absolute urls without
>> resorting to
>> >> >>> reading the values from the request.
>> >> >>>
>> >> >>> Kalle
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> >
>> >> >>> >
>> ---------------------------------------------------------------------
>> >> >>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> >>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >>> >
>> >> >>> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > George Christman
>> >> > CEO
>> >> > www.CarDaddy.com
>> >> > P.O. Box 735
>> >> > Johnstown, New York
>> >>
>> >>
>> >>
>> >> --
>> >> George Christman
>> >> CEO
>> >> www.CarDaddy.com
>> >> P.O. Box 735
>> >> Johnstown, New York
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>>
>>
>>
>> --
>> George Christman
>> CEO
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Kalle Korhonen <ka...@gmail.com>.
On Wed, Jan 21, 2015 at 1:07 PM, George Christman <gc...@cardaddy.com>
wrote:

> On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
> <ka...@gmail.com> wrote:
> > On Tue, Jan 20, 2015 at 1:03 PM, George Christman <
> gchristman@cardaddy.com>
> > wrote:
> >> So I just took a look at the tapestry code and I'm not seeing anyway
> >> to work around it unless I want to build my own links which I'd rather
> >> not do because of my use of the url rewriter.
> >> Tap code line 113
> >>
> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
> >> How do you work around this?
> > You are right George. Ever since the loopback reset listeners was put it
> in
> > (for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore work
> > outside request context (e.g. in a scheduled job). You should instead use
> > the linkEncoder directly (as in the implementation for
> > createPageRenderLink):
> >
> Just seen this, is there any chance we could fix this issue so that we
> don't need to write the cumbersome code below every time? I'm actually
> surprised I'm the first to discover this. We send out a lot of
> reminder emails etc at work via a cron job which would require this
> and I also need it to work for my own project. Should I create a bug
> in jira?
> >
>

Somebody's gotta be the first one. I guess many of the existing
installations are still not using the more recent versions of T5. But I
agree, it might be worth fixing so go ahead and open an issue.


> >         PageRenderRequestParameters parameters = new
> > PageRenderRequestParameters(canonical, new ArrayEventContext(
> >                 typeCoercer, context), loopback);
> >         Link link = linkEncoder.createPageRenderLink(parameters);
>
> One last thing before we move on from this issue, what is the
> canonical? Would that be the Page.class.getName() ? and I'm assuming
> context is just my url context values?
>

Take another look at the source you pointed to yourself, but: String
canonical = resolver.canonicalizePageName(pageName);

Kalle


>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
> >> <gc...@cardaddy.com> wrote:
> >> >  Still no success in getting this to work. I've contributed the
> Hostname
> >> etc.
> >> >
> >> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
> >> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
> >> >         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
> >> >
> >> > And a simple test which fails with the same error.
> >> >
> >> > private void testTask() {
> >> >         periodicExecutor.addJob(new IntervalSchedule(3000),
> >> >                 "Data Validation1", new Runnable() {
> >> >             @Override
> >> >             public void run() {
> >> >                 System.out.println("test");
> >> >                 try {
> >> >
> >> > System.out.println(linkSource.createPageRenderLink(Index.class));
> >> >                 } catch (Exception ex) {
> >> >                     System.out.println("ex " + ex);
> >> >                 }
> >> >             }
> >> >         });
> >> >     }
> >> >
> >> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
> >> > <gc...@cardaddy.com> wrote:
> >> >> So toAbsolute is the code calling the request and the cause of this
> >> >> exception? I'm assuming your referring to me contributing those
> values
> >> to my
> >> >> appmodule. Once I contribute those values, would toAbsolute use those
> >> values
> >> >> instead of the request? Just trying to understand the issue a little
> bit
> >> >> better. Thanks Kalle.
> >> >>
> >> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <
> kalle.o.korhonen@gmail.com>
> >> >> wrote:
> >> >>>
> >> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
> >> >>> <gc...@cardaddy.com>
> >> >>> wrote:
> >> >>>
> >> >>> > I'm using T5 beta-25 and I have the following code and I'm
> noticing
> >> >>> > when the scheduler fires off my service, my PageRenderLinkSource
> does
> >> >>> > not work. If I manually fire it off through the admin with an
> >> >>> > actionlink, it works without issue.
> >> >>> > I'm seeing the following exception
> >> >>> > java.lang.NullPointerException: Unable to delegate method
> invocation
> >> >>> > to property 'request' of <Proxy for
> >> >>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
> >> because
> >> >>> > the property is null.
> >> >>> > Any idea why this isn't working?
> >> >>> >
> >> >>>
> >> >>> Naturally, you don't have a request to work with when you are
> executing
> >> >>> from a cron job. But if you just want to generate links, you don't
> >> need to
> >> >>> and you shouldn't use the request values. Contribute HOSTNAME,
> HOSTPORT
> >> >>> and
> >> >>> HOSTPORT_SECURE and you can generate absolute urls without
> resorting to
> >> >>> reading the values from the request.
> >> >>>
> >> >>> Kalle
> >> >>>
> >> >>>
> >> >>>
> >> >>> >
> >> >>> >
> ---------------------------------------------------------------------
> >> >>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> >>> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >>> >
> >> >>> >
> >> >
> >> >
> >> >
> >> > --
> >> > George Christman
> >> > CEO
> >> > www.CarDaddy.com
> >> > P.O. Box 735
> >> > Johnstown, New York
> >>
> >>
> >>
> >> --
> >> George Christman
> >> CEO
> >> www.CarDaddy.com
> >> P.O. Box 735
> >> Johnstown, New York
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
>
>
> --
> George Christman
> CEO
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
<ka...@gmail.com> wrote:
> On Tue, Jan 20, 2015 at 1:03 PM, George Christman <gc...@cardaddy.com>
> wrote:
>
>> So I just took a look at the tapestry code and I'm not seeing anyway
>> to work around it unless I want to build my own links which I'd rather
>> not do because of my use of the url rewriter.
>>
>> Tap code line 113
>>
>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>> How do you work around this?
>>
>
> You are right George. Ever since the loopback reset listeners was put it in
> (for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore work
> outside request context (e.g. in a scheduled job). You should instead use
> the linkEncoder directly (as in the implementation for
> createPageRenderLink):
>
Just seen this, is there any chance we could fix this issue so that we
don't need to write the cumbersome code below every time? I'm actually
surprised I'm the first to discover this. We send out a lot of
reminder emails etc at work via a cron job which would require this
and I also need it to work for my own project. Should I create a bug
in jira?

>         PageRenderRequestParameters parameters = new
> PageRenderRequestParameters(canonical, new ArrayEventContext(
>                 typeCoercer, context), loopback);
>         Link link = linkEncoder.createPageRenderLink(parameters);

One last thing before we move on from this issue, what is the
canonical? Would that be the Page.class.getName() ? and I'm assuming
context is just my url context values?

Thanks Kalle.
>
> Set loopback to false, you don't need it.
>
> Kalle
>
>
>>
>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>> <gc...@cardaddy.com> wrote:
>> >  Still no success in getting this to work. I've contributed the Hostname
>> etc.
>> >
>> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
>> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
>> >         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
>> >
>> > And a simple test which fails with the same error.
>> >
>> > private void testTask() {
>> >         periodicExecutor.addJob(new IntervalSchedule(3000),
>> >                 "Data Validation1", new Runnable() {
>> >             @Override
>> >             public void run() {
>> >                 System.out.println("test");
>> >                 try {
>> >
>> > System.out.println(linkSource.createPageRenderLink(Index.class));
>> >                 } catch (Exception ex) {
>> >                     System.out.println("ex " + ex);
>> >                 }
>> >             }
>> >         });
>> >     }
>> >
>> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
>> > <gc...@cardaddy.com> wrote:
>> >> So toAbsolute is the code calling the request and the cause of this
>> >> exception? I'm assuming your referring to me contributing those values
>> to my
>> >> appmodule. Once I contribute those values, would toAbsolute use those
>> values
>> >> instead of the request? Just trying to understand the issue a little bit
>> >> better. Thanks Kalle.
>> >>
>> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <ka...@gmail.com>
>> >> wrote:
>> >>>
>> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> >>> <gc...@cardaddy.com>
>> >>> wrote:
>> >>>
>> >>> > I'm using T5 beta-25 and I have the following code and I'm noticing
>> >>> > when the scheduler fires off my service, my PageRenderLinkSource does
>> >>> > not work. If I manually fire it off through the admin with an
>> >>> > actionlink, it works without issue.
>> >>> > I'm seeing the following exception
>> >>> > java.lang.NullPointerException: Unable to delegate method invocation
>> >>> > to property 'request' of <Proxy for
>> >>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
>> because
>> >>> > the property is null.
>> >>> > Any idea why this isn't working?
>> >>> >
>> >>>
>> >>> Naturally, you don't have a request to work with when you are executing
>> >>> from a cron job. But if you just want to generate links, you don't
>> need to
>> >>> and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT
>> >>> and
>> >>> HOSTPORT_SECURE and you can generate absolute urls without resorting to
>> >>> reading the values from the request.
>> >>>
>> >>> Kalle
>> >>>
>> >>>
>> >>>
>> >>> >
>> >>> > ---------------------------------------------------------------------
>> >>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >>> >
>> >>> >
>> >
>> >
>> >
>> > --
>> > George Christman
>> > CEO
>> > www.CarDaddy.com
>> > P.O. Box 735
>> > Johnstown, New York
>>
>>
>>
>> --
>> George Christman
>> CEO
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Kalle Korhonen <ka...@gmail.com>.
On Tue, Jan 20, 2015 at 1:03 PM, George Christman <gc...@cardaddy.com>
wrote:

> So I just took a look at the tapestry code and I'm not seeing anyway
> to work around it unless I want to build my own links which I'd rather
> not do because of my use of the url rewriter.
>
> Tap code line 113
>
> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
> How do you work around this?
>

You are right George. Ever since the loopback reset listeners was put it in
(for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore work
outside request context (e.g. in a scheduled job). You should instead use
the linkEncoder directly (as in the implementation for
createPageRenderLink):

        PageRenderRequestParameters parameters = new
PageRenderRequestParameters(canonical, new ArrayEventContext(
                typeCoercer, context), loopback);
        Link link = linkEncoder.createPageRenderLink(parameters);

Set loopback to false, you don't need it.

Kalle


>
> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
> <gc...@cardaddy.com> wrote:
> >  Still no success in getting this to work. I've contributed the Hostname
> etc.
> >
> > configuration.add(SymbolConstants.HOSTNAME, "localhost");
> >         configuration.add(SymbolConstants.HOSTPORT, "8080");
> >         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
> >
> > And a simple test which fails with the same error.
> >
> > private void testTask() {
> >         periodicExecutor.addJob(new IntervalSchedule(3000),
> >                 "Data Validation1", new Runnable() {
> >             @Override
> >             public void run() {
> >                 System.out.println("test");
> >                 try {
> >
> > System.out.println(linkSource.createPageRenderLink(Index.class));
> >                 } catch (Exception ex) {
> >                     System.out.println("ex " + ex);
> >                 }
> >             }
> >         });
> >     }
> >
> > On Tue, Jan 20, 2015 at 7:41 AM, George Christman
> > <gc...@cardaddy.com> wrote:
> >> So toAbsolute is the code calling the request and the cause of this
> >> exception? I'm assuming your referring to me contributing those values
> to my
> >> appmodule. Once I contribute those values, would toAbsolute use those
> values
> >> instead of the request? Just trying to understand the issue a little bit
> >> better. Thanks Kalle.
> >>
> >> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <ka...@gmail.com>
> >> wrote:
> >>>
> >>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
> >>> <gc...@cardaddy.com>
> >>> wrote:
> >>>
> >>> > I'm using T5 beta-25 and I have the following code and I'm noticing
> >>> > when the scheduler fires off my service, my PageRenderLinkSource does
> >>> > not work. If I manually fire it off through the admin with an
> >>> > actionlink, it works without issue.
> >>> > I'm seeing the following exception
> >>> > java.lang.NullPointerException: Unable to delegate method invocation
> >>> > to property 'request' of <Proxy for
> >>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
> because
> >>> > the property is null.
> >>> > Any idea why this isn't working?
> >>> >
> >>>
> >>> Naturally, you don't have a request to work with when you are executing
> >>> from a cron job. But if you just want to generate links, you don't
> need to
> >>> and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT
> >>> and
> >>> HOSTPORT_SECURE and you can generate absolute urls without resorting to
> >>> reading the values from the request.
> >>>
> >>> Kalle
> >>>
> >>>
> >>>
> >>> >
> >>> > ---------------------------------------------------------------------
> >>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> > For additional commands, e-mail: users-help@tapestry.apache.org
> >>> >
> >>> >
> >
> >
> >
> > --
> > George Christman
> > CEO
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
>
>
>
> --
> George Christman
> CEO
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
On Wed, Jan 21, 2015 at 3:32 PM, Thiago H de Paula Figueiredo
<th...@gmail.com> wrote:
> On Wed, 21 Jan 2015 12:07:10 -0200, George Christman
> <gc...@cardaddy.com> wrote:
>
>> I guess there is a bug in the PageRenderLinkSource component
>
>
> It's not a component: it's a service.
>
> then or
>>
>> I'm missing something because it does not seem to work. My
>> configuration is as followed, perhaps I'm missing something simple.
>>
>> My local environment uses Jetty
>>
>> In my DevelopmentModule I have the following config.
>>
>> public static void
>> contributeApplicationDefaults(MappedConfiguration<String, Object>
>> configuration) {
>>         // The factory default is true but during the early stages of
>> an application
>>         // overriding to false is a good idea. In addition, this is
>> often overridden
>>         // on the command line as -Dtapestry.production-mode=false
>>         configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
>>         configuration.add(SymbolConstants.HOSTNAME, "localhost");
>>         configuration.add(SymbolConstants.HOSTPORT, "8080");
>>         configuration.add(SymbolConstants.HOSTPORT_SECURE, "8443");
>> }
>
>
> Are you sure this method was actually invoked?

Yes I'm positive, I just did a System.out from the method on startup
and I had output.
>
>>  Exception
>> ex Unable to delegate method invocation to property 'request' of
>> <Proxy for RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
>> because the property is null.
>
>
> Full stack trace please.
ex java.lang.NullPointerException: Unable to delegate method
invocation to property 'request' of <Proxy for
RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
the property is null.
    at $Request_1a1d210554a2f.readProperty(Unknown Source)
    at $Request_1a1d210554a2f.isSecure(Unknown Source)
    at $Request_1a1d2105549ab.isSecure(Unknown Source)
    at org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkPageSecurity(RequestSecurityManagerImpl.java:112)
    at $RequestSecurityManager_1a1d210554a28.checkPageSecurity(Unknown Source)
    at org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createPageRenderLink(ComponentEventLinkEncoderImpl.java:111)
    at org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createPageRenderLink(LinkTransformerInterceptor.java:50)
    at $ComponentEventLinkEncoder_1a1d210554a0d.createPageRenderLink(Unknown
Source)
    at org.apache.tapestry5.internal.services.LinkSourceImpl.createPageRenderLink(LinkSourceImpl.java:119)
    at $LinkSource_1a1d210554a0a.createPageRenderLink(Unknown Source)
    at org.apache.tapestry5.internal.services.PageRenderLinkSourceImpl.createPageRenderLink(PageRenderLinkSourceImpl.java:46)
    at org.apache.tapestry5.internal.services.PageRenderLinkSourceImpl.createPageRenderLink(PageRenderLinkSourceImpl.java:41)
    at $PageRenderLinkSource_1a1d2105549ca.createPageRenderLink(Unknown Source)
    at org.healthresearch.etss.services.scheduler.impl.ScheduleJobsImpl$1.run(ScheduleJobsImpl.java:142)
    at org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:225)
    at org.apache.tapestry5.ioc.internal.services.cron.PeriodicExecutorImpl$Job.invoke(PeriodicExecutorImpl.java:49)
    at org.apache.tapestry5.ioc.internal.services.ParallelExecutorImpl$1.call(ParallelExecutorImpl.java:60)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 21 Jan 2015 12:07:10 -0200, George Christman  
<gc...@cardaddy.com> wrote:

> I guess there is a bug in the PageRenderLinkSource component

It's not a component: it's a service.

then or
> I'm missing something because it does not seem to work. My
> configuration is as followed, perhaps I'm missing something simple.
>
> My local environment uses Jetty
>
> In my DevelopmentModule I have the following config.
>
> public static void
> contributeApplicationDefaults(MappedConfiguration<String, Object>
> configuration) {
>         // The factory default is true but during the early stages of
> an application
>         // overriding to false is a good idea. In addition, this is
> often overridden
>         // on the command line as -Dtapestry.production-mode=false
>         configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
>         configuration.add(SymbolConstants.HOSTNAME, "localhost");
>         configuration.add(SymbolConstants.HOSTPORT, "8080");
>         configuration.add(SymbolConstants.HOSTPORT_SECURE, "8443");
> }

Are you sure this method was actually invoked?

>  Exception
> ex Unable to delegate method invocation to property 'request' of
> <Proxy for RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
> because the property is null.

Full stack trace please.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
I guess there is a bug in the PageRenderLinkSource component then or
I'm missing something because it does not seem to work. My
configuration is as followed, perhaps I'm missing something simple.

My local environment uses Jetty

In my DevelopmentModule I have the following config.

public static void
contributeApplicationDefaults(MappedConfiguration<String, Object>
configuration) {
        // The factory default is true but during the early stages of
an application
        // overriding to false is a good idea. In addition, this is
often overridden
        // on the command line as -Dtapestry.production-mode=false
        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
        configuration.add(SymbolConstants.HOSTNAME, "localhost");
        configuration.add(SymbolConstants.HOSTPORT, "8080");
        configuration.add(SymbolConstants.HOSTPORT_SECURE, "8443");
}

AppModule.class

@Startup
public static void initApplication(ScheduleJobs scheduleJobs) {
       scheduleJobs.startJobs();
}


ScheduleJobsImpl.class

@Inject
private PageRenderLinkSource linkSource;

public void startJobs() {
        periodicExecutor.addJob(new IntervalSchedule(3000),
                "Link Test", new Runnable() {
            @Override
            public void run() {
                System.out.println("Start Link Test");
                try {
                    Link link = linkSource.createPageRenderLink(Index.class);
                    System.out.println(link.toAbsoluteURI());
                } catch (Exception ex) {
                    System.out.println("ex " + ex.getMessage());
                }
            }
        });
    }

 Exception
ex Unable to delegate method invocation to property 'request' of
<Proxy for RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,
because the property is null.



On Wed, Jan 21, 2015 at 6:53 AM, Thiago H de Paula Figueiredo
<th...@gmail.com> wrote:
> On Tue, 20 Jan 2015 21:13:08 -0200, George Christman
> <gc...@cardaddy.com> wrote:
>
>> Thanks Thiago, but I think I'm even more confused now lol It looks
>> like I confused HOSTPORT_SECURE with SECURE_ENABLED. Anyhow should I
>> not be using PageRenderLinkSouce?
>
>
> You should use it.
>
>> You said to take a look at
>> ComponentEventLinkEncoder,
>
>
> Because that's what PageRenderLinkSource uses, so you can better understand
> what's happening. ;)
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 20 Jan 2015 21:13:08 -0200, George Christman  
<gc...@cardaddy.com> wrote:

> Thanks Thiago, but I think I'm even more confused now lol It looks
> like I confused HOSTPORT_SECURE with SECURE_ENABLED. Anyhow should I
> not be using PageRenderLinkSouce?

You should use it.

> You said to take a look at
> ComponentEventLinkEncoder,

Because that's what PageRenderLinkSource uses, so you can better  
understand what's happening. ;)

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
Thanks Thiago, but I think I'm even more confused now lol It looks
like I confused HOSTPORT_SECURE with SECURE_ENABLED. Anyhow should I
not be using PageRenderLinkSouce? You said to take a look at
ComponentEventLinkEncoder, are you suggesting to take a look at it to
build my own link building method or is there a public interface that
uses ComponentEventLinkEncoder I should be using? If those
configurations are set properly in the appmodule, are you saying it
PageRenderLink source, or ComponentEventLinkENcoder won't use the
Request?

Thanks.

On Tue, Jan 20, 2015 at 4:24 PM, Thiago H de Paula Figueiredo
<th...@gmail.com> wrote:
> On Tue, 20 Jan 2015 19:13:30 -0200, Thiago H de Paula Figueiredo
> <th...@gmail.com> wrote:
>
>> On Tue, 20 Jan 2015 19:03:30 -0200, George Christman
>> <gc...@cardaddy.com> wrote:
>>
>>> So I just took a look at the tapestry code and I'm not seeing anyway
>>> to work around it unless I want to build my own links which I'd rather
>>> not do because of my use of the url rewriter.
>>>
>>> Tap code line 113
>>>
>>>
>>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>>
>>
>> You should take a look at ComponentEventLinkEncoder.createPageRenderLink,
>> which the Link itself is created.
>
>
> Which actually uses the BaseURLSource service (default implementation source
> at
> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BaseURLSourceImpl.java).
> If you correctly set the SymbolConstants.HOSTNAME, SymbolConstants.HOSTPORT
> and SymbolConstants.HOSTPORT_SECURE symbols, it won't use the Request, so
> it'll work.
>
>>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>>> <gc...@cardaddy.com> wrote:
>>>>
>>>>
>>>> configuration.add(SymbolConstants.HOSTNAME, "localhost");
>>>>         configuration.add(SymbolConstants.HOSTPORT, "8080");
>>>>         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
>
>
> SymbolConstants.HOSTPORT_SECURE receives the HTTPS port number, not whether
> you're using HTTPS or not. I don't think you've actually run your webapp or
> your tests with the configuration above applied, because Tapestry-IoC
> wouldn't be able to coerce "false" into an int.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 20 Jan 2015 19:13:30 -0200, Thiago H de Paula Figueiredo  
<th...@gmail.com> wrote:

> On Tue, 20 Jan 2015 19:03:30 -0200, George Christman  
> <gc...@cardaddy.com> wrote:
>
>> So I just took a look at the tapestry code and I'm not seeing anyway
>> to work around it unless I want to build my own links which I'd rather
>> not do because of my use of the url rewriter.
>>
>> Tap code line 113
>>
>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>
> You should take a look at  
> ComponentEventLinkEncoder.createPageRenderLink, which the Link itself is  
> created.

Which actually uses the BaseURLSource service (default implementation  
source at  
https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BaseURLSourceImpl.java).  
If you correctly set the SymbolConstants.HOSTNAME,  
SymbolConstants.HOSTPORT and SymbolConstants.HOSTPORT_SECURE symbols, it  
won't use the Request, so it'll work.

>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>> <gc...@cardaddy.com> wrote:
>>>
>>> configuration.add(SymbolConstants.HOSTNAME, "localhost");
>>>         configuration.add(SymbolConstants.HOSTPORT, "8080");
>>>         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");

SymbolConstants.HOSTPORT_SECURE receives the HTTPS port number, not  
whether you're using HTTPS or not. I don't think you've actually run your  
webapp or your tests with the configuration above applied, because  
Tapestry-IoC wouldn't be able to coerce "false" into an int.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 20 Jan 2015 19:03:30 -0200, George Christman  
<gc...@cardaddy.com> wrote:

> So I just took a look at the tapestry code and I'm not seeing anyway
> to work around it unless I want to build my own links which I'd rather
> not do because of my use of the url rewriter.
>
> Tap code line 113
>
> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java

You should take a look at ComponentEventLinkEncoder.createPageRenderLink,  
which the Link itself is created.

>
> How do you work around this?
>
> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
> <gc...@cardaddy.com> wrote:
>>  Still no success in getting this to work. I've contributed the  
>> Hostname etc.
>>
>> configuration.add(SymbolConstants.HOSTNAME, "localhost");
>>         configuration.add(SymbolConstants.HOSTPORT, "8080");
>>         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
>>
>> And a simple test which fails with the same error.
>>
>> private void testTask() {
>>         periodicExecutor.addJob(new IntervalSchedule(3000),
>>                 "Data Validation1", new Runnable() {
>>             @Override
>>             public void run() {
>>                 System.out.println("test");
>>                 try {
>>
>> System.out.println(linkSource.createPageRenderLink(Index.class));
>>                 } catch (Exception ex) {
>>                     System.out.println("ex " + ex);
>>                 }
>>             }
>>         });
>>     }
>>
>> On Tue, Jan 20, 2015 at 7:41 AM, George Christman
>> <gc...@cardaddy.com> wrote:
>>> So toAbsolute is the code calling the request and the cause of this
>>> exception? I'm assuming your referring to me contributing those values  
>>> to my
>>> appmodule. Once I contribute those values, would toAbsolute use those  
>>> values
>>> instead of the request? Just trying to understand the issue a little  
>>> bit
>>> better. Thanks Kalle.
>>>
>>> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <ka...@gmail.com>
>>> wrote:
>>>>
>>>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>>>> <gc...@cardaddy.com>
>>>> wrote:
>>>>
>>>> > I'm using T5 beta-25 and I have the following code and I'm noticing
>>>> > when the scheduler fires off my service, my PageRenderLinkSource  
>>>> does
>>>> > not work. If I manually fire it off through the admin with an
>>>> > actionlink, it works without issue.
>>>> > I'm seeing the following exception
>>>> > java.lang.NullPointerException: Unable to delegate method invocation
>>>> > to property 'request' of <Proxy for
>>>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,  
>>>> because
>>>> > the property is null.
>>>> > Any idea why this isn't working?
>>>> >
>>>>
>>>> Naturally, you don't have a request to work with when you are  
>>>> executing
>>>> from a cron job. But if you just want to generate links, you don't  
>>>> need to
>>>> and you shouldn't use the request values. Contribute HOSTNAME,  
>>>> HOSTPORT
>>>> and
>>>> HOSTPORT_SECURE and you can generate absolute urls without resorting  
>>>> to
>>>> reading the values from the request.
>>>>
>>>> Kalle
>>>>
>>>>
>>>>
>>>> >
>>>> >  
>>>> ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>>> >
>>>> >
>>
>>
>>
>> --
>> George Christman
>> CEO
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>
>
>


-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
So I just took a look at the tapestry code and I'm not seeing anyway
to work around it unless I want to build my own links which I'd rather
not do because of my use of the url rewriter.

Tap code line 113

https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java

How do you work around this?

On Tue, Jan 20, 2015 at 11:14 AM, George Christman
<gc...@cardaddy.com> wrote:
>  Still no success in getting this to work. I've contributed the Hostname etc.
>
> configuration.add(SymbolConstants.HOSTNAME, "localhost");
>         configuration.add(SymbolConstants.HOSTPORT, "8080");
>         configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
>
> And a simple test which fails with the same error.
>
> private void testTask() {
>         periodicExecutor.addJob(new IntervalSchedule(3000),
>                 "Data Validation1", new Runnable() {
>             @Override
>             public void run() {
>                 System.out.println("test");
>                 try {
>
> System.out.println(linkSource.createPageRenderLink(Index.class));
>                 } catch (Exception ex) {
>                     System.out.println("ex " + ex);
>                 }
>             }
>         });
>     }
>
> On Tue, Jan 20, 2015 at 7:41 AM, George Christman
> <gc...@cardaddy.com> wrote:
>> So toAbsolute is the code calling the request and the cause of this
>> exception? I'm assuming your referring to me contributing those values to my
>> appmodule. Once I contribute those values, would toAbsolute use those values
>> instead of the request? Just trying to understand the issue a little bit
>> better. Thanks Kalle.
>>
>> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <ka...@gmail.com>
>> wrote:
>>>
>>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>>> <gc...@cardaddy.com>
>>> wrote:
>>>
>>> > I'm using T5 beta-25 and I have the following code and I'm noticing
>>> > when the scheduler fires off my service, my PageRenderLinkSource does
>>> > not work. If I manually fire it off through the admin with an
>>> > actionlink, it works without issue.
>>> > I'm seeing the following exception
>>> > java.lang.NullPointerException: Unable to delegate method invocation
>>> > to property 'request' of <Proxy for
>>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>>> > the property is null.
>>> > Any idea why this isn't working?
>>> >
>>>
>>> Naturally, you don't have a request to work with when you are executing
>>> from a cron job. But if you just want to generate links, you don't need to
>>> and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT
>>> and
>>> HOSTPORT_SECURE and you can generate absolute urls without resorting to
>>> reading the values from the request.
>>>
>>> Kalle
>>>
>>>
>>>
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>> >
>>> >
>
>
>
> --
> George Christman
> CEO
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
 Still no success in getting this to work. I've contributed the Hostname etc.

configuration.add(SymbolConstants.HOSTNAME, "localhost");
        configuration.add(SymbolConstants.HOSTPORT, "8080");
        configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");

And a simple test which fails with the same error.

private void testTask() {
        periodicExecutor.addJob(new IntervalSchedule(3000),
                "Data Validation1", new Runnable() {
            @Override
            public void run() {
                System.out.println("test");
                try {

System.out.println(linkSource.createPageRenderLink(Index.class));
                } catch (Exception ex) {
                    System.out.println("ex " + ex);
                }
            }
        });
    }

On Tue, Jan 20, 2015 at 7:41 AM, George Christman
<gc...@cardaddy.com> wrote:
> So toAbsolute is the code calling the request and the cause of this
> exception? I'm assuming your referring to me contributing those values to my
> appmodule. Once I contribute those values, would toAbsolute use those values
> instead of the request? Just trying to understand the issue a little bit
> better. Thanks Kalle.
>
> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <ka...@gmail.com>
> wrote:
>>
>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> <gc...@cardaddy.com>
>> wrote:
>>
>> > I'm using T5 beta-25 and I have the following code and I'm noticing
>> > when the scheduler fires off my service, my PageRenderLinkSource does
>> > not work. If I manually fire it off through the admin with an
>> > actionlink, it works without issue.
>> > I'm seeing the following exception
>> > java.lang.NullPointerException: Unable to delegate method invocation
>> > to property 'request' of <Proxy for
>> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>> > the property is null.
>> > Any idea why this isn't working?
>> >
>>
>> Naturally, you don't have a request to work with when you are executing
>> from a cron job. But if you just want to generate links, you don't need to
>> and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT
>> and
>> HOSTPORT_SECURE and you can generate absolute urls without resorting to
>> reading the values from the request.
>>
>> Kalle
>>
>>
>>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

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


Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by George Christman <gc...@cardaddy.com>.
So toAbsolute is the code calling the request and the cause of this
exception? I'm assuming your referring to me contributing those values to
my appmodule. Once I contribute those values, would toAbsolute use those
values instead of the request? Just trying to understand the issue a little
bit better. Thanks Kalle.
On Jan 20, 2015 4:44 AM, "Kalle Korhonen" <ka...@gmail.com>
wrote:

> On Tue, Jan 20, 2015 at 1:23 AM, George Christman <gchristman@cardaddy.com
> >
> wrote:
>
> > I'm using T5 beta-25 and I have the following code and I'm noticing
> > when the scheduler fires off my service, my PageRenderLinkSource does
> > not work. If I manually fire it off through the admin with an
> > actionlink, it works without issue.
> > I'm seeing the following exception
> > java.lang.NullPointerException: Unable to delegate method invocation
> > to property 'request' of <Proxy for
> > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
> > the property is null.
> > Any idea why this isn't working?
> >
>
> Naturally, you don't have a request to work with when you are executing
> from a cron job. But if you just want to generate links, you don't need to
> and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT and
> HOSTPORT_SECURE and you can generate absolute urls without resorting to
> reading the values from the request.
>
> Kalle
>
>
>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

Posted by Kalle Korhonen <ka...@gmail.com>.
On Tue, Jan 20, 2015 at 1:23 AM, George Christman <gc...@cardaddy.com>
wrote:

> I'm using T5 beta-25 and I have the following code and I'm noticing
> when the scheduler fires off my service, my PageRenderLinkSource does
> not work. If I manually fire it off through the admin with an
> actionlink, it works without issue.
> I'm seeing the following exception
> java.lang.NullPointerException: Unable to delegate method invocation
> to property 'request' of <Proxy for
> RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
> the property is null.
> Any idea why this isn't working?
>

Naturally, you don't have a request to work with when you are executing
from a cron job. But if you just want to generate links, you don't need to
and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT and
HOSTPORT_SECURE and you can generate absolute urls without resorting to
reading the values from the request.

Kalle



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