Page 1 of 1

error headless send emails

PostPosted: Tue May 29, 2012 12:41 pm
by robysimo09
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

Re: error headless send emails

PostPosted: Tue May 29, 2012 4:51 pm
by mboegem
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.

Re: error headless send emails

PostPosted: Mon Jun 04, 2012 9:50 am
by robysimo09
Hi

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

Thank you
Roberto

Re: error headless send emails

PostPosted: Wed Jun 06, 2012 9:57 am
by rgansevles
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

Re: error headless send emails

PostPosted: Wed Jun 06, 2012 10:49 am
by robysimo09
Thank you Rob

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

I will still investigate today.

Thanks
Rob

Re: error headless send emails

PostPosted: Wed Jun 06, 2012 1:54 pm
by mboegem
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.

Re: error headless send emails

PostPosted: Wed Jan 31, 2018 9:55 am
by palacio
Hi!

Few days ago I had also this problem. We have a headless client that needs to send mails with or without attachment.
The problem was the receiver of the mail receives the mail but without the attached document.
The headless client is in a computer and the attached document is in a windows server so they are not in the same location.
Thank you for this post because it helped me atleast have an example and an idea of what the problem is.
We have resolved this problem, with the help of our technicians, the solution to this problem is the on the services of the
headlesss client , Services of the servoy, we added the user of the computer to which it should run when the
batches are goint to be active.

We did'nt have an idea that if there is no specific user in the servoy application service the headless client cannot access
folders with specified permissions.

Thank you.
palacio