cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruyn Bill" <Bru...@mcao.maricopa.gov>
Subject Flowscript w/ Spring-managed service layer
Date Thu, 26 Jan 2006 18:47:47 GMT
I get the following error when I try to invoke methods on a POJO proxied
for Spring-managed transactions:
  
  org.mozilla.javascript.EcmaError: selectListOptionsByName is not a
function.

Which, based on best-guess and a little Googling, seems to indicate that
the interpreter is looking for a javascript function to execute instead
of my method?  Note that if I change the lookup from my proxied object
to its target (from serviceFacade to serviceFacadeTarget), all works as
advertised (except I'm using the unwrapped bean now).  I've checked my
setup against doc and samples, and I just don't see anything wrong with
it...

Java 1.5
Spring 1.2.5
iBATIS 2.1.5
CGLIB 2.1.2
Cocoon 2.1.8
Tomcat 5.5.9

WinXP 5.1/SP2


Many, many TIA for thoughts/feedback/links to relevant doc, etc.


Bill
------------------------------
applicationContext.xml
------------------------------
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
>
    <property name="dataSource" ref="dataSource"/>
</bean>

<bean id="serviceFacadeTarget"
class="gov.maricopa.mcao.drugfreeaz.treatment.ServiceFacade">
    <property name="sqlMapClient" ref="sqlMapClient"/>
    <property name="providerDAO" ref="providerDAO"/>
    <property name="listOptionDAO" ref="listOptionDAO"/>
    <property name="listSelectionDAO" ref="listSelectionDAO"/>
</bean>

<bean id="serviceFacade"
class="org.springframework.transaction.interceptor.TransactionProxyFacto
ryBean">
    <property name="transactionManager">
        <ref bean="transactionManager"/>
    </property>
    <property name="target">
        <ref bean="serviceFacadeTarget"/>
    </property>
    <property name="transactionAttributes">
        <props>
            <prop key="*">PROPAGATION_REQUIRED</prop>
        </props>
    </property>
</bean>

------------------------------
Console output
------------------------------
2006-01-26 11:32:29,984 INFO
[org.springframework.web.context.ContextLoader] - R
oot WebApplicationContext: initialization started
2006-01-26 11:32:29,984 INFO
[org.apache.catalina.core.ContainerBase.[Catalina].
[localhost].[/drugfreeaz]] - Loading Spring root WebApplicationContext
2006-01-26 11:32:30,531 INFO
[org.springframework.beans.factory.xml.XmlBeanDefin
itionReader] - Loading XML bean definitions from ServletContext resource
[/WEB-I
NF/applicationContext.xml]
2006-01-26 11:32:31,000 INFO
[org.springframework.web.context.support.XmlWebAppl
icationContext] - Bean factory for application context [Root
WebApplicationConte
xt]:
org.springframework.beans.factory.support.DefaultListableBeanFactory
defini
ng beans
[dataSource,transactionManager,sqlMapClient,providerDAO,listSelectionDA
O,listOptionDAO,serviceFacadeTarget,serviceFacade]; root of BeanFactory
hierarch
y
2006-01-26 11:32:31,031 INFO
[org.springframework.web.context.support.XmlWebAppl
icationContext] - 8 beans defined in application context [Root
WebApplicationCon
text]
2006-01-26 11:32:31,046 INFO
[org.springframework.core.CollectionFactory] - JDK
1.4+ collections available
2006-01-26 11:32:31,062 INFO
[org.springframework.core.CollectionFactory] - Comm
ons Collections 3.x available
2006-01-26 11:32:31,078 INFO
[org.springframework.web.context.support.XmlWebAppl
icationContext] - Unable to locate MessageSource with name
'messageSource': usin
g default
[org.springframework.context.support.DelegatingMessageSource@349471]
2006-01-26 11:32:31,078 INFO
[org.springframework.web.context.support.XmlWebAppl
icationContext] - Unable to locate ApplicationEventMulticaster with name
'applic
ationEventMulticaster': using default
[org.springframework.context.event.SimpleA
pplicationEventMulticaster@a98932]
2006-01-26 11:32:31,093 INFO
[org.springframework.ui.context.support.UiApplicati
onContextUtils] - Unable to locate ThemeSource with name 'themeSource':
using de
fault
[org.springframework.ui.context.support.ResourceBundleThemeSource@ab444]
2006-01-26 11:32:31,093 INFO
[org.springframework.beans.factory.support.DefaultL
istableBeanFactory] - Pre-instantiating singletons in factory
[org.springframewo
rk.beans.factory.support.DefaultListableBeanFactory defining beans
[dataSource,t
ransactionManager,sqlMapClient,providerDAO,listSelectionDAO,listOptionDA
O,servic
eFacadeTarget,serviceFacade]; root of BeanFactory hierarchy]
2006-01-26 11:32:32,125 INFO
[org.springframework.aop.framework.DefaultAopProxyF
actory] - CGLIB2 available: proxyTargetClass feature enabled
2006-01-26 11:32:32,250 INFO
[org.springframework.web.context.ContextLoader] - U
sing context class
[org.springframework.web.context.support.XmlWebApplicationCon
text] for root WebApplicationContext
2006-01-26 11:32:32,250 INFO
[org.springframework.web.context.ContextLoader] - R
oot WebApplicationContext: initialization completed in 2266 ms


------------------------------
Flowscript (induce error condition)
------------------------------

var spring =
cocoon.context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_C
ONTEXT_ATTRIBUTE);
var facade = spring.getBean("serviceFacade");

