Error when creating objects within a CFTHREAD

34 views
Skip to first unread message

Daniel Rosewarne

unread,
Mar 8, 2011, 7:21:25 PM3/8/11
to Railo
Hi,

I'm getting a strange error when trying to create objects within a
cfthread.

The thread is started within a CFC, then within the thread a number of
other CFC are called. All CFCs are in the same location (/com/) and
the objects are creating using the following syntax:

var objLog = createObject("component", "com.log").init( dsn =
attributes.dsn );

This throws the following error:

Struct
additional
Struct
Cause
string java.util.NoSuchElementException
Detail
string
ErrorCode
string 0
ExtendedInfo
string
Message
string java.util.NoSuchElementException
StackTrace
string java.util.NoSuchElementException at
java.util.LinkedList.getLast(Unknown Source):-1 at
railo.runtime.PageContextImpl.getCurrentPageSource(PageContextImpl.java:
928):928 at
railo.runtime.component.ComponentLoader.load(ComponentLoader.java:51):
51 at
railo.runtime.component.ComponentLoader.loadComponentImpl(ComponentLoader.java:
33):33 at
railo.runtime.PageContextImpl.loadComponent(PageContextImpl.java:2629):
2629 at
railo.runtime.functions.other.CreateObject.doComponent(CreateObject.java:
135):135 at railo.runtime.tag.ObjectTag.doStartTag(ObjectTag.java:127):
127 at com.run_cfc$cf.threadCall(/var/www/www.testrunnr.com/com/
run.cfc:291):291 at
railo.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:166):
166 at
railo.runtime.thread.ChildSpoolerTask.execute(ChildSpoolerTask.java:
29):29 at
railo.runtime.spooler.SpoolerTaskSupport._execute(SpoolerTaskSupport.java:
72):72 at
railo.runtime.spooler.SpoolerEngineImpl.execute(SpoolerEngineImpl.java:
546):546 at railo.runtime.spooler.SpoolerEngineImpl
$TaskThread.run(SpoolerEngineImpl.java:471):471 at
railo.runtime.op.Caster.toPageException(Caster.java:2987):2987 at
com.run_cfc$cf.threadCall(/var/www/www.testrunnr.com/com/run.cfc:291):
291 at
railo.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:166):
166 at
railo.runtime.thread.ChildSpoolerTask.execute(ChildSpoolerTask.java:
29):29 at
railo.runtime.spooler.SpoolerTaskSupport._execute(SpoolerTaskSupport.java:
72):72 at
railo.runtime.spooler.SpoolerEngineImpl.execute(SpoolerEngineImpl.java:
546):546 at railo.runtime.spooler.SpoolerEngineImpl
$TaskThread.run(SpoolerEngineImpl.java:471):471

Any ideas?

Thanks,
Dan

Josh Nathanson

unread,
Mar 8, 2011, 7:54:43 PM3/8/11
to ra...@googlegroups.com
Daniel, how are you passing attributes.dsn through from the calling page into the thread?

Some scopes that may exist on the calling page will not be available within the spawned thread.

Generally you have to do something like this:
<cfthread name="foo" dsn="#attributes.dsn#">

Then attributes.dsn will be available within the thread.

Not sure if that's the problem but it's worth a try.

-- Josh

Daniel Rosewarne

unread,
Mar 8, 2011, 8:00:21 PM3/8/11
to Railo
Hi Josh,

Thanks for the quick reply. Sorry, I should have mentioned that in the
message, the dsn is passed from outside of thread and is available as
an attribute. I've tested that by debugging it and also by hardcoding
the DSN to see if it's a problem.

It seems that it something to do with the com.log mapping (which is
just a /com/ folder in the root), although outside of the thread all
of the components work fine.

Thanks,
Dan

On Mar 9, 12:54 am, Josh Nathanson <joshnathan...@gmail.com> wrote:
> Daniel, how are you passing attributes.dsn through from the calling page
> into the thread?
>
> Some scopes that may exist on the calling page will not be available within
> the spawned thread.
>
> Generally you have to do something like this:
> <cfthread name="foo" dsn="#attributes.dsn#">
>
> Then attributes.dsn will be available within the thread.
>
> Not sure if that's the problem but it's worth a try.
>
> -- Josh
>
> On Tue, Mar 8, 2011 at 4:21 PM, Daniel Rosewarne <danielrosewar...@gmail.com
Reply all
Reply to author
Forward
0 new messages