Trying to implement com.smartgwt.client.docs.serverds.Mail to trigger an e-mail send after a record gets added to a DataSource.
First I did some basic test code that adds records to a DataSource:
This code works fine, new records are added without error, the ListGrid refreshes, etc.
Next, I add the XML-declarative Mail element in the DS.xml file:
In server.properties, I define the mail server settings:
I am able to send a test message by Telnet SMTP session, using this server info.
Error occurs when I click the IButton to insert a record. First I get an IE pop-up alert message:
The GWT Dev Mode console shows a bunch of these errors:
The Smart GWT Results tab shows the following:
So what am I missing? Any advice appreciated, thanks.
Using:
■ IE7
■ WinXP
■ Eclipse 3.6
■ GWT 2.2
■ SGWT 2.4 (eval)
First I did some basic test code that adds records to a DataSource:
Code:
public class EmailTest implements EntryPoint { ListGrid itGrid = new ListGrid(); Record insertRecord = new Record(); IButton iButton = new IButton(); public void onModuleLoad() { Canvas canvas = new Canvas(); DataSource requests = DataSource.getDataSource("REQUESTS"); itGrid.setDataSource(requests); insertRecord.setAttribute("EMPLOYEE_ID", "12345"); Date date = new Date(); insertRecord.setAttribute("SUBMITDATE",date); insertRecord.setAttribute("STATUS", "something"); itGrid.setAutoFetchData(true); iButton.setTitle("Add Record"); iButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { itGrid.addData(insertRecord); } }); canvas.addChild(itGrid); canvas.addChild(iButton); canvas.draw(); } }
Next, I add the XML-declarative Mail element in the DS.xml file:
Code:
<DataSource schema="mySchema" dbName="dbTest01" tableName="REQUESTS" ID="REQUESTS" dataSourceVersion="1" generatedBy="SC_SNAPSHOT-2011-01-06/EVAL Deployment 2011-01-06" serverType="sql" > <operationBindings> <operationBinding operationType="add"> <mail to="myEmail@testdomain.com" from="myEmail@testdomain.com" replyTo="myEmail@testdomain.com" subject="Test E-mail" messageTemplate="Body text here."/> </operationBinding> </operationBindings> <fields> <field primaryKey="true" name="REQUEST_ID" type="sequence"></field> <field name="EMPLOYEE_ID" type="number"></field> <field name="STARTDATE" type="date"></field> <field name="ENDDATE" type="date"></field> <field name="LEAVETYPE" length="30" type="text"></field> <field name="SUBMITDATE" type="date"></field> <field name="APPROVALDATE" type="date"></field> <field name="STATUS" length="30" type="text"></field> </fields> </DataSource>
Code:
mail.system.mail.smtp.host: mySMTPhostname mail.system.mail.smtp.port: 25 mail.system.mail.smtp.auth: false mail.system.mail.smtp.user: mail.system.mail.smtp.password: mail.system.mail.smtp.connectiontimeout: 2000 mail.templateRoot: $webRoot/config/mailTemplates mail.systemFromAddress: myEmail@testdomain.com mail.helpdeskAddress: myEmail@testdomain.com mail.URLPrefix: http://www.testdomain.com
Error occurs when I click the IButton to insert a record. First I get an IE pop-up alert message:
Code:
Uncaught exception escaped : java.lang.ClassCastException null See the Development console log for details. Register a GWT.setUncaughtExceptionHandler(...) for custom uncaught exception handling. OK
Code:
00:00:00.000 [ERROR] Uncaught exception escaped java.lang.ClassCastException: null at java.lang.Class.cast(Unknown Source) at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:166) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:65) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214) at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Unknown Source)
Code:
16:17:22.300:WARN:Page:NOTE: isc.Page.getWidth() called before <BODY> tag was written out -- value cannot be determined. Returning 500 16:17:22.300:WARN:Page:NOTE: isc.Page.getHeight() called before <BODY> tag was written out -- value cannot be determined. Returning 500 16:17:22.409:WARN:AutoObserver:Use addInterfaceProperties() to add methods to interface [Class AutoObserver] 16:17:49.910:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP 16:17:49.910:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Finding Records that match your criteria... 16:17:50.066:INFO:RPCManager:sendQueue[0]: 1 RPCRequest(s); transport: xmlHttpRequest; target: http://127.0.0.1:8888/builtinds/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-01-06&isc_xhr=1&isc_tnum=0 16:17:50.082:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP 16:17:50.082:DEBUG:RPCManager:XMLHttpRequest POST to http://127.0.0.1:8888/builtinds/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-01-06&isc_xhr=1&isc_tnum=0 contentType: application/x-www-form-urlencoded; charset=UTF-8 with body -->_transaction=<transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">0</transactionNum><operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><criteria xsi:type="xsd:Object"></criteria><operationConfig xsi:type="xsd:Object"><dataSource>REQUESTS</dataSource><operationType>fetch</operationType><textMatchStyle>substring</textMatchStyle></operationConfig><startRow xsi:type="xsd:long">0</startRow><endRow xsi:type="xsd:long">75</endRow><sortBy xsi:type="xsd:List"><elem>REQUEST_ID</elem></sortBy><componentId>isc_ListGrid_0</componentId><appID>builtinApplication</appID><operation>REQUESTS_fetch</operation><oldValues xsi:type="xsd:Object"></oldValues></elem></operations></transaction>&protocolVersion=1.0<-- 16:17:51.332:XRP8:INFO:RPCManager:transaction 0 arrived after 1266ms 16:17:51.332:XRP8:DEBUG:RPCManager:Result string for transaction 0: "//isc_RPCResponseStart-->[{endRow:4,queueStatus:0,totalRows:4,isDSResponse:true,invalidateCache:false,status:0,startRow:0,data:[{REQUEST_ID:51,EMPLOYEE_ID:38289},{SUBMITDATE:Date.parseServerDate(2011,4,16),STATUS:"something",REQUEST_ID:138,EMPLOYEE_ID:38289},{SUBMITDATE:Date.parseServerDate(2011,4,16),STATUS:"something",REQUEST_ID:139,EMPLOYEE_ID:38289},{SUBMITDATE:Date.parseServerDate(2011,4,16),STATUS:"something",REQUEST_ID:140,EMPLOYEE_ID:38289}]}]//isc_RPCResponseEnd" 16:17:51.332:XRP8:INFO:RPCManager:rpcResponse(REQUESTS_fetch)[fetch]: result: 4 records[status=0] 16:17:51.754:RDQ0:DEBUG:ListGrid:isc_ListGrid_0:delaying adjustOverflow: childResized 16:18:57.755:MUP7:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP 16:18:57.770:MUP7:INFO:RPCManager:sendQueue[1]: 1 RPCRequest(s); transport: xmlHttpRequest; target: http://127.0.0.1:8888/builtinds/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-01-06&isc_xhr=1&isc_tnum=1 16:18:57.786:MUP7:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP 16:18:57.802:MUP7:DEBUG:RPCManager:XMLHttpRequest POST to http://127.0.0.1:8888/builtinds/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-01-06&isc_xhr=1&isc_tnum=1 contentType: application/x-www-form-urlencoded; charset=UTF-8 with body -->_transaction=<transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">1</transactionNum><operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><values xsi:type="xsd:Object"><EMPLOYEE_ID>38289</EMPLOYEE_ID><SUBMITDATE xsi:type="xsd:date">2011-05-16</SUBMITDATE><STATUS>something</STATUS></values><operationConfig xsi:type="xsd:Object"><dataSource>REQUESTS</dataSource><operationType>add</operationType></operationConfig><componentId>isc_ListGrid_0</componentId><appID>builtinApplication</appID><operation>REQUESTS_add</operation><oldValues xsi:type="xsd:Object"><EMPLOYEE_ID>38289</EMPLOYEE_ID><SUBMITDATE xsi:type="xsd:date">2011-05-16</SUBMITDATE><STATUS>something</STATUS></oldValues></elem></operations></transaction>&protocolVersion=1.0<-- 16:18:58.224:XRP1:INFO:RPCManager:transaction 1 arrived after 454ms 16:18:58.224:XRP1:DEBUG:RPCManager:Result string for transaction 1: "<BR>com.isomorphic.servlet.IDACall top-level exception<BR> <PRE> java.lang.NoClassDefFoundError: javax/mail/Multipart at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1649) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:173) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:130) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:95) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) Caused by: java.lang.ClassNotFoundException: javax.mail.Multipart at java.lang.ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337) ... 28 more </PRE> " 16:18:58.239:XRP1:INFO:RPCManager:rpcResponse(unstructured) results -->"<BR>com.isomorphic.servlet.IDACall top-level exception<BR> <PRE> java.lang.NoClassDefFoundError: javax/mail/Multipart at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1649) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:173) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:130) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:95) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) Caused by: java.lang.ClassNotFoundException: javax.mail.Multipart at java.lang.ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337) ... 28 more </PRE> "<-- 16:19:41.224:DEBUG:ListGrid:isc_ListGrid_0:delaying adjustOverflow: childResized
Using:
■ IE7
■ WinXP
■ Eclipse 3.6
■ GWT 2.2
■ SGWT 2.4 (eval)
Comment