You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2015/03/20 14:00:41 UTC
[jira] [Commented] (TAP5-2441) PageRenderLinkSource fails in cron
job
[ https://issues.apache.org/jira/browse/TAP5-2441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14371251#comment-14371251 ]
Jochen Kemnade commented on TAP5-2441:
--------------------------------------
I've got a similar issue with my minification cache warming module. You can work around it by storing a mock request in the {{org.apache.tapestry5.services.RequestGlobals}} service at the start of your job.
> PageRenderLinkSource fails in cron job
> --------------------------------------
>
> Key: TAP5-2441
> URL: https://issues.apache.org/jira/browse/TAP5-2441
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-core
> Affects Versions: 5.4
> Reporter: George Christman
>
> While trying to use PageRenderLinkSource in a cron job failure occurs. It appears as if it doesn't use the base url configurations from the AppModule, but rather the request. The request throws a null pointer.
> How to reproduce.
> AppModule 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 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)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)