|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
evaluating simple string "2 == 2"Hi folks:
How can I evaluate the string "2 == 2" in a java program. Is it possible? I did the following but it is throwing ClassNotFound exception BSFManager manager = new org.apache.bsf.BSFManager(); Object o = manager.eval("","",0,0,"2==2"); return o.toString(); Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.bsf.BSFManager.<init>(BSFManager.java:102) at EvaluatorB.Evaluate(EvaluatorB.java:13) at Evaluator.main(Evaluator.java:8) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 3 more I think I am missing some configuration file. Can someone please point me to the right direction? Thanks -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- |
|
|
Re: evaluating simple string "2 == 2"Hi Raza,
Raza, Rizwan (MLCI) wrote: > Hi folks: > > How can I evaluate the string "2 == 2" in a java program. Is it > possible? > > I did the following but it is throwing ClassNotFound exception > > BSFManager manager = new org.apache.bsf.BSFManager(); > > Object o = manager.eval("","",0,0,"2==2"); > > return o.toString(); > the first argument. HTH, ---rony --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
|
|
Re: evaluating simple string "2 == 2"Hi Raza,
also, make sure that the Java statement is syntactically correct. In your example you obviously want to execute the following Java statement: "return (2==2);". Hence your eval invocation should probably read: Object o = manager.eval("java","",0,0,"return (2==2);"); HTH, ---rony Raza, Rizwan (MLCI) wrote: > Hi folks: > > > > How can I evaluate the string "2 == 2" in a java program. Is it > possible? > > > > I did the following but it is throwing ClassNotFound exception > > > > BSFManager manager = new org.apache.bsf.BSFManager(); > > Object o = manager.eval("","",0,0,"2==2"); > > return o.toString(); > > > > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/logging/LogFactory > > at org.apache.bsf.BSFManager.<init>(BSFManager.java:102) > > at EvaluatorB.Evaluate(EvaluatorB.java:13) > > at Evaluator.main(Evaluator.java:8) > > Caused by: java.lang.ClassNotFoundException: > org.apache.commons.logging.LogFactory > > at java.net.URLClassLoader$1.run(Unknown Source) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClassInternal(Unknown Source) > > ... 3 more > > > > I think I am missing some configuration file. Can someone please point > me to the right direction? > > > --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
|
|
RE: evaluating simple string "2 == 2"Thanks Rony for replying. I did the changes but still getting the
following exception. Do I have to configure (provide path) to some log file somewhere? Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.bsf.BSFManager.<init>(BSFManager.java:102) at EvaluatorB.Evaluate(EvaluatorB.java:13) at Evaluator.main(Evaluator.java:8) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 3 more Below is my program import org.apache.*; import org.apache.bsf.*; public class EvaluatorB { public EvaluatorB() { } public Object Evaluate(){ Object o = null; try{ BSFManager manager = new org.apache.bsf.BSFManager(); o = manager.eval("java","",0,0,"return (2==2);"); } catch(BSFException exc) { String s = exc.toString(); System.out.println(s); } return o; } } -----Original Message----- From: Rony G. Flatscher [mailto:Rony.Flatscher@...] Sent: Wednesday, October 15, 2008 3:57 AM To: Bean Scripting Framework users Subject: Re: evaluating simple string "2 == 2" Hi Raza, also, make sure that the Java statement is syntactically correct. In your example you obviously want to execute the following Java statement: "return (2==2);". Hence your eval invocation should probably read: Object o = manager.eval("java","",0,0,"return (2==2);"); HTH, ---rony Raza, Rizwan (MLCI) wrote: > Hi folks: > > > > How can I evaluate the string "2 == 2" in a java program. Is it > possible? > > > > I did the following but it is throwing ClassNotFound exception > > > > BSFManager manager = new org.apache.bsf.BSFManager(); > > Object o = manager.eval("","",0,0,"2==2"); > > return o.toString(); > > > > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/logging/LogFactory > > at org.apache.bsf.BSFManager.<init>(BSFManager.java:102) > > at EvaluatorB.Evaluate(EvaluatorB.java:13) > > at Evaluator.main(Evaluator.java:8) > > Caused by: java.lang.ClassNotFoundException: > org.apache.commons.logging.LogFactory > > at java.net.URLClassLoader$1.run(Unknown Source) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClassInternal(Unknown Source) > > ... 3 more > > > > I think I am missing some configuration file. Can someone please point > me to the right direction? > > > --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
|
|
RE: evaluating simple string "2 == 2"I guess it is failing at the following code location in BSFManager.java
private Log logger = LogFactory.getLog(this.getClass().getName()); Thanks - raza -----Original Message----- From: Rony G. Flatscher [mailto:Rony.Flatscher@...] Sent: Wednesday, October 15, 2008 3:57 AM To: Bean Scripting Framework users Subject: Re: evaluating simple string "2 == 2" Hi Raza, also, make sure that the Java statement is syntactically correct. In your example you obviously want to execute the following Java statement: "return (2==2);". Hence your eval invocation should probably read: Object o = manager.eval("java","",0,0,"return (2==2);"); HTH, ---rony Raza, Rizwan (MLCI) wrote: > Hi folks: > > > > How can I evaluate the string "2 == 2" in a java program. Is it > possible? > > > > I did the following but it is throwing ClassNotFound exception > > > > BSFManager manager = new org.apache.bsf.BSFManager(); > > Object o = manager.eval("","",0,0,"2==2"); > > return o.toString(); > > > > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/logging/LogFactory > > at org.apache.bsf.BSFManager.<init>(BSFManager.java:102) > > at EvaluatorB.Evaluate(EvaluatorB.java:13) > > at Evaluator.main(Evaluator.java:8) > > Caused by: java.lang.ClassNotFoundException: > org.apache.commons.logging.LogFactory > > at java.net.URLClassLoader$1.run(Unknown Source) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClass(Unknown Source) > > at java.lang.ClassLoader.loadClassInternal(Unknown Source) > > ... 3 more > > > > I think I am missing some configuration file. Can someone please point > me to the right direction? > > > --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
|
|
Re: evaluating simple string "2 == 2"Raza, Rizwan (MLCI) wrote:
> Thanks Rony for replying. I did the changes but still getting the > following exception. Do I have to configure (provide path) to some log > file somewhere? > You have to provide Apache Commons which you can download from Apache. It's apparently not in your classpath, or at least, not the right level thereof. > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/logging/LogFactory > See? --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
|
|
RE: evaluating simple string "2 == 2"Thanks. Ok I got that so that problem is gone but now it is complaining
for org.apache.bsf.engines.java.JavaEngine. I do not think that the bsf 2.4.0 jar that I am using has JavaEngine in it. Am I using an obsolete version? Oct 15, 2008 10:45:14 AM org.apache.bsf.BSFManager loadScriptingEngine SEVERE: Exception : java.lang.ClassNotFoundException: org.apache.bsf.engines.java.JavaEngine at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.apache.bsf.BSFManager.loadScriptingEngine(BSFManager.java:693) at org.apache.bsf.BSFManager.eval(BSFManager.java:435) at EvaluatorB.Evaluate(EvaluatorB.java:18) at Evaluator.main(Evaluator.java:7) Exception in thread "main" java.lang.NullPointerException at Evaluator.main(Evaluator.java:8) org.apache.bsf.BSFException: unable to load language: java Below is the code. import org.apache.*; import org.apache.bsf.*; import org.apache.commons.*; import org.apache.commons.logging.*; import org.apache.bsf.engines.*; public class EvaluatorB { public EvaluatorB() { } public Object Evaluate(){ Object o = null; try{ BSFManager manager = new org.apache.bsf.BSFManager(); o = manager.eval("java","",0,0,"return (2==2);"); } catch(BSFException exc) { String s = exc.toString(); System.out.println(s); } return o; } } -----Original Message----- From: Jack J. Woehr [mailto:jwoehr@...] Sent: Wednesday, October 15, 2008 10:33 AM To: Bean Scripting Framework users Subject: Re: evaluating simple string "2 == 2" Raza, Rizwan (MLCI) wrote: > Thanks Rony for replying. I did the changes but still getting the > following exception. Do I have to configure (provide path) to some log > file somewhere? > You have to provide Apache Commons which you can download from Apache. It's apparently not in your classpath, or at least, not the right level thereof. > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/logging/LogFactory > See? --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
|
|
Re: evaluating simple string "2 == 2"Raza, Rizwan (MLCI) wrote:
> Thanks. Ok I got that so that problem is gone but now it is complaining > for > org.apache.bsf.engines.java.JavaEngine. I do not think that the bsf > 2.4.0 jar that I am using has JavaEngine in it. Am I using an obsolete > version? > No. But you may be missing some stuff. BSF is a framework. The Engines link into the Framework. Suggestion: sit down and read the BSF documentation for an hour or two :) Page 1 of the BSF manual <http://jakarta.apache.org/bsf/manual.html>says: The two primary components of BSF are the |BSFManager| and the |BSFEngine|. The |BSFManager| handles all scripting execution engines running under its control, and maintains the object registry that permits scripts access to Java objects. By creating an instance of the |BSFManager| class, a Java application can gain access to scripting services. The |BSFEngine| provides an interface that must be implemented for a language to be used by BSF ... |
|
|
Re: evaluating simple string "2 == 2"Hi Raza,
firstly, Jack is right, of course, there needs to be a Logger utility. However, BSF 2.4 is supposed to be delivered with a minimal Logger named "BSF_Log" (with "BSF_LogFactory"), but this class is not part of the official BSF 2.4 binary distribution <http://gd.tuwien.ac.at/infosys/servers/http/apache/dist/jakarta/bsf/binaries/bsf-bin-2.4.0.zip>. The purpose of it would be to have the logging facility operational, even if you would not have any other logging facilitiy at hand; not distributing it, of course, is countering the (good) intention... In the meantime Jack's advice will help you. Regards, ---rony Jack J. Woehr wrote: > Raza, Rizwan (MLCI) wrote: >> Thanks Rony for replying. I did the changes but still getting the >> following exception. Do I have to configure (provide path) to some log >> file somewhere? >> > You have to provide Apache Commons which you can download from Apache. > It's apparently not in your classpath, or at least, not the right > level thereof. >> Exception in thread "main" java.lang.NoClassDefFoundError: >> org/apache/commons/logging/LogFactory >> > See? > --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
|
|
Missing java engine et.al (Re: evaluating simple string "2 == 2"Hi Raza,
Raza, Rizwan (MLCI) wrote: > Thanks. Ok I got that so that problem is gone but now it is complaining > for > org.apache.bsf.engines.java.JavaEngine. I do not think that the bsf > 2.4.0 jar that I am using has JavaEngine in it. Am I using an obsolete > version? > No, not really. Supposedly the "java" and "javaclass" engines, as their source is in the BSF 2.4 archive, should be built and distributed with BSF 2.4 (as well as the "jexl" engine). Looking at the engines in the current distribution <http://gd.tuwien.ac.at/infosys/servers/http/apache/dist/jakarta/bsf/binaries/bsf-bin-2.4.0.zip> reveals the following engines are already part of it: "jacl", "javascript", "jython", "netrexx", and "xslt". Please open a JIRA issue for this (as well as for the missing "BSF_Log" and "BSF_LogFactory"). --- In the meantime, you can get a binary distribution with all BSF engines for BSF 2.4 (as well as a slightly advanced version of BSF 2.4) from <http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/current/BSF4Rexx_install.zip>. After unpacking that zip-archive, you will find a jar-file named "bsf-v244-20080704.jar". Just replace the official BSF 2.4 with that version (which contains all official engines as well as "BSF_Log" and "BSF_LogFactory"). HTH, ---rony P.S.: Will become able to (finally!) start to tackle all open BSF-JIRA issues in the next weeks, such that I would be able to go over these two JIRA issues of yours as well. --------------------------------------------------------------------- To unsubscribe, e-mail: bsf-user-unsubscribe@... For additional commands, e-mail: bsf-user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |