I posted on this under server deployment a couple of days ago with no replies (viewtopic.php?f=5&t=13037), so I’m posting here instead as I now think I’ve got a bug, and this is driving me crazy…
I have a web client solution that sends mail using the plugins.mail.sendMail function. The error message generated is: TypeError: Cannot call method “sendMail” of undefined (mail#20), and the function doesn’t execute (the previous post above shows the error log). The problem cropped up after deploying the solution on the production server. While testing it in Developer the solution worked fine. The server is a Linux machine (Ubuntu) running Java 1.6 (Open JDK 1.6.0_0-b14); my development machine is a Mac running 10.5.8 and Apple’s default Java (1.5.0_20-b02-315). Both are running Servoy 4.1.4 build 681. To narrow down what conditions may be causing this I did the following:
Reinstalled a clean copy of Servoy in a different directory on the Linux box - error still occurred.
Turned off https/SSL on the Linux box (this solution is intended as a web app to run over https) - error still occurred.
Installed the solution on a test server (another Mac w/ Java 1.5) - tested both web client and smart client, solution ran fine with no errors in both (Hmm…)
Tested the solution using the Smart Client on the Linux machine - solution worked in Smart Client with no errors (double hmm…)
The only differences I can discern (assuming the OS’s can’t be the problem) are the Java versions. The solution under web client works with Java 1.5 but not Java 1.6 (at least the OpenJDK version), whereas the Smart Client works on either machine and either Java versions. Is this weird or what?
I tried to confirm this by turning on Java 1.6 on the Mac, but even though I set this up under preferences, and it shows it’s using Java 1.6 when I type the java -version command in the terminal, the Servoy server still shows it’s running Java 1.5. Can anyone show me how to get another Java version to stick on the Mac? If I can get the web client to fail on a Mac with 1.6, then maybe I can be confident that’s the issue
I can reproduce this problem on my machines with a very small sample solution that I’ve attached for anyone interested to test.
I’m starting to get desperate. I’m building this little application as a favor for a local charity I’m involved with and I need to get it up for real world testing in the next week. Smart client is not an option, I need it to send emails, and I’m pretty much stuck with the Linux machine to serve the solution - so I don’t have a Plan B as yet. I don’t have control over the Linux server, but I could probably get them to install a different version of Java on it or do any other tweaks necessary - but I need to confirm that whatever I ask them to do will fix the problem before I do so.
Can anyone discern what’s going on and suggest a fix? Thanks!
org.mozilla.javascript.EcmaError: TypeError: Cannot call method “sendMail” of undefined
this means that the plugin really isnt there. So it is not that there is a problem with the sendMail method or something but the plugin itself cant be found.
So somehow it seems to be a problem with the mailplugin.jar that cant be read in correctly (maybe some user rights?)
or it cant be loaded it somehow, but that should be able to see that in the logging.
Thanks for looking into this. I understand that the mail plugin does not appear to be loading (in fact, I’m not sure any of the plugins are loading), but I don’t understand what the cause might be. The plugins are present in the installation.
Last night I cleared the server.log and servoy_log.txt files in the application_server directory and restarted the server and then ran the testMail program I attached in my last post - which failed in execution. The contents of the server.log file is:
Sep 27, 2009 10:25:28 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 27, 2009 10:25:28 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8443
Sep 27, 2009 10:25:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1486 ms
Sep 27, 2009 10:25:28 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 27, 2009 10:25:28 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0-snapshot
Sep 27, 2009 10:25:29 PM org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/resources/web-app_2_5.xsd
Sep 27, 2009 10:25:35 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 27, 2009 10:25:35 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8443
Sep 27, 2009 10:25:35 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6611 ms
The content of the servoy_log.txt file (which can also be seen in the admin app is:
2009-09-27 22:55:56,599 ERROR [http-8443-2] com.servoy.j2db.util.Debug - TypeError: Cannot call method “sendMail” of undefined (doMail#23)
2009-09-27 22:55:56,611 ERROR [http-8443-2] com.servoy.j2db.util.Debug - Throwable
org.mozilla.javascript.EcmaError: TypeError: Cannot call method “sendMail” of undefined (doMail#23)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3653)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3647)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3658)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3676)
at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3695)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2115)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3481)
at script.doMail(doMail:23)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2680)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:166)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3125)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:126)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:70)
at com.servoy.j2db.FormController.Za(FormController.java:178)
at com.servoy.j2db.FormController.executeFunction(FormController.java:1115)
at com.servoy.j2db.Zhb.Za(Zhb.java:8)
at com.servoy.j2db.server.headlessclient.dataui.WebEventExecutor.fireActionCommand(WebEventExecutor.java:131)
at com.servoy.j2db.server.headlessclient.dataui.WebEventExecutor.onEvent(WebEventExecutor.java:77)
at com.servoy.j2db.server.headlessclient.dataui.Zic.onEvent(Zic.java:10)
at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:163)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:297)
at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:104)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1239)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1316)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1418)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:532)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:356)
at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:636)
I can’t see anything here that suggests that the plug-ins haven’t loaded. Also how do you explain the sendMail call functioning correctly in smart client using the same server and machine? Is there another log file I should be looking at?
As regards user rights - the application is installed in /usr/local/servoy - owned by user servoy. The respository and data database is MySQL on the same machine. User servoy also has full rights to those databases. So I’m not sure where there may be a permissions problem. I’m not a Linux expert, so if there’s someplace you can point me to to look, that would be appreciated…
While I don’t understand what’s going on under the hood, the problem apparently arises with Ubuntu and the OpenJDK that was installed on this machine (I believe that is the default JDK with Ubuntu. This issue apparently has come up before, but in the context of developer, which I was not running on this machine (except once at setup to configure the databases), so it wasn’t clear that I was experiencing the same problem. See these posts:
The solution is to install Sun Java. When I did so, the web client was able to load the plugins (which it apparently could not see with openJDK) and function properly.