You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bsf-dev@jakarta.apache.org by bu...@apache.org on 2004/09/08 08:19:03 UTC
DO NOT REPLY [Bug 31109] New: -
Exception happens whenever calling declareBean()
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31109>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=31109
Exception happens whenever calling declareBean()
Summary: Exception happens whenever calling declareBean()
Product: BSF
Version: 2.3.0-rc1
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: framework
AssignedTo: bsf-dev@jakarta.apache.org
ReportedBy: thomas.tsoi@gmail.com
CC: thomas.tsoi@gmail.com
The detail stack is shown as following:
java.lang.RuntimeException: No Context associated with current Thread
at org.mozilla.javascript.Context.getContext(Context.java:1927)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:493)
at org.mozilla.javascript.Context.toObject(Context.java:1215)
at org.apache.bsf.engines.javascript.JavaScriptEngine.declareBean
(Unknown Source)
at org.apache.bsf.BSFManager.declareBean(Unknown Source)
at com.hsbc.cad.ris.ScriptEngine.main(ScriptEngine.java:23)
Exception in thread "main"
Actually, I have tried the "ScriptEngine" in two environment.
One in standalone which I run the ScriptEngine from command prompt
Another environment is to run the ScriptEngine under web server (WSAD 5.1).
I have the above exception in the standalone environment, exception shown as
above. But happy to run in the web environment.
Is there any environment setting for the BSF to run normally in standalone
environment? Thanks
PS: ScriptEngine.java
public class ScriptEngine {
public static void main(String args[]) throws Exception {
BSFManager mgr = new BSFManager();
BSFEngine engine = mgr.loadScriptingEngine("javascript");
OrderBaseDTO dto = new OrderBaseDTO();
engine.initialize(mgr, "javascript", new Vector());
mgr.declareBean("dto", dto, dto.getClass());
Object result = engine.eval("aaabbb", 0, 0, args[0]);
System.out.println(result);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org