error headless send emails

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

error headless send emails

Postby robysimo09 » Tue May 29, 2012 12:41 pm

Hello

I have a batch process that send the emails with attachment.
The files for attachments are saved in the filesystem of the server /home/file etc...
My batch read an information record with sender, recipient etc and then read the file and create the attachment.
This method work perfectly in every server installation except one.
In this case, they receive the email without the attachment.
I use the mail standard plugin, not the mailPro plugin.
I already change the smtp configuration but doesn't work ( I'm sure that this work in another installation )

You can see the error below:

2012-05-29 12:10:00,030 ERROR [pool-4-thread-4299] com.servoy.j2db.util.Debug - Throwable
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(Unknown Source)
at javax.swing.SwingUtilities.getSharedOwnerFrame(Unknown Source)
at javax.swing.JOptionPane.getRootFrame(Unknown Source)
at javax.swing.JOptionPane.getWindowForComponent(Unknown Source)
at javax.swing.JFileChooser.createDialog(Unknown Source)
at javax.swing.JFileChooser.showDialog(Unknown Source)
at javax.swing.JFileChooser.showOpenDialog(Unknown Source)
at com.servoy.j2db.util.FileChooserUtils.getAReadFile(FileChooserUtils.java:170)
at com.servoy.j2db.util.FileChooserUtils.getAReadFile(FileChooserUtils.java:160)
at com.servoy.extensions.plugins.file.FileProvider.js_readFile(Unknown Source)
at sun.reflect.GeneratedMethodAccessor439.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:179)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:353)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3666)
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:3135)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:476)
at com.servoy.j2db.plugins.ClientPluginAccessProvider$MethodExecutor.run(ClientPluginAccessProvider.java:511)
at com.servoy.j2db.server.headlessclient.SessionClient.invokeAndWait(SessionClient.java:1171)
at com.servoy.j2db.server.headlessclient.SessionClient.invokeLater(SessionClient.java:1161)
at com.servoy.j2db.plugins.ClientPluginAccessProvider$1.run(ClientPluginAccessProvider.java:439)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

System information:

linux Centos
Servoy 5.2.12
Postgres 9.0.x
java.vm.name=Java HotSpot(TM) Server VM
java.version=1.6.0_18

Can you help me?
Thank you
Roberto
robysimo09
 
Posts: 108
Joined: Fri Sep 04, 2009 9:06 am

Re: error headless send emails

Postby mboegem » Tue May 29, 2012 4:51 pm

Hi Roberto,

looking at the exception I see that this method is trying to display a filechooser dialog.
This is not possible for a headless client as you can imagine.

I guess you are trying to create an email with attachment.
Somewhere on the way creating/getting the attachment your method fails and Servoy is displaying the filechooser dialog instead.

Hope this helps.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1382
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: error headless send emails

Postby robysimo09 » Mon Jun 04, 2012 9:50 am

Hi

thank you for answer.
I have imagined the cause but I don't see the error.
I will investigate...

Thank you
Roberto
robysimo09
 
Posts: 108
Joined: Fri Sep 04, 2009 9:06 am

Re: error headless send emails

Postby rgansevles » Wed Jun 06, 2012 9:57 am

Roberto,

The file plugin readFile() method wants to show a file selection dialog is the file argument is null or does not exist.
When the file argument exists, it just reads the file without UI and so without headless exception.

So, I guess in that one server something is wrong with the file argument.

Hope this helps,
Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1838
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: error headless send emails

Postby robysimo09 » Wed Jun 06, 2012 10:49 am

Thank you Rob

The strange thing is that sometimes work and sometimes give the error :(

I will still investigate today.

Thanks
Rob
robysimo09
 
Posts: 108
Joined: Fri Sep 04, 2009 9:06 am

Re: error headless send emails

Postby mboegem » Wed Jun 06, 2012 1:54 pm

robysimo09 wrote:The strange thing is that sometimes work and sometimes give the error :(


Probably sometimes the file you point to does exist, sometimes it doesn't.
That's the most likely cause that describes the current behavior.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1382
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 1 guest