var substanceList = facade.selectListOptionsByName("substance");

-------------------------------
Cocoon stack trace
-------------------------------
selectListOptionsByName is not a function.
file:/C:/Program
Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatment/flow/main.js -
9:0	TypeError

Error calling flowscript function foo
file:/C:/Program
Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatment/flow/main.js -
9:0	[EcmaError]
file:/C:/Program
Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatment/flow/main.js -
9:-1	
file:/C:/Program%20Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatme
nt/sitemap.xmap - 78:31	<map:call>
file:/C:/Program%20Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/sitemap
.xmap - 662:66	<map:mount>

-------------------------------
Java stack trace
-------------------------------
org.apache.cocoon.ProcessingException: Error calling flowscript function
foo
	at [EcmaError] - file:/C:/Program
Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatment/flow/main.js:9:0
	at file:/C:/Program
Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatment/flow/main.js:9:-
1
	at <map:call> -
file:/C:/Program%20Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatme
nt/sitemap.xmap:78:31
	at <map:mount> -
file:/C:/Program%20Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/sitemap
.xmap:662:66
	at
org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.j
ava:144)
	at
org.apache.cocoon.components.flow.javascript.LocationTrackingDebugger.ge
tException(LocationTrackingDebugger.java:132)
	at
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpret
er.callFunction(FOM_JavaScriptInterpreter.java:771)
	at
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invo
ke(CallFunctionNode.java:138)
	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:46)
	at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i
nvoke(PreparableMatchNode.java:130)
	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:68)
	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P
ipelineNode.java:142)
	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:68)
	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:92)
	at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:234)
	at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:176)
	at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:248)
	at
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(Moun
tNode.java:117)
	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:46)
	at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i
nvoke(PreparableMatchNode.java:130)
	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:68)
	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P
ipelineNode.java:142)
	at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:68)
	at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:92)
	at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:234)
	at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:176)
	at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:248)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:679)
	at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:85
6)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:744)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)
	at java.lang.Thread.run(Thread.java:595)
Caused by: TypeError: selectListOptionsByName is not a function.
(file:/C:/Program
Files/jakarta-tomcat-5.5.9/webapps/drugfreeaz/treatment/flow/main.js;
line 9)
	at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:581
)
	at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:541
)
	at
org.mozilla.javascript.NativeGlobal.typeError1(NativeGlobal.java:551)
	at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1234)
	at
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(C
ontinuationInterpreter.java:1134)
	at
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(C
ontinuationInterpreter.java:190)
	at
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(C
ontinuationInterpreter.java:138)
	at
org.mozilla.javascript.continuations.InterpretedScriptImpl.call(Interpre
tedScriptImpl.java:137)
	at
org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:59)
	at
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpret
er.setupContext(FOM_JavaScriptInterpreter.java:612)
	at
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpret
er.callFunction(FOM_JavaScriptInterpreter.java:718)
	... 37 more


Bill Bruyn




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


Mime
View raw